From 45bbb5474c47cc7d3063a97b56ffbd0d989fcf28 Mon Sep 17 00:00:00 2001 From: yhjun1026 <460342015@qq.com> Date: Thu, 17 Sep 2026 18:29:00 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=B8=85=E7=90=86=E5=BC=80=E6=BA=90?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E5=86=85=E7=BD=91=E6=95=8F=E6=84=9F=E4=BF=A1?= =?UTF-8?q?=E6=81=AF(=E5=9F=9F=E5=90=8D/=E5=86=85=E9=83=A8=E5=8C=85?= =?UTF-8?q?=E5=90=8D/mock=20=E6=95=B0=E6=8D=AE=E8=84=B1=E6=95=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 antchat.alipay.com 硬编码及泄露的 API key 占位 - yuque_url.py 不再硬编码 yuque.antfin.com,改为从传入 URL 解析 host - 清理 mock/doc 中的内部包名(@alipay/*、@ali/*)、内部 registry、花名、内部平台 id - 删除注释中的内网文档链接与内部工具引用 Co-Authored-By: Claude --- .../src/derisk_client/tool_client.py | 2 +- .../src/derisk/util/tracer/base.py | 3 +- .../src/derisk_ext/rag/knowledge/yuque_url.py | 4 +- tests/test_agent_refactor_simple.py | 6 +-- tests/test_agent_refactor_validation.py | 4 +- .../components/VariableChooseModal/index.tsx | 1 - .../VisComponents/VisCodeIde/code-mock.md | 52 ++++++------------- .../VisComponents/VisCodeIde/index.md | 2 +- .../VisComponents/VisLLM/index.md | 6 +-- 9 files changed, 28 insertions(+), 52 deletions(-) diff --git a/packages/derisk-client/src/derisk_client/tool_client.py b/packages/derisk-client/src/derisk_client/tool_client.py index 48f116e0a..6c5aafeba 100644 --- a/packages/derisk-client/src/derisk_client/tool_client.py +++ b/packages/derisk-client/src/derisk_client/tool_client.py @@ -44,7 +44,7 @@ def from_dict(cls, d: Dict[str, Any]): class ToolClient: """ - A client for interacting with the Alipay Tool Base API. + A client for interacting with the Tool Base API. """ def __init__(self, diff --git a/packages/derisk-core/src/derisk/util/tracer/base.py b/packages/derisk-core/src/derisk/util/tracer/base.py index 72f16429a..e7b6b1b45 100644 --- a/packages/derisk-core/src/derisk/util/tracer/base.py +++ b/packages/derisk-core/src/derisk/util/tracer/base.py @@ -360,6 +360,5 @@ def _parse_span_id(body: Any) -> Optional[str]: def new_trace_id() -> str: - # todo: 按照站内规则重新生产traceId - # https://yuque.antfin.com/middleware/tracer/id_generate + # todo: 按照链路追踪规范重新生成 traceId return uuid.uuid4().hex diff --git a/packages/derisk-ext/src/derisk_ext/rag/knowledge/yuque_url.py b/packages/derisk-ext/src/derisk_ext/rag/knowledge/yuque_url.py index 8505399db..62ecb8e9e 100644 --- a/packages/derisk-ext/src/derisk_ext/rag/knowledge/yuque_url.py +++ b/packages/derisk-ext/src/derisk_ext/rag/knowledge/yuque_url.py @@ -57,12 +57,12 @@ def _load(self) -> List[Document]: if self._path is not None: if self._path.count("/") < 5: raise ValueError(f"yuque url: {self._path} format is incorrect!") - _, _, _, group, book_slug, doc_id = self._path.split("/", 5) + scheme, _, host, group, book_slug, doc_id = self._path.split("/", 5) web_reader = AntYuqueLoader(access_token=self._doc_token) book = web_reader.single_doc( group=group, book_slug=book_slug, doc_id=doc_id ) - yuque_url = f"https://yuque.antfin.com/{group}/{book_slug}/{doc_id}" + yuque_url = f"{scheme}//{host}/{group}/{book_slug}/{doc_id}" if book['type'] == 'Sheet': logger.info(f"yuque url {yuque_url} type is sheet, need sheet split method") diff --git a/tests/test_agent_refactor_simple.py b/tests/test_agent_refactor_simple.py index 9555c8909..9bcc48562 100644 --- a/tests/test_agent_refactor_simple.py +++ b/tests/test_agent_refactor_simple.py @@ -101,8 +101,8 @@ def create_llm_client(): provider = ProviderConfig( provider="openai", - api_base="https://antchat.alipay.com/v1", - api_key="fbCTZnIbReh1vVW8oySViGHhrQ8fK2mS", + api_base="https://xx/v1", + api_key="YOUR_API_KEY", ) model = ModelConfig(name="DeepSeek-V3", temperature=0.7, max_new_tokens=40960) @@ -558,7 +558,7 @@ async def main(): """主测试入口""" logger.info("\n" + "=" * 70) logger.info("开始 Agent 重构验证测试") - logger.info("模型配置: DeepSeek-V3 @ https://antchat.alipay.com/v1") + logger.info("模型配置: DeepSeek-V3") logger.info("=" * 70) # 测试基础设施模块 diff --git a/tests/test_agent_refactor_validation.py b/tests/test_agent_refactor_validation.py index 0cbbe10b2..7c76c5654 100644 --- a/tests/test_agent_refactor_validation.py +++ b/tests/test_agent_refactor_validation.py @@ -91,8 +91,8 @@ def create_llm_client(): provider_config = { "provider": "openai", - "api_base": "https://antchat.alipay.com/v1", - "api_key": "fbCTZnIbReh1vVW8oySViGHhrQ8fK2mS", + "api_base": "https://xxx/v1", + "api_key": "YOUR_API_KEY", } model_config = { diff --git a/web/src/components/PromptEditor/components/VariableChooseModal/index.tsx b/web/src/components/PromptEditor/components/VariableChooseModal/index.tsx index 985b4b2ab..e628ae63a 100644 --- a/web/src/components/PromptEditor/components/VariableChooseModal/index.tsx +++ b/web/src/components/PromptEditor/components/VariableChooseModal/index.tsx @@ -1,5 +1,4 @@ import { useEffect, useRef, useState } from 'react'; -// import { Highlight } from '@alipay/tech-ui'; import { Rect } from '@codemirror/view'; import { Empty, Flex, Popover, Typography } from 'antd'; import React from 'react'; diff --git a/web/src/components/chat/chat-content-components/VisComponents/VisCodeIde/code-mock.md b/web/src/components/chat/chat-content-components/VisComponents/VisCodeIde/code-mock.md index 6644738d0..015dabbbf 100644 --- a/web/src/components/chat/chat-content-components/VisComponents/VisCodeIde/code-mock.md +++ b/web/src/components/chat/chat-content-components/VisComponents/VisCodeIde/code-mock.md @@ -80,7 +80,6 @@ code something... js ```js import React from 'react'; -// import { CodePreview } from '@alipay/uni-chat'; // import Title from 'antd/es/skeleton/Title'; import { isEqual } from 'lodash'; @@ -106,14 +105,10 @@ export default React.memo(VisCodeIde, isEqual); json ```json { - "name": "@alipay/uni-chat", + "name": "@derisk/vis", "version": "1.1.92", - "description": "A library project powered by bigfish-library", - "repository": { - "type": "git", - "url": "https://code.alipay.com/tr-web/UniChat" - }, - "author": "will.jc", + "description": "A vis component library project", + "author": "OpenDerisk", "module": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -123,19 +118,14 @@ json "assets.json" ], "scripts": { - "build": "bigfish-lib build", - "build:watch": "bigfish-lib build -w", - "ci": "tnpm run lint && jest --coverage --passWithNoTests tnpm run lint && jest --coverage --passWithNoTests tnpm run lint && jest --coverage --passWithNoTests tnpm run lint && jest --coverage --passWithNoTests tnpm run lint && jest --coverage --passWithNoTests tnpm run lint && jest --coverage --passWithNoTests", + "build": "father build", + "build:watch": "father build -w", + "ci": "npm run lint && jest --coverage --passWithNoTests", "cov": "jest --coverage", - "create": "bigfish-lib create", - "deploy": "bigfish-lib deploy", - "dev": "bigfish-lib doc dev", - "doctor": "bigfish-lib doctor", - "lint": "bigfish-lib lint", - "prepare": "bigfish-lib setup && husky install", - "prepublishOnly": "bigfish-lib prepublish", - "pull": "bigfish-lib pull", - "start": "sudo PORT=443 HTTPS=true tnpm run dev", + "dev": "dumi dev", + "lint": "eslint --fix .", + "prepare": "husky install", + "start": "npm run dev", "test": "jest" }, "commitlint": { @@ -148,22 +138,19 @@ json "prettier --cache --write --no-error-on-unmatched-pattern" ], "*.{js,jsx}": [ - "bigfish-lib lint --fix --eslint-only", + "eslint --fix", "prettier --cache --write" ], "*.{css,less}": [ - "bigfish-lib lint --fix --stylelint-only", + "stylelint --fix", "prettier --cache --write" ], "*.{ts,tsx}": [ - "bigfish-lib lint --fix --eslint-only", + "eslint --fix", "prettier --cache --parser=typescript --write" ] }, "dependencies": { - "@alipay/sregpt-ui": "^1.0.16", - "@alipay/tech-ui": "^3.14.5", - "@alipay/vis-datafun": "^1.0.0", "@ant-design/cssinjs": "^1.24.0", "@ant-design/icons": "^5.5.1", "@ant-design/x": "^1.0.0-alpha.5", @@ -207,8 +194,6 @@ json "vfile": "^5.3.7" }, "devDependencies": { - "@ali/ci": "^4.26.0", - "@alipay/bigfish-library": "^4.0.0", "@commitlint/cli": "^17.3.0", "@commitlint/config-conventional": "^17.3.0", "@testing-library/jest-dom": "^5.1.1", @@ -242,16 +227,9 @@ json "install-node": "16" }, "publishConfig": { - "registry": "https://registry.antgroup-inc.cn" - }, - "ci": { - "type": "aci" - }, - "dumiAssets": "assets.json", - "tnpm": { - "mode": "npm" + "registry": "https://registry.npmjs.org" }, - "yuyanId": "180020010101325639" + "dumiAssets": "assets.json" } ``` diff --git a/web/src/components/chat/chat-content-components/VisComponents/VisCodeIde/index.md b/web/src/components/chat/chat-content-components/VisComponents/VisCodeIde/index.md index e8f3e0920..75f7e544c 100644 --- a/web/src/components/chat/chat-content-components/VisComponents/VisCodeIde/index.md +++ b/web/src/components/chat/chat-content-components/VisComponents/VisCodeIde/index.md @@ -11,7 +11,7 @@ group: ````jsx import React from 'react'; import { Space } from 'antd'; -import { VisCodeIde } from '@alipay/uni-chat'; +import { VisCodeIde } from '@derisk/vis'; export default () => { return ( diff --git a/web/src/components/chat/chat-content-components/VisComponents/VisLLM/index.md b/web/src/components/chat/chat-content-components/VisComponents/VisLLM/index.md index c15bdfb2b..c2f122812 100644 --- a/web/src/components/chat/chat-content-components/VisComponents/VisLLM/index.md +++ b/web/src/components/chat/chat-content-components/VisComponents/VisLLM/index.md @@ -11,7 +11,7 @@ group: ```jsx import React from 'react'; import { Space } from 'antd'; -import { VisLLM } from '@alipay/uni-chat'; +import { VisLLM } from '@derisk/vis'; export default () => { return ( @@ -34,7 +34,7 @@ export default () => { "token_use": 256, "token_speed": 45.8, "llm_model": "gpt-4-turbo", - "llm_avatar": "https://local.alipay/avatars/ai-assistant.png", + "llm_avatar": "https://example.com/avatars/ai-assistant.png", "start_time": "2024-01-15T14:30:00Z", "firt_out_time": "2024-01-15T14:30:02.345Z", "cost": 2345, @@ -60,7 +60,7 @@ export default () => { "token_use": 256, "token_speed": 45.8, "llm_model": "gpt-4-turbo", - "llm_avatar": "https://local.alipay/avatars/ai-assistant.png", + "llm_avatar": "https://example.com/avatars/ai-assistant.png", "start_time": "2024-01-15T14:30:00Z", "firt_out_time": "2024-01-15T14:30:02.345Z", "cost": 2345,