From 3eabd0961bc63f08f10b4c582ed1c471df43a8c7 Mon Sep 17 00:00:00 2001 From: zhaoqingang <zhaoqg0118@163.com> Date: 星期一, 10 二月 2025 15:40:26 +0800 Subject: [PATCH] 獲取配置信息增加api --- main.py | 2 +- app/config/env_conf/account.yaml | 4 ++-- app/config/env_conf/menu_conf.json | 8 ++++---- app/service/v2/app_driver/chat_data.py | 14 ++++++++++---- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/app/config/env_conf/account.yaml b/app/config/env_conf/account.yaml index 6af5c4a..48d6c42 100644 --- a/app/config/env_conf/account.yaml +++ b/app/config/env_conf/account.yaml @@ -3,5 +3,5 @@ password: gAAAAABnpFLtotY2OIRH12BJh4MzMgn5Zil7-DVpIeuqlFwvr0g6g_n4ULogn-LNhCbtk6cCDkzZlqAHvBSX2e_zf7AsoyzbiQ== workflow_server: - account: zqg@mail.com - password: gAAAAABnpCfh1IAlSg1wBn7xPjbiucm-YAyzrKygw4rQiRg267ZMrhIolE38n94E8GgOmWpFfQx3s79zdD6yUrIqOLa2YeW7eA== \ No newline at end of file + account: admin@basic.com + password: gAAAAABnpFLtotY2OIRH12BJh4MzMgn5Zil7-DVpIeuqlFwvr0g6g_n4ULogn-LNhCbtk6cCDkzZlqAHvBSX2e_zf7AsoyzbiQ== \ No newline at end of file diff --git a/app/config/env_conf/menu_conf.json b/app/config/env_conf/menu_conf.json index bf4fd22..fac6e33 100644 --- a/app/config/env_conf/menu_conf.json +++ b/app/config/env_conf/menu_conf.json @@ -44,8 +44,8 @@ "rank": 105, "dialog": [ { - "id": "e476db7cbdbb11ef82b50242ac130006", - "chat_id": "e476db7cbdbb11ef82b50242ac130006", + "id": "6b8ee426c67511efb1510242ac1b0006", + "chat_id": "6b8ee426c67511efb1510242ac1b0006", "chat_type": "knowledgeQA", "agentType": 1 } @@ -78,8 +78,8 @@ "rank": 104, "dialog": [ { - "id": "90d533729c0211efbf6b0242ac160006", - "chat_id": "90d533729c0211efbf6b0242ac160006", + "id": "9727d6b0e78111efb10a0242ac1b0003", + "chat_id": "9727d6b0e78111efb10a0242ac1b0003", "chat_type": "chat", "agentType": 1 } diff --git a/app/service/v2/app_driver/chat_data.py b/app/service/v2/app_driver/chat_data.py index 97939d2..52e6883 100644 --- a/app/service/v2/app_driver/chat_data.py +++ b/app/service/v2/app_driver/chat_data.py @@ -18,7 +18,11 @@ async def chat_ping(self, url, params, headers): res = await self.http_get(url, params, headers) - return res.status_code + if res.status_code != 200: + return 0 + if res.json().get("code") == "unauthorized" or res.json().get("code") == 401: + return 0 + return 200 async def chat_post(self, url, data, headers): @@ -78,9 +82,11 @@ # ans = await chat.chat_parameters(url, params, headers) # print(ans) - ping_url = "http://192.168.20.119:13002/console/api/workspaces" - user_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiNzBhNWVhZWYtYzU4Yi00YTE0LTliOGQtYWE2MzY0ZmE1ZDE3IiwiZXhwIjoxNzM5MjU2MDMyLCJpc3MiOiJTRUxGX0hPU1RFRCIsInN1YiI6IkNvbnNvbGUgQVBJIFBhc3Nwb3J0In0.tlxdRIVL2Ewgb0V4M5pj6v_U2yyvQxtCDrbvSxLjUBs" - token = "Bearer {}" + ping_url = "http://192.168.20.116:11080/v1/system/version" + # ping_url = "http://192.168.20.119:13002/console/api/workspaces" + user_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiNjEzNzdiYzctZTViYy00YjhiLTgxYTYtNWZkOTVhODVlMmE4IiwiZXhwIjoxNzM5MjU3Njk1LCJpc3MiOiJTRUxGX0hPU1RFRCIsInN1YiI6IkNvbnNvbGUgQVBJIFBhc3Nwb3J0In0.w7xQrepd1dYR4iPXcbuthIZjdm45bTJFbolOM_SE9aQ" + # token = "Bearer {}" + token = "{}" res = await chat.chat_ping(ping_url, {}, await chat.get_chat_headers(token.format(user_token))) print(res) diff --git a/main.py b/main.py index bf04686..f4497c8 100644 --- a/main.py +++ b/main.py @@ -91,7 +91,7 @@ app.include_router(canvas_router, prefix='/api/canvas', tags=["canvas"]) app.include_router(label_router, prefix='/api/label', tags=["label"]) app.include_router(public_api, prefix='/v1/api', tags=["public_api"]) -app.include_router(chat_router_v2, prefix='/v1/chat', tags=["chat1"]) +app.include_router(chat_router_v2, prefix='/api/v1/chat', tags=["chat1"]) app.mount("/static", StaticFiles(directory="app/images"), name="static") if __name__ == "__main__": -- Gitblit v1.8.0