From 63a7155645e717634c7b77ad34661c879360537a Mon Sep 17 00:00:00 2001 From: zxstty Date: Thu, 24 Apr 2025 11:15:03 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=81=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E5=AE=8C=E6=AF=95=E7=8A=B6=E6=80=81=E6=9C=AA=E5=8F=8A?= =?UTF-8?q?=E6=97=B6=E6=9B=B4=E6=96=B0=E7=9A=84=E9=97=AE=E9=A2=98;?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E8=8A=82=E7=82=B9&=E6=AD=A5=E9=AA=A4?= =?UTF-8?q?=E7=9A=84=E8=BE=93=E5=87=BA=E5=8F=82=E6=95=B0=E7=9A=84=E5=B1=95?= =?UTF-8?q?=E7=8E=B0=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/manager/flow.py | 4 ++-- apps/routers/chat.py | 4 ++-- apps/scheduler/slot/slot.py | 30 ++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/apps/manager/flow.py b/apps/manager/flow.py index 38dc18231..41742a87b 100644 --- a/apps/manager/flow.py +++ b/apps/manager/flow.py @@ -90,7 +90,7 @@ class FlowManager: # TODO: 由于现在没有动态表单,所以暂时使用Slot的create_empty_slot方法 parameters = { "input_parameters": Slot(params_schema).create_empty_slot(), - "output_parameters": output_schema, + "output_parameters": Slot(output_schema).extract_type_desc_from_schema(), } except Exception: logger.exception("[FlowManager] generate_from_schema 失败") @@ -267,7 +267,7 @@ class FlowManager: output_parameters = {} parameters = { "input_parameters": input_parameters, - "output_parameters": output_parameters, + "output_parameters": Slot(output_parameters).extract_type_desc_from_schema(), } node_item = NodeItem( stepId=node_id, diff --git a/apps/routers/chat.py b/apps/routers/chat.py index 727c9730d..756e9938a 100644 --- a/apps/routers/chat.py +++ b/apps/routers/chat.py @@ -103,8 +103,6 @@ async def chat_generator(post_body: RequestData, user_sub: str, session_id: str) # 创建新Record,存入数据库 await save_data(task_id, user_sub, post_body, scheduler.used_docs) - yield "data: [DONE]\n\n" - if post_body.app and post_body.app.flow_id: await FlowManager.update_flow_debug_by_app_and_flow_id( post_body.app.app_id, @@ -112,6 +110,8 @@ async def chat_generator(post_body: RequestData, user_sub: str, session_id: str) debug=True, ) + yield "data: [DONE]\n\n" + except Exception: logger.exception("[Chat] 生成答案失败") yield "data: [ERROR]\n\n" diff --git a/apps/scheduler/slot/slot.py b/apps/scheduler/slot/slot.py index cb2304694..46a4f656d 100644 --- a/apps/scheduler/slot/slot.py +++ b/apps/scheduler/slot/slot.py @@ -193,6 +193,36 @@ class Slot: return _generate_example(self._schema) + def extract_type_desc_from_schema(self) -> dict[str, str]: + """从JSON Schema中提取类型描述""" + + def _extract_type_desc(schema_node: dict[str, Any]) -> None: + if "type" not in schema_node and "anyOf" not in schema_node: + return None + data = {"type": schema_node.get("type", ""), "description": schema_node.get("description", "")} + if "anyOf" in schema_node: + data["type"] = "anyOf" + # 处理类型为 object 的节点 + if "anyOf" in schema_node: + data["items"] = {} + type_index = 0 + for sub_schema in schema_node["anyOf"]: + sub_result = _extract_type_desc(sub_schema) + type_index += 1 + if sub_result: + data["items"]["type_"+str(type_index)] = sub_result + if schema_node.get("type", "") == "object": + data["items"] = {} + for key, val in schema_node.get("properties", {}).items(): + data["items"][key] = _extract_type_desc(val) + + # 处理类型为 array 的节点 + if schema_node.get("type", "") == "array": + items_schema = schema_node.get("items", {}) + data["items"] = _extract_type_desc(items_schema) + return data + return _extract_type_desc(self._schema) + def _flatten_schema(self, schema: dict[str, Any]) -> tuple[dict[str, Any], list[str]]: """将JSON Schema扁平化""" result = {} -- Gitee From 23da82534b3e7ae23f4f291cdae66ada2578dd8e Mon Sep 17 00:00:00 2001 From: zxstty Date: Thu, 24 Apr 2025 11:46:32 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=AE=8C=E5=96=84service=20metadat?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E7=9A=84=E6=9D=83=E9=99=90=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/manager/service.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/apps/manager/service.py b/apps/manager/service.py index 55775b765..15d094a20 100644 --- a/apps/manager/service.py +++ b/apps/manager/service.py @@ -256,7 +256,20 @@ class ServiceCenterManager: ) -> ServiceMetadata: """获取服务元数据""" service_collection = MongoDB.get_collection("service") - db_service = await service_collection.find_one({"_id": service_id, "author": user_sub}) + match_conditions = { + {"author": user_sub}, + { + "permission.type": PermissionType.PUBLIC.value + }, + { + "$and": [ + {"permission.type": PermissionType.PROTECTED.value}, + {"permission.users": {"$in": [user_sub]}}, + ], + } + } + query = {"$and": [{"service_id": service_id}, {"$or": match_conditions}]} + db_service = await service_collection.find_one(query) if not db_service: msg = "Service not found" raise ServiceIDError(msg) -- Gitee From 6883ef8c94f1073b3e89a203e35f6549588185fb Mon Sep 17 00:00:00 2001 From: zxstty Date: Thu, 24 Apr 2025 11:56:00 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96service?= =?UTF-8?q?=E9=89=B4=E6=9D=83=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/manager/service.py | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/apps/manager/service.py b/apps/manager/service.py index 15d094a20..f6ea26d83 100644 --- a/apps/manager/service.py +++ b/apps/manager/service.py @@ -221,19 +221,17 @@ class ServiceCenterManager: """获取服务数据""" # 验证用户权限 service_collection = MongoDB.get_collection("service") - match_conditions = { + match_conditions = [ {"author": user_sub}, - { - "permission.type": PermissionType.PUBLIC.value - }, + {"permission.type": PermissionType.PUBLIC.value}, { "$and": [ {"permission.type": PermissionType.PROTECTED.value}, - {"permission.users": {"$in": [user_sub]}}, + {"permission.users": user_sub}, ], - } - } - query = {"$and": [{"service_id": service_id}, {"$or": match_conditions}]} + }, + ] + query = {"$and": [{"_id": service_id}, {"$or": match_conditions}]} db_service = await service_collection.find_one(query) if not db_service: msg = "Service not found" @@ -256,19 +254,17 @@ class ServiceCenterManager: ) -> ServiceMetadata: """获取服务元数据""" service_collection = MongoDB.get_collection("service") - match_conditions = { + match_conditions = [ {"author": user_sub}, - { - "permission.type": PermissionType.PUBLIC.value - }, + {"permission.type": PermissionType.PUBLIC.value}, { "$and": [ {"permission.type": PermissionType.PROTECTED.value}, - {"permission.users": {"$in": [user_sub]}}, + {"permission.users": user_sub}, ], - } - } - query = {"$and": [{"service_id": service_id}, {"$or": match_conditions}]} + }, + ] + query = {"$and": [{"_id": service_id}, {"$or": match_conditions}]} db_service = await service_collection.find_one(query) if not db_service: msg = "Service not found" -- Gitee From 97e4eb4115a0fc0083e92524994ef7c7108845d9 Mon Sep 17 00:00:00 2001 From: ylzhangah <1194926515@qq.com> Date: Thu, 24 Apr 2025 16:18:38 +0800 Subject: [PATCH 4/5] update file --- deploy/chart/authhub/templates/NOTES.txt | 4 ++-- deploy/chart/databases/templates/NOTES.txt | 4 ++-- deploy/chart/euler_copilot/templates/NOTES.txt | 6 +++--- .../scripts/8-install-EulerCopilot/install_eulercopilot.sh | 6 ++---- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/deploy/chart/authhub/templates/NOTES.txt b/deploy/chart/authhub/templates/NOTES.txt index bcad43df6..864ed037a 100644 --- a/deploy/chart/authhub/templates/NOTES.txt +++ b/deploy/chart/authhub/templates/NOTES.txt @@ -1,5 +1,5 @@ -感谢您使用Euler Copilot! -当前为Euler Copilot 0.9.5版本。 +感谢您使用EulerCopilot! +当前为EulerCopilot 0.9.5版本。 当前Chart的功能为:AuthHub统一登录系统部署。 说明: diff --git a/deploy/chart/databases/templates/NOTES.txt b/deploy/chart/databases/templates/NOTES.txt index 3f7b03f99..c4a588c39 100644 --- a/deploy/chart/databases/templates/NOTES.txt +++ b/deploy/chart/databases/templates/NOTES.txt @@ -1,3 +1,3 @@ -感谢您使用Euler Copilot! -当前为Euler Copilot 0.9.5版本。 +感谢您使用EulerCopilot! +当前为EulerCopilot 0.9.5版本。 当前Chart的功能为:数据库部署。 diff --git a/deploy/chart/euler_copilot/templates/NOTES.txt b/deploy/chart/euler_copilot/templates/NOTES.txt index 83c02b2c7..16a0f41f4 100644 --- a/deploy/chart/euler_copilot/templates/NOTES.txt +++ b/deploy/chart/euler_copilot/templates/NOTES.txt @@ -1,5 +1,5 @@ -感谢您使用Euler Copilot! -当前为Euler Copilot 0.9.5版本。 -当前Chart的功能为:Euler Copilot核心组件部署。 +感谢您使用EulerCopilot! +当前为EulerCopilot 0.9.5版本。 +当前Chart的功能为:EulerCopilot核心组件部署。 更多项目动态和分享会议,请关注openEuler sig-intelligence:https://www.openeuler.org/en/sig/sig-detail/?name=sig-intelligence diff --git a/deploy/scripts/8-install-EulerCopilot/install_eulercopilot.sh b/deploy/scripts/8-install-EulerCopilot/install_eulercopilot.sh index 4f5fa3d74..923e390fb 100755 --- a/deploy/scripts/8-install-EulerCopilot/install_eulercopilot.sh +++ b/deploy/scripts/8-install-EulerCopilot/install_eulercopilot.sh @@ -241,12 +241,10 @@ modify_yaml() { python3 "${DEPLOY_DIR}/scripts/9-other-script/modify_eulercopilot_yaml.py" \ "${DEPLOY_DIR}/chart/euler_copilot/values.yaml" \ "${DEPLOY_DIR}/chart/euler_copilot/values.yaml" \ - --set "models.answer.url=http://$host:11434" \ + --set "models.answer.endpoint=http://$host:11434" \ --set "models.answer.key=sk-123456" \ --set "models.answer.name=deepseek-llm-7b-chat:latest" \ - --set "models.answer.ctx_length=8192" \ - --set "models.answer.max_tokens=2048" \ - --set "models.embedding.url=http://$host:11434" \ + --set "models.embedding.endpoint=http://$host:11434" \ --set "models.embedding.key=sk-123456" \ --set "models.embedding.name=bge-m3:latest" \ --set "login.client.id=${client_id}" \ -- Gitee From 25fc2cabfec8a79f01710d06d45a6ac2bf05863d Mon Sep 17 00:00:00 2001 From: z30057876 Date: Thu, 24 Apr 2025 19:41:28 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0chart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/chart/euler_copilot/configs/rag/.env | 2 +- deploy/chart/euler_copilot/templates/rag/rag-config.yaml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/deploy/chart/euler_copilot/configs/rag/.env b/deploy/chart/euler_copilot/configs/rag/.env index 46965ad11..f7520d576 100644 --- a/deploy/chart/euler_copilot/configs/rag/.env +++ b/deploy/chart/euler_copilot/configs/rag/.env @@ -36,7 +36,7 @@ SESSION_TTL=1440 # PROMPT_PATH PROMPT_PATH=/rag-service/data_chain/common/prompt.yaml # Stop Words PATH -STOP_WORDS_PATH=/rag-service/data_chain/common/stop_words.txt +STOP_WORDS_PATH=/rag-service/data_chain/common/stopwords.txt #Security HALF_KEY1=${halfKey1} diff --git a/deploy/chart/euler_copilot/templates/rag/rag-config.yaml b/deploy/chart/euler_copilot/templates/rag/rag-config.yaml index b68c5ed90..25bf01df1 100644 --- a/deploy/chart/euler_copilot/templates/rag/rag-config.yaml +++ b/deploy/chart/euler_copilot/templates/rag/rag-config.yaml @@ -9,4 +9,6 @@ data: {{ tpl (.Files.Get "configs/rag/.env") . | indent 4}} .env-sql: |- {{ tpl (.Files.Get "configs/rag/.env-sql") . | indent 4}} + copy-config.yaml: |- +{{ tpl (.Files.Get "configs/rag/copy-config.yaml") . | indent 4}} {{- end -}} \ No newline at end of file -- Gitee