github-advanced-security[bot] commented on code in PR #64:
URL:
https://github.com/apache/incubator-hugegraph-ai/pull/64#discussion_r1719755198
##########
hugegraph-llm/src/hugegraph_llm/demo/rag_web_demo.py:
##########
@@ -141,13 +144,141 @@
raise gr.Error(str(e))
-if __name__ == "__main__":
- parser = argparse.ArgumentParser()
- parser.add_argument("--host", type=str, default="0.0.0.0", help="host")
- parser.add_argument("--port", type=int, default=8001, help="port")
- args = parser.parse_args()
- app = FastAPI()
-
+class RAGRequest(BaseModel):
+ query: str
+ raw_llm: Optional[bool] = True
+ vector_only: Optional[bool] = False
+ graph_only: Optional[bool] = False
+ graph_vector: Optional[bool] = False
+
+
+class GraphConfigRequest(BaseModel):
+ ip: str = "127.0.0.1"
+ port: str = "8080"
+ name: str = "hugegraph"
+ user: str = "xxx"
+ pwd: str = "xxx"
+ gs: str = None
+
+
+class LLMConfigRequest(BaseModel):
+ llm_type: str
+ # The common parameters shared by OpenAI, Qianfan Wenxin,
+ # and OLLAMA platforms.
+ api_key: str
+ api_base: str
+ language_model: str
+ # Openai-only properties
+ max_tokens: str = None
+ # qianfan-wenxin-only properties
+ secret_key: str = None
+ # ollama-only properties
+ host: str = None
+ port: str = None
+
+
+def test_api_connection(url, method="GET", headers=None, body=None, auth=None):
+ # TODO: use fastapi.request / starlette instead? (Also add a try-catch
here)
+ response = None
+ log.debug("Request URL: %s", url)
+ if method.upper() == "GET":
+ response = requests.get(url, headers=headers, timeout=5, auth=auth)
Review Comment:
## Full server-side request forgery
The full URL of this request depends on a [user-provided value](1).
The full URL of this request depends on a [user-provided value](2).
The full URL of this request depends on a [user-provided value](3).
The full URL of this request depends on a [user-provided value](4).
The full URL of this request depends on a [user-provided value](5).
The full URL of this request depends on a [user-provided value](6).
The full URL of this request depends on a [user-provided value](7).
[Show more
details](https://github.com/apache/incubator-hugegraph-ai/security/code-scanning/12)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]