fix system prompt
This commit is contained in:
parent
8a8b17cb3f
commit
ad17594360
312
.vscode/tabs.my-browser.json
vendored
312
.vscode/tabs.my-browser.json
vendored
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"currentIndex": 0,
|
"currentIndex": 3,
|
||||||
"tabs": [
|
"tabs": [
|
||||||
{
|
{
|
||||||
"name": "交互测试",
|
"name": "交互测试",
|
||||||
@ -10,36 +10,262 @@
|
|||||||
"messages": [
|
"messages": [
|
||||||
{
|
{
|
||||||
"role": "user",
|
"role": "user",
|
||||||
"content": "websocket 如何进行转发",
|
"content": "总结 https://asoca.grand-challenge.org/ ",
|
||||||
"extraInfo": {
|
"extraInfo": {
|
||||||
"created": 1747321092503,
|
"created": 1747379137481,
|
||||||
"state": "success",
|
"state": "success",
|
||||||
"serverName": "Huoshan DeepSeek"
|
"serverName": "Huoshan DeepSeek"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"role": "assistant",
|
"role": "assistant",
|
||||||
"content": "WebSocket 转发通常涉及在服务器端接收来自客户端的 WebSocket 连接,并将消息转发到另一个 WebSocket 服务器或客户端。以下是一个简单的步骤来实现 WebSocket 转发:\n\n### 1. 建立 WebSocket 服务器\n首先,你需要创建一个 WebSocket 服务器来接收客户端的连接。\n\n```javascript\nconst WebSocket = require('ws');\nconst wss = new WebSocket.Server({ port: 8080 });\n\nwss.on('connection', function connection(ws) {\n console.log('Client connected');\n\n ws.on('message', function incoming(message) {\n console.log('Received: %s', message);\n // 在这里处理消息转发\n });\n\n ws.on('close', function close() {\n console.log('Client disconnected');\n });\n});\n```\n\n### 2. 连接到目标 WebSocket 服务器\n在接收到客户端的消息后,你需要将这些消息转发到目标 WebSocket 服务器。\n\n```javascript\nconst targetWs = new WebSocket('ws://target-websocket-server');\n\ntargetWs.on('open', function open() {\n console.log('Connected to target WebSocket server');\n});\n\ntargetWs.on('message', function incoming(message) {\n console.log('Received from target: %s', message);\n // 将消息转发回客户端\n ws.send(message);\n});\n\ntargetWs.on('close', function close() {\n console.log('Disconnected from target WebSocket server');\n});\n```\n\n### 3. 转发消息\n在接收到客户端的消息后,将其转发到目标 WebSocket 服务器。\n\n```javascript\nws.on('message', function incoming(message) {\n console.log('Received: %s', message);\n targetWs.send(message);\n});\n```\n\n### 4. 处理目标服务器的响应\n将目标服务器的响应转发回客户端。\n\n```javascript\ntargetWs.on('message', function incoming(message) {\n console.log('Received from target: %s', message);\n ws.send(message);\n});\n```\n\n### 5. 处理错误和关闭事件\n确保处理错误和关闭事件,以保持连接的稳定性。\n\n```javascript\nws.on('error', function error(err) {\n console.error('WebSocket error:', err);\n});\n\nws.on('close', function close() {\n console.log('WebSocket closed');\n targetWs.close();\n});\n\ntargetWs.on('error', function error(err) {\n console.error('Target WebSocket error:', err);\n});\n\ntargetWs.on('close', function close() {\n console.log('Target WebSocket closed');\n});\n```\n\n### 完整示例\n以下是一个完整的示例代码:\n\n```javascript\nconst WebSocket = require('ws');\nconst wss = new WebSocket.Server({ port: 8080 });\n\nwss.on('connection', function connection(ws) {\n console.log('Client connected');\n\n const targetWs = new WebSocket('ws://target-websocket-server');\n\n targetWs.on('open', function open() {\n console.log('Connected to target WebSocket server');\n });\n\n targetWs.on('message', function incoming(message) {\n console.log('Received from target: %s', message);\n ws.send(message);\n });\n\n targetWs.on('close', function close() {\n console.log('Disconnected from target WebSocket server');\n });\n\n ws.on('message', function incoming(message) {\n console.log('Received: %s', message);\n targetWs.send(message);\n });\n\n ws.on('error', function error(err) {\n console.error('WebSocket error:', err);\n });\n\n ws.on('close', function close() {\n console.log('WebSocket closed');\n targetWs.close();\n });\n\n targetWs.on('error', function error(err) {\n console.error('Target WebSocket error:', err);\n });\n\n targetWs.on('close', function close() {\n console.log('Target WebSocket closed');\n });\n});\n```\n\n### 总结\n通过上述步骤,你可以实现一个简单的 WebSocket 转发服务器。这个服务器将接收客户端的 WebSocket 连接,并将消息转发到目标 WebSocket 服务器,同时将目标服务器的响应转发回客户端。",
|
"content": "",
|
||||||
|
"tool_calls": [
|
||||||
|
{
|
||||||
|
"id": "call_2z36dkpt4m5jaioqjsbjabiw",
|
||||||
|
"index": 0,
|
||||||
|
"type": "function",
|
||||||
|
"function": {
|
||||||
|
"name": "k_navigate",
|
||||||
|
"arguments": "{\"url\":\"https://asoca.grand-challenge.org/\"}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
"extraInfo": {
|
"extraInfo": {
|
||||||
"created": 1747321106609,
|
"created": 1747379138355,
|
||||||
"state": "success",
|
"state": "success",
|
||||||
"serverName": "Huoshan DeepSeek"
|
"serverName": "Huoshan DeepSeek"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"role": "user",
|
"role": "tool",
|
||||||
"content": "我现在有一个内网的 8282 上的 ws,想要通过一台公网服务器 kirigaya.cn 转发到公网的 8282 上",
|
"index": 0,
|
||||||
|
"tool_call_id": "call_2z36dkpt4m5jaioqjsbjabiw",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "Navigated to https://asoca.grand-challenge.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
"extraInfo": {
|
"extraInfo": {
|
||||||
"created": 1747321168696,
|
"created": 1747379139028,
|
||||||
"state": "success",
|
"state": "success",
|
||||||
"serverName": "Huoshan DeepSeek"
|
"serverName": "Huoshan DeepSeek"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"role": "assistant",
|
"role": "assistant",
|
||||||
"content": "要通过一台公网服务器 `kirigaya.cn` 将内网的 WebSocket 服务(运行在 `8282` 端口)转发到公网的 `8282` 端口上,你可以使用以下步骤:\n\n### 1. 在公网服务器上设置 WebSocket 转发\n在公网服务器 `kirigaya.cn` 上,你需要设置一个 WebSocket 服务器来接收公网客户端的连接,并将消息转发到内网的 WebSocket 服务。\n\n#### 使用 Node.js 实现 WebSocket 转发\n以下是一个使用 Node.js 和 `ws` 库实现的 WebSocket 转发示例:\n\n```javascript\nconst WebSocket = require('ws');\n\n// 公网 WebSocket 服务器\nconst wss = new WebSocket.Server({ port: 8282 });\n\nwss.on('connection', function connection(ws) {\n console.log('Public client connected');\n\n // 连接到内网 WebSocket 服务\n const targetWs = new WebSocket('ws://内网服务器IP:8282');\n\n targetWs.on('open', function open() {\n console.log('Connected to internal WebSocket server');\n });\n\n targetWs.on('message', function incoming(message) {\n console.log('Received from internal: %s', message);\n // 将消息转发回公网客户端\n ws.send(message);\n });\n\n targetWs.on('close', function close() {\n console.log('Disconnected from internal WebSocket server');\n });\n\n ws.on('message', function incoming(message) {\n console.log('Received from public: %s', message);\n // 将消息转发到内网 WebSocket 服务\n targetWs.send(message);\n });\n\n ws.on('error', function error(err) {\n console.error('Public WebSocket error:', err);\n });\n\n ws.on('close', function close() {\n console.log('Public WebSocket closed');\n targetWs.close();\n });\n\n targetWs.on('error', function error(err) {\n console.error('Internal WebSocket error:', err);\n });\n\n targetWs.on('close', function close() {\n console.log('Internal WebSocket closed');\n });\n});\n```\n\n### 2. 运行 WebSocket 转发服务\n将上述代码保存为 `websocket-proxy.js`,然后在公网服务器上运行:\n\n```bash\nnode websocket-proxy.js\n```\n\n### 3. 配置防火墙和端口\n确保公网服务器的防火墙允许 `8282` 端口的流量。你可以使用以下命令开放端口(假设使用 `ufw`):\n\n```bash\nsudo ufw allow 8282\n```\n\n### 4. 客户端连接\n公网客户端现在可以通过 `ws://kirigaya.cn:8282` 连接到 WebSocket 服务。消息将通过公网服务器转发到内网的 WebSocket 服务。\n\n### 5. 保持服务运行\n为了确保 WebSocket 转发服务持续运行,你可以使用 `pm2` 或 `systemd` 来管理 Node.js 进程。\n\n#### 使用 `pm2` 管理进程\n安装 `pm2`:\n\n```bash\nnpm install -g pm2\n```\n\n启动服务:\n\n```bash\npm2 start websocket-proxy.js\n```\n\n保存进程列表:\n\n```bash\npm2 save\n```\n\n### 总结\n通过上述步骤,你可以在公网服务器 `kirigaya.cn` 上设置一个 WebSocket 转发服务,将公网客户端的连接转发到内网的 WebSocket 服务。这样可以实现内网服务的公网访问。",
|
"content": "现在我将总结 https://asoca.grand-challenge.org/ 的内容。\n\n首先,我需要浏览页面并提取相关信息。接下来,我将执行以下步骤:\n\n1. 获取页面的标题和主要描述。\n2. 提取页面中的关键信息,如项目目标、参与方式、时间安排等。\n3. 总结页面的主要内容和目的。\n\n让我开始执行这些步骤。",
|
||||||
|
"tool_calls": [
|
||||||
|
{
|
||||||
|
"id": "call_zv6y2wsmzqn9ei7y8oywt75r",
|
||||||
|
"index": 0,
|
||||||
|
"type": "function",
|
||||||
|
"function": {
|
||||||
|
"name": "k_evaluate",
|
||||||
|
"arguments": "{\"script\":\"document.title\"}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "call_uzg4bj50l2ekjaonrkj8r852",
|
||||||
|
"index": 1,
|
||||||
|
"type": "function",
|
||||||
|
"function": {
|
||||||
|
"name": "k_evaluate",
|
||||||
|
"arguments": "{\"script\":\"document.querySelector('meta[name=\\\"description\\\"]').content\"}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "call_q3jqivcv8vgfpmk4u7w9k9au",
|
||||||
|
"index": 2,
|
||||||
|
"type": "function",
|
||||||
|
"function": {
|
||||||
|
"name": "k_evaluate",
|
||||||
|
"arguments": "{\"script\":\"Array.from(document.querySelectorAll('h1, h2, h3, p')).map(el => el.textContent.trim()).join('\\\\n')\"}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
"extraInfo": {
|
"extraInfo": {
|
||||||
"created": 1747321181151,
|
"created": 1747379142638,
|
||||||
|
"state": "success",
|
||||||
|
"serverName": "Huoshan DeepSeek"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "tool",
|
||||||
|
"index": 0,
|
||||||
|
"tool_call_id": "call_zv6y2wsmzqn9ei7y8oywt75r",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "Execution result:\n\"ERROR: The request could not be satisfied\"\n\nConsole output:\n"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extraInfo": {
|
||||||
|
"created": 1747379142650,
|
||||||
|
"state": "success",
|
||||||
|
"serverName": "Huoshan DeepSeek"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "tool",
|
||||||
|
"index": 1,
|
||||||
|
"tool_call_id": "call_uzg4bj50l2ekjaonrkj8r852",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "Script execution failed: Cannot read properties of null (reading 'content')"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extraInfo": {
|
||||||
|
"created": 1747379142656,
|
||||||
|
"state": "tool call failed",
|
||||||
|
"serverName": "Huoshan DeepSeek"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "tool",
|
||||||
|
"index": 2,
|
||||||
|
"tool_call_id": "call_q3jqivcv8vgfpmk4u7w9k9au",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "Execution result:\n\"403 ERROR\\nThe request could not be satisfied.\"\n\nConsole output:\n"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extraInfo": {
|
||||||
|
"created": 1747379142664,
|
||||||
|
"state": "success",
|
||||||
|
"serverName": "Huoshan DeepSeek"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "assistant",
|
||||||
|
"content": "",
|
||||||
|
"tool_calls": [
|
||||||
|
{
|
||||||
|
"id": "call_w7iq0mszlm46ooo06w9fvri4",
|
||||||
|
"index": 0,
|
||||||
|
"type": "function",
|
||||||
|
"function": {
|
||||||
|
"name": "k_navigate",
|
||||||
|
"arguments": "{\"url\":\"https://asoca.grand-challenge.org/\",\"launchOptions\":{\"headless\":false,\"args\":[\"--no-sandbox\"]},\"allowDangerous\":true}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extraInfo": {
|
||||||
|
"created": 1747379144069,
|
||||||
|
"state": "success",
|
||||||
|
"serverName": "Huoshan DeepSeek"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "tool",
|
||||||
|
"index": 0,
|
||||||
|
"tool_call_id": "call_w7iq0mszlm46ooo06w9fvri4",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "Navigated to https://asoca.grand-challenge.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extraInfo": {
|
||||||
|
"created": 1747379147016,
|
||||||
|
"state": "success",
|
||||||
|
"serverName": "Huoshan DeepSeek"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "assistant",
|
||||||
|
"content": "",
|
||||||
|
"tool_calls": [
|
||||||
|
{
|
||||||
|
"id": "call_qelzom3lpyo7skuil4b469t9",
|
||||||
|
"index": 0,
|
||||||
|
"type": "function",
|
||||||
|
"function": {
|
||||||
|
"name": "k_evaluate",
|
||||||
|
"arguments": "{\"script\":\"document.title\"}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "call_wtla8rzqnes1gffk7wieubxk",
|
||||||
|
"index": 1,
|
||||||
|
"type": "function",
|
||||||
|
"function": {
|
||||||
|
"name": "k_evaluate",
|
||||||
|
"arguments": "{\"script\":\"document.querySelector('meta[name=\\\"description\\\"]').content\"}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "call_z6wcwspc9lqk4w3sfknv30um",
|
||||||
|
"index": 2,
|
||||||
|
"type": "function",
|
||||||
|
"function": {
|
||||||
|
"name": "k_evaluate",
|
||||||
|
"arguments": "{\"script\":\"Array.from(document.querySelectorAll('h1, h2, h3, p')).map(el => el.textContent.trim()).join('\\\\n')\"}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extraInfo": {
|
||||||
|
"created": 1747379148961,
|
||||||
|
"state": "success",
|
||||||
|
"serverName": "Huoshan DeepSeek"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "tool",
|
||||||
|
"index": 0,
|
||||||
|
"tool_call_id": "call_qelzom3lpyo7skuil4b469t9",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "Execution result:\n\"\"\n\nConsole output:\n"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extraInfo": {
|
||||||
|
"created": 1747379149424,
|
||||||
|
"state": "success",
|
||||||
|
"serverName": "Huoshan DeepSeek"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "tool",
|
||||||
|
"index": 1,
|
||||||
|
"tool_call_id": "call_wtla8rzqnes1gffk7wieubxk",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "Script execution failed: Cannot read properties of null (reading 'content')"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extraInfo": {
|
||||||
|
"created": 1747379149428,
|
||||||
|
"state": "tool call failed",
|
||||||
|
"serverName": "Huoshan DeepSeek"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "tool",
|
||||||
|
"index": 2,
|
||||||
|
"tool_call_id": "call_z6wcwspc9lqk4w3sfknv30um",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "Execution result:\n\"\"\n\nConsole output:\n"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extraInfo": {
|
||||||
|
"created": 1747379149432,
|
||||||
|
"state": "success",
|
||||||
|
"serverName": "Huoshan DeepSeek"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "assistant",
|
||||||
|
"content": "由此可见,网站 https://asoca.grand-challenge.org/ 可能有一些限制或反爬虫机制,导致无法直接获取页面内容。建议通过以下方式进一步分析:\n\n1. **检查页面加载状态**:确认页面是否完全加载。\n2. **查看网络请求**:检查是否有额外的网络请求或动态内容加载。\n3. **使用开发者工具**:手动查看页面元素和结构。\n\n如果需要进一步操作,请告诉我!",
|
||||||
|
"extraInfo": {
|
||||||
|
"created": 1747379151760,
|
||||||
"state": "success",
|
"state": "success",
|
||||||
"serverName": "Huoshan DeepSeek"
|
"serverName": "Huoshan DeepSeek"
|
||||||
}
|
}
|
||||||
@ -90,6 +316,72 @@
|
|||||||
"systemPrompt": ""
|
"systemPrompt": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "工具",
|
||||||
|
"icon": "icon-tool",
|
||||||
|
"type": "tool",
|
||||||
|
"componentIndex": 2,
|
||||||
|
"storage": {
|
||||||
|
"currentToolName": "k_navigate",
|
||||||
|
"formData": {
|
||||||
|
"url": "https://asoca.grand-challenge.org/",
|
||||||
|
"launchOptions": {
|
||||||
|
"headless": false
|
||||||
|
},
|
||||||
|
"allowDangerous": false
|
||||||
|
},
|
||||||
|
"lastToolCallResponse": {
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "Navigated to https://asoca.grand-challenge.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isError": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "资源",
|
||||||
|
"icon": "icon-file",
|
||||||
|
"type": "blank",
|
||||||
|
"componentIndex": 0,
|
||||||
|
"storage": {
|
||||||
|
"formData": {},
|
||||||
|
"currentType": "resource",
|
||||||
|
"currentResourceName": "Browser console logs",
|
||||||
|
"lastResourceReadResponse": {
|
||||||
|
"contents": [
|
||||||
|
{
|
||||||
|
"uri": "console://logs",
|
||||||
|
"mimeType": "text/plain",
|
||||||
|
"text": "[warn] Error with Permissions-Policy header: Unrecognized feature: 'ambient-light-sensor'.\n[warn] Error with Permissions-Policy header: Unrecognized feature: 'document-domain'.\n[warn] Error with Permissions-Policy header: Unrecognized feature: 'ambient-light-sensor'.\n[warn] Error with Permissions-Policy header: Unrecognized feature: 'document-domain'.\n[error] Failed to load resource: the server responded with a status of 403 ()\n[error] Failed to load resource: the server responded with a status of 403 ()"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "工具",
|
||||||
|
"icon": "icon-tool",
|
||||||
|
"type": "blank",
|
||||||
|
"componentIndex": 2,
|
||||||
|
"storage": {
|
||||||
|
"formData": {
|
||||||
|
"script": "document.body.innerText"
|
||||||
|
},
|
||||||
|
"currentToolName": "k_evaluate",
|
||||||
|
"lastToolCallResponse": {
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "Execution result:\n\"\"\n\nConsole output:\n"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isError": false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -1,5 +1,9 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## [main] 0.0.9
|
||||||
|
- 修复 0.0.8 引入的bug:system prompt 返回的是索引而非真实内容
|
||||||
|
-
|
||||||
|
|
||||||
## [main] 0.0.8
|
## [main] 0.0.8
|
||||||
- 大模型 API 测试时更加完整的报错
|
- 大模型 API 测试时更加完整的报错
|
||||||
- 修复 0.0.7 引入的bug:修改对话无法发出
|
- 修复 0.0.7 引入的bug:修改对话无法发出
|
||||||
|
Binary file not shown.
@ -13,7 +13,7 @@
|
|||||||
--font-size-xsp: 11px;
|
--font-size-xsp: 11px;
|
||||||
--md-zoom: 1.12;
|
--md-zoom: 1.12;
|
||||||
|
|
||||||
--code-font-family: Consolas, Monaco, "Cascadia code", 'Andale Mono', 'Ubuntu Mono', monospace;
|
--code-font-family: Consolas, Monaco, "CustomCodeFont", 'Andale Mono', 'Ubuntu Mono', monospace;
|
||||||
|
|
||||||
/* css 动画属性 */
|
/* css 动画属性 */
|
||||||
--animation-7s: .7s cubic-bezier(0.23, 1, 0.32, 1);
|
--animation-7s: .7s cubic-bezier(0.23, 1, 0.32, 1);
|
||||||
@ -24,8 +24,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: "Cascadia code";
|
font-family: "CustomCodeFont";
|
||||||
src: url("./CascadiaCode.woff2");
|
src: url("./sf-mono-regular.woff2");
|
||||||
}
|
}
|
||||||
|
|
||||||
html,
|
html,
|
||||||
|
BIN
renderer/public/sf-mono-regular.woff2
Normal file
BIN
renderer/public/sf-mono-regular.woff2
Normal file
Binary file not shown.
@ -12,6 +12,13 @@ export const systemPrompts = ref<SystemPrompt[]>([{
|
|||||||
content: '你是一个AI助手, 你可以回答任何问题。'
|
content: '你是一个AI助手, 你可以回答任何问题。'
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
export function getSystemPrompt(name: string) {
|
||||||
|
const prompt = systemPrompts.value.find(prompt => prompt.name === name);
|
||||||
|
if (prompt) {
|
||||||
|
return prompt.content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export async function saveSystemPrompts() {
|
export async function saveSystemPrompts() {
|
||||||
const bridge = useMessageBridge();
|
const bridge = useMessageBridge();
|
||||||
|
|
||||||
|
@ -103,7 +103,6 @@ function handleInput(event: Event) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(fragments);
|
|
||||||
emit('update:modelValue', fragments.join(' '));
|
emit('update:modelValue', fragments.join(' '));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import { pinkLog, redLog } from "@/views/setting/util";
|
|||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import { handleToolCalls, type ToolCallResult } from "./handle-tool-calls";
|
import { handleToolCalls, type ToolCallResult } from "./handle-tool-calls";
|
||||||
import { getPlatform } from "@/api/platform";
|
import { getPlatform } from "@/api/platform";
|
||||||
|
import { getSystemPrompt, systemPrompts } from "../chat-box/options/system-prompt";
|
||||||
|
|
||||||
export type ChatCompletionChunk = OpenAI.Chat.Completions.ChatCompletionChunk;
|
export type ChatCompletionChunk = OpenAI.Chat.Completions.ChatCompletionChunk;
|
||||||
export type ChatCompletionCreateParamsBase = OpenAI.Chat.Completions.ChatCompletionCreateParams & { id?: string };
|
export type ChatCompletionCreateParamsBase = OpenAI.Chat.Completions.ChatCompletionCreateParams & { id?: string };
|
||||||
@ -156,7 +157,7 @@ export class TaskLoop {
|
|||||||
|
|
||||||
}, { once: true });
|
}, { once: true });
|
||||||
|
|
||||||
// console.log(chatData);
|
console.log(chatData);
|
||||||
|
|
||||||
this.bridge.postMessage({
|
this.bridge.postMessage({
|
||||||
command: 'llm/chat/completions',
|
command: 'llm/chat/completions',
|
||||||
@ -183,10 +184,15 @@ export class TaskLoop {
|
|||||||
const tools = getToolSchema(tabStorage.settings.enableTools);
|
const tools = getToolSchema(tabStorage.settings.enableTools);
|
||||||
|
|
||||||
const userMessages = [];
|
const userMessages = [];
|
||||||
|
|
||||||
|
// 尝试获取 system prompt,在 api 模式下,systemPrompt 就是目标提词
|
||||||
|
// 但是在 UI 模式下,systemPrompt 只是一个 index,需要从后端数据库中获取真实 prompt
|
||||||
if (tabStorage.settings.systemPrompt) {
|
if (tabStorage.settings.systemPrompt) {
|
||||||
|
const prompt = getSystemPrompt(tabStorage.settings.systemPrompt) || tabStorage.settings.systemPrompt;
|
||||||
|
|
||||||
userMessages.push({
|
userMessages.push({
|
||||||
role: 'system',
|
role: 'system',
|
||||||
content: tabStorage.settings.systemPrompt
|
content: prompt
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,128 @@
|
|||||||
"type": "blank",
|
"type": "blank",
|
||||||
"componentIndex": 3,
|
"componentIndex": 3,
|
||||||
"storage": {
|
"storage": {
|
||||||
"messages": [],
|
"messages": [
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": "https://challenge.isic-archive.com/data/#2020",
|
||||||
|
"extraInfo": {
|
||||||
|
"created": 1747382016210,
|
||||||
|
"state": "success",
|
||||||
|
"serverName": "deepseek"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "assistant",
|
||||||
|
"content": "",
|
||||||
|
"tool_calls": [
|
||||||
|
{
|
||||||
|
"id": "call_0_9dedd2c3-32ba-4f8c-993f-bb381b9845b0",
|
||||||
|
"index": 0,
|
||||||
|
"type": "function",
|
||||||
|
"function": {
|
||||||
|
"name": "k_navigate",
|
||||||
|
"arguments": "{\"url\":\"https://challenge.isic-archive.com/data/#2020\"}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extraInfo": {
|
||||||
|
"created": 1747382021478,
|
||||||
|
"state": "success",
|
||||||
|
"serverName": "deepseek"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "tool",
|
||||||
|
"index": 0,
|
||||||
|
"tool_call_id": "call_0_9dedd2c3-32ba-4f8c-993f-bb381b9845b0",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "Navigated to https://challenge.isic-archive.com/data/#2020"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extraInfo": {
|
||||||
|
"created": 1747382026814,
|
||||||
|
"state": "success",
|
||||||
|
"serverName": "deepseek",
|
||||||
|
"usage": {
|
||||||
|
"prompt_tokens": 1422,
|
||||||
|
"completion_tokens": 31,
|
||||||
|
"total_tokens": 1453,
|
||||||
|
"prompt_tokens_details": {
|
||||||
|
"cached_tokens": 0
|
||||||
|
},
|
||||||
|
"prompt_cache_hit_tokens": 0,
|
||||||
|
"prompt_cache_miss_tokens": 1422
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "assistant",
|
||||||
|
"content": "",
|
||||||
|
"tool_calls": [
|
||||||
|
{
|
||||||
|
"id": "call_0_b4cd47c1-ad08-46a1-9a0e-d202dd2aef0a",
|
||||||
|
"index": 0,
|
||||||
|
"type": "function",
|
||||||
|
"function": {
|
||||||
|
"name": "k_get_full_page_text",
|
||||||
|
"arguments": "{}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extraInfo": {
|
||||||
|
"created": 1747382031777,
|
||||||
|
"state": "success",
|
||||||
|
"serverName": "deepseek"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "tool",
|
||||||
|
"index": 0,
|
||||||
|
"tool_call_id": "call_0_b4cd47c1-ad08-46a1-9a0e-d202dd2aef0a",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "Execution result:\n\"mail_outline\\nSUBSCRIBE\\nLOGIN\\nSIGN UP\\nISIC Challenge Datasets\\n2016\\n2017\\n2018\\n2019\\n2020\\nTraining Data\\tTraining Ground Truth\\tTest Data\\tTest Ground Truth\\tLicense\\n\\n\\nDownload DICOM (48.9GB)\\n33,126 DICOM images with embedded metadata.\\n\\nDownload DICOM Corrected* (23.0GB)\\n33,126 DICOM images with embedded metadata.\\n\\nDownload JPEG (23GB)\\n33,126 JPEG images.\\n\\nDownload metadata (2MB)\\n33,126 metadata entries of patient ID, sex, age, and general anatomic site.\\n\\nDownload metadata v2 (2MB)\\n33,126 metadata entries of patient ID, lesion ID, sex, age, and general anatomic site.\\n\\nDownload duplicate image list (2MB)\\nList of 425 duplicate images.\\n\\n\\tDownload (2MB)\\n33,126 entries of gold standard lesion diagnoses.\\t\\n\\nDownload DICOM (15.3GB)\\n10,982 DICOM images with embedded metadata.\\n\\nDownload DICOM Corrected* (6.7GB)\\n10,982 DICOM images with embedded metadata.\\n\\nDownload JPEG (6.7GB)\\n10,982 JPEG images.\\n\\nDownload metadata (458KB)\\n10,982 metadata entries of patient ID, sex, age, and general anatomic site.\\n\\n\\t\\nNot Available\\nhelp_outline\\n\\tCC-BY-NC\\n\\n*The newer version of the DICOM files are provided to avoid potential errors stemming from readers implementing a strict DICOM verification, as implemented in http://dclunie.com/dicom3tools/dciodvfy.html.\\n\\nCiting 2020 datasets:\\nTo comply with the attribution requirements of the CC-BY-NC license , the aggregate \\\"ISIC 2020\\\" data must be cited as:\\n\\nInternational Skin Imaging Collaboration. SIIM-ISIC 2020 Challenge Dataset. International Skin Imaging Collaboration https://doi.org/10.34970/2020-ds01 (2020).\\n\\nCreative Commons Attribution-Non Commercial 4.0 International License.\\n\\nThe dataset was generated by the International Skin Imaging Collaboration (ISIC) and images are from the following sources: Hospital Clínic de Barcelona, Medical University of Vienna, Memorial Sloan Kettering Cancer Center, Melanoma Institute Australia, The University of Queensland, and the University of Athens Medical School.\\n\\nYou should have received a copy of the license along with this work.\\n\\nIf not, see https://creativecommons.org/licenses/by-nc/4.0/legalcode.txt .\\n\\nWhen referencing this dataset in your own manuscripts and publications, please use the following full citation. Please note this is a preprint and has not undergone peer review. It is being prepared for submission and if accepted to a peer reviewed journal the below will be updated accordingly:\\n\\n[1] Rotemberg, V., Kurtansky, N., Betz-Stablein, B., Caffery, L., Chousakos, E., Codella, N., Combalia, M., Dusza, S., Guitera, P., Gutman, D., Halpern, A., Helba, B., Kittler, H., Kose, K., Langer, S., Lioprys, K., Malvehy, J., Musthaq, S., Nanda, J., Reiter, O., Shih, G., Stratigos, A., Tschandl, P., Weber, J. & Soyer, P. A patient-centric dataset of images and metadata for identifying melanomas using clinical context. Sci Data 8, 34 (2021). https://doi.org/10.1038/s41597-021-00815-z\\n\\nTerms of Use|Contact\\nREPORT AN ISSUE\"\n\nConsole output:\n"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extraInfo": {
|
||||||
|
"created": 1747382031793,
|
||||||
|
"state": "success",
|
||||||
|
"serverName": "deepseek",
|
||||||
|
"usage": {
|
||||||
|
"prompt_tokens": 1484,
|
||||||
|
"completion_tokens": 17,
|
||||||
|
"total_tokens": 1501,
|
||||||
|
"prompt_tokens_details": {
|
||||||
|
"cached_tokens": 1408
|
||||||
|
},
|
||||||
|
"prompt_cache_hit_tokens": 1408,
|
||||||
|
"prompt_cache_miss_tokens": 76
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "assistant",
|
||||||
|
"content": "### ISIC 2020 皮肤影像数据集 \n该数据集由国际皮肤影像协作组(ISIC)提供,用于训练和测试AI模型以识别皮肤病变,尤其是黑色素瘤。数据集包含大量皮肤镜图像及其相关元数据,适用于医学影像分析和皮肤病学研究。\n\n**主要类型**:医学影像(皮肤镜图像) \n**涉及器官**:皮肤 \n\n🔗 **开源链接**: \n- [DICOM格式下载](https://challenge.isic-archive.com/data/#2020) \n- [JPEG格式下载](https://challenge.isic-archive.com/data/#2020) \n- [元数据下载](https://challenge.isic-archive.com/data/#2020) \n\n**数据集特点**: \n- 包含33,126张训练图像和10,982张测试图像。 \n- 提供患者ID、性别、年龄和病变部位等元数据。 \n- 遵循CC-BY-NC 4.0国际许可协议。 \n\n**引用方式**: \n如需引用此数据集,请参考以下文献: \nRotemberg, V., et al. (2021). *A patient-centric dataset of images and metadata for identifying melanomas using clinical context*. Sci Data 8, 34. [DOI链接](https://doi.org/10.1038/s41597-021-00815-z) \n\n**注意事项**: \n- 数据集仅限非商业用途。 \n- 使用前需确认已阅读并遵守许可协议。 ",
|
||||||
|
"extraInfo": {
|
||||||
|
"created": 1747382050707,
|
||||||
|
"state": "success",
|
||||||
|
"serverName": "deepseek",
|
||||||
|
"usage": {
|
||||||
|
"prompt_tokens": 2425,
|
||||||
|
"completion_tokens": 317,
|
||||||
|
"total_tokens": 2742,
|
||||||
|
"prompt_tokens_details": {
|
||||||
|
"cached_tokens": 1472
|
||||||
|
},
|
||||||
|
"prompt_cache_hit_tokens": 1472,
|
||||||
|
"prompt_cache_miss_tokens": 953
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"modelIndex": 7,
|
"modelIndex": 7,
|
||||||
"enableTools": [
|
"enableTools": [
|
||||||
@ -45,12 +166,17 @@
|
|||||||
"name": "k_evaluate",
|
"name": "k_evaluate",
|
||||||
"description": "Execute JavaScript in the browser console",
|
"description": "Execute JavaScript in the browser console",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "k_get_full_page_text",
|
||||||
|
"description": "获取页面所有文本内容",
|
||||||
|
"enabled": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"enableWebSearch": false,
|
"enableWebSearch": false,
|
||||||
"temperature": 0.7,
|
"temperature": 0.7,
|
||||||
"contextLength": 20,
|
"contextLength": 20,
|
||||||
"systemPrompt": ""
|
"systemPrompt": "medical data"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user