|
| 1 | +# DeepChat DeepLinks 文档 / DeepChat DeepLinks Documentation |
| 2 | + |
| 3 | +DeepChat支持通过深度链接(Deeplinks)进行外部调用。本文档介绍了DeepChat支持的深度链接类型、参数及使用方法。 |
| 4 | + |
| 5 | +DeepChat supports external invocation through deeplinks. This documentation introduces the types of deeplinks supported by DeepChat, their parameters, and usage methods. |
| 6 | + |
| 7 | +## 开始聊天 / Start Chat |
| 8 | + |
| 9 | +通过此链接可以快速开始一个新的聊天会话,并可选择指定模型和初始消息。 |
| 10 | + |
| 11 | +Use this deeplink to quickly start a new chat session with optional model selection and initial message. |
| 12 | + |
| 13 | +### URL格式 / URL Format |
| 14 | + |
| 15 | +``` |
| 16 | +deepchat://start?msg={query}&system={systemPrompt}&model={modelId|modelName} |
| 17 | +``` |
| 18 | + |
| 19 | +### 参数说明 / Parameters |
| 20 | + |
| 21 | +| 参数名 / Parameter | 类型 / Type | 必填 / Required | 说明 / Description | |
| 22 | +| ------------------ | ----------- | --------------- | ----------------------------------------------------------------------------------------------------------- | |
| 23 | +| msg | string | 否 / No | 初始聊天内容 / Initial chat message | |
| 24 | +| system | string | 否 / No | 系统提示词 / System prompt | |
| 25 | +| model | string | 否 / No | 模型ID或名称,如"gpt-3.5-turbo"、"deepseek-chat" / Model ID or name, e.g., "gpt-3.5-turbo", "deepseek-chat" | |
| 26 | + |
| 27 | +### 行为 / Behavior |
| 28 | + |
| 29 | +1. 如果当前不在聊天页面,会自动跳转到聊天页面 |
| 30 | +2. 如果指定了模型,会尝试匹配并选择相应模型(先精确匹配,再模糊匹配) |
| 31 | +3. 如果提供了初始消息,将自动填充到输入框中 |
| 32 | + |
| 33 | +1. If not currently on the chat page, it will automatically navigate to the chat page |
| 34 | +2. If a model is specified, it will attempt to match and select the corresponding model (exact match first, then fuzzy match) |
| 35 | +3. If an initial message is provided, it will be automatically filled in the input box |
| 36 | + |
| 37 | +### 示例 / Examples |
| 38 | + |
| 39 | +基本使用,打开与GPT-3.5的对话: |
| 40 | +Basic usage, open a conversation with GPT-3.5: |
| 41 | + |
| 42 | +``` |
| 43 | +deepchat://start?model=gpt-3.5-turbo |
| 44 | +``` |
| 45 | + |
| 46 | +指定初始消息: |
| 47 | +Specify an initial message: |
| 48 | + |
| 49 | +``` |
| 50 | +deepchat://start?msg=帮我写一篇关于人工智能的文章 |
| 51 | +``` |
| 52 | + |
| 53 | +完整示例(指定模型、消息和系统提示词): |
| 54 | +Complete example (specifying model, message, and system prompt): |
| 55 | + |
| 56 | +``` |
| 57 | +deepchat://start?msg=帮我分析这段代码&model=deepseek-coder&system=你是一个代码分析专家 |
| 58 | +``` |
| 59 | + |
| 60 | +## 安装MCP / Install MCP |
| 61 | + |
| 62 | +通过此深度链接可以安装MCP(模型控制协议)服务配置。 |
| 63 | + |
| 64 | +Use this deeplink to install Model Control Protocol (MCP) service configuration. |
| 65 | + |
| 66 | +### URL格式 / URL Format |
| 67 | + |
| 68 | +``` |
| 69 | +deepchat://mcp/install?code={base64Encode(JSON.stringify(jsonConfig))} |
| 70 | +``` |
| 71 | + |
| 72 | +### 参数说明 / Parameters |
| 73 | + |
| 74 | +| 参数名 / Parameter | 类型 / Type | 必填 / Required | 说明 / Description | |
| 75 | +| ------------------ | ------------- | --------------- | -------------------------------------------------------------------------------------------------- | |
| 76 | +| code | string (JSON) | 是 / Yes | MCP服务配置的JSON字符串(需Base64编码)/ JSON string of MCP service configuration (Base64 encoded) | |
| 77 | + |
| 78 | +### 行为 / Behavior |
| 79 | + |
| 80 | +1. 如果MCP功能未启用,会自动启用 |
| 81 | +2. 自动导航到设置页面的MCP配置部分 |
| 82 | +3. 打开添加服务器对话框,并自动填充配置数据 |
| 83 | + |
| 84 | +1. If the MCP feature is not enabled, it will be automatically enabled |
| 85 | +2. Automatically navigate to the MCP configuration section of the settings page |
| 86 | +3. Open the add server dialog and automatically fill in the configuration data |
| 87 | + |
| 88 | +### 配置JSON格式 / Configuration JSON Format |
| 89 | + |
| 90 | +MCP配置JSON应包含以下结构: |
| 91 | + |
| 92 | +The MCP configuration JSON should contain the following structure: |
| 93 | + |
| 94 | +最小化的JSON格式样例: |
| 95 | + |
| 96 | +### 包含 command 不包含 url,识别为 stdio |
| 97 | +```json |
| 98 | +{ |
| 99 | + "mcpServers": { |
| 100 | + "filesystem": { |
| 101 | + "command": "mcp-filesystem-server", |
| 102 | + "args": [ |
| 103 | + "/Users/username/Desktop", |
| 104 | + ] |
| 105 | + } |
| 106 | + } |
| 107 | +} |
| 108 | +``` |
| 109 | +### 包含 url 不包含 command ,默认识别为 sse |
| 110 | +```json |
| 111 | + |
| 112 | +{ |
| 113 | + "mcpServers": { |
| 114 | + "browser-use-mcp-server": { |
| 115 | + "url": "http://localhost:8000/sse" |
| 116 | + } |
| 117 | + } |
| 118 | +} |
| 119 | +``` |
| 120 | + |
| 121 | +完整的JSON格式: |
| 122 | + |
| 123 | +```json |
| 124 | +{ |
| 125 | + "mcpServers": { |
| 126 | + "filesystem": { |
| 127 | + "command": "mcp-filesystem-server", |
| 128 | + "args": [ |
| 129 | + "/Users/username/Desktop", |
| 130 | + ], |
| 131 | + "env": {}, |
| 132 | + "descriptions": "filesystem mcp server", |
| 133 | + "icons": "📁", |
| 134 | + "type" :"stdio", |
| 135 | + "autoApprove": ["all"] |
| 136 | + } |
| 137 | + } |
| 138 | +} |
| 139 | +``` |
| 140 | +```json |
| 141 | +{ |
| 142 | + "mcpServers": { |
| 143 | + "browser-use-mcp-server": { |
| 144 | + "url": "http://localhost:8000/sse", |
| 145 | + "type":"sse", |
| 146 | + "icons": "🏠", |
| 147 | + "autoApprove": ["all"], |
| 148 | + } |
| 149 | + } |
| 150 | +} |
| 151 | +``` |
| 152 | + |
| 153 | +## 如何生成安装 code 参数(How to Generate MCPConfig code params) |
| 154 | + |
| 155 | +```javascript |
| 156 | +import { encode } from 'js-base64'; |
| 157 | + |
| 158 | +const config = { |
| 159 | + "mcpServers": { |
| 160 | + "browser-use-mcp-server": { |
| 161 | + "url": "http://localhost:8000/sse" |
| 162 | + } |
| 163 | + } |
| 164 | +} |
| 165 | +const code =encode(JSON.stringify(config)) |
| 166 | + |
| 167 | +``` |
| 168 | + |
| 169 | +## 聊天唤起样例 (Chat Example) |
| 170 | +``` |
| 171 | +deepchat://start?msg=%E5%A4%A9%E6%B0%94%E4%B8%8D%E9%94%99&system=%E4%BD%A0%E6%98%AF%E4%B8%80%E4%B8%AA%E9%A2%84%E6%8A%A5%E5%91%98%2C%E8%AF%B7%E4%BD%A0%E7%A4%BC%E8%B2%8C%E8%80%8C%E4%B8%93%E4%B8%9A%E5%9B%9E%E7%AD%94%E7%94%A8%E6%88%B7%E9%97%AE%E9%A2%98&model=deepseek-chat |
| 172 | +``` |
| 173 | + |
| 174 | +## STDIO 安装样例 (Stdio Example) |
| 175 | + |
| 176 | +``` |
| 177 | +deepchat://mcp/install?code=eyJtY3BTZXJ2ZXJzIjp7ImZpbGVzeXN0ZW0iOnsiY29tbWFuZCI6Im1jcC1maWxlc3lzdGVtLXNlcnZlciIsImFyZ3MiOlsiL1VzZXJzL3VzZXJuYW1lL0Rlc2t0b3AiXX19fQ== |
| 178 | +``` |
| 179 | + |
| 180 | +## SSE 安装样例 (SSE Example) |
| 181 | + |
| 182 | +``` |
| 183 | +deepchat://mcp/install?code=eyJtY3BTZXJ2ZXJzIjp7ImJyb3dzZXItdXNlLW1jcC1zZXJ2ZXIiOnsidXJsIjoiaHR0cDovL2xvY2FsaG9zdDo4MDAwL3NzZSJ9fX0= |
| 184 | +``` |
0 commit comments