0.1.0 所有 mvp 完成
This commit is contained in:
parent
4017fc3290
commit
f37b8babcd
@ -5,6 +5,8 @@
|
|||||||
- 新特性:更新协议内容,支持 streamable http 协议,未来将逐步取代 SSE 的连接方式
|
- 新特性:更新协议内容,支持 streamable http 协议,未来将逐步取代 SSE 的连接方式
|
||||||
- 对于 uv 创建的 py 项目进行特殊支持:自动初始化项目,并将 mcp 定向到 .venv/bin/mcp 中,不再需要用户全局安装 mcp
|
- 对于 uv 创建的 py 项目进行特殊支持:自动初始化项目,并将 mcp 定向到 .venv/bin/mcp 中,不再需要用户全局安装 mcp
|
||||||
- 对于 npm 创建的 js/ts 项目进行特殊支持:自动初始化项目
|
- 对于 npm 创建的 js/ts 项目进行特殊支持:自动初始化项目
|
||||||
|
- 去除了 websearch 的设置,增加了 parallel_tool_calls 的设置,parallel_tool_calls 默认为 true,代表 允许模型在单轮回复中调用多个工具
|
||||||
|
- 重构了 openmcp 连接模块的基础设施,基于新的技术设施实现了更加详细的连接模块的日志系统
|
||||||
|
|
||||||
## [main] 0.0.9
|
## [main] 0.0.9
|
||||||
- 修复 0.0.8 引入的bug:system prompt 返回的是索引而非真实内容
|
- 修复 0.0.8 引入的bug:system prompt 返回的是索引而非真实内容
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
| `ext` | 支持基本的 MCP 项目管理 | `迭代版本` | 100% | `P0` |
|
| `ext` | 支持基本的 MCP 项目管理 | `迭代版本` | 100% | `P0` |
|
||||||
| `service` | 支持自定义支持 openai 接口协议的大模型接入 | `完整版本` | 100% | `Done` |
|
| `service` | 支持自定义支持 openai 接口协议的大模型接入 | `完整版本` | 100% | `Done` |
|
||||||
| `service` | 支持自定义接口协议的大模型接入 | `MVP` | 0% | `P1` |
|
| `service` | 支持自定义接口协议的大模型接入 | `MVP` | 0% | `P1` |
|
||||||
| `all` | 支持同时调试多个 MCP Server | `MVP` | 80% | `P0` |
|
| `all` | 支持同时调试多个 MCP Server | `MVP` | 100% | `P0` |
|
||||||
| `all` | 支持通过大模型进行在线验证 | `迭代版本` | 100% | `Done` |
|
| `all` | 支持通过大模型进行在线验证 | `迭代版本` | 100% | `Done` |
|
||||||
| `all` | 支持对用户对应服务器的调试工作内容进行保存 | `迭代版本` | 100% | `Done` |
|
| `all` | 支持对用户对应服务器的调试工作内容进行保存 | `迭代版本` | 100% | `Done` |
|
||||||
| `render` | 高危操作权限确认 | `MVP` | 0% | `P1` |
|
| `render` | 高危操作权限确认 | `MVP` | 0% | `P1` |
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: "iconfont"; /* Project id 4870215 */
|
font-family: "iconfont"; /* Project id 4870215 */
|
||||||
src: url('iconfont.woff2?t=1746703816245') format('woff2'),
|
src: url('iconfont.woff2?t=1747820198035') format('woff2'),
|
||||||
url('iconfont.woff?t=1746703816245') format('woff'),
|
url('iconfont.woff?t=1747820198035') format('woff'),
|
||||||
url('iconfont.ttf?t=1746703816245') format('truetype');
|
url('iconfont.ttf?t=1747820198035') format('truetype');
|
||||||
}
|
}
|
||||||
|
|
||||||
.iconfont {
|
.iconfont {
|
||||||
@ -13,6 +13,10 @@
|
|||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-parallel:before {
|
||||||
|
content: "\e61d";
|
||||||
|
}
|
||||||
|
|
||||||
.icon-waiting:before {
|
.icon-waiting:before {
|
||||||
content: "\e6d0";
|
content: "\e6d0";
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -47,11 +47,11 @@ export interface TextMessage {
|
|||||||
export type ChatMessage = ToolMessage | TextMessage;
|
export type ChatMessage = ToolMessage | TextMessage;
|
||||||
|
|
||||||
// 新增状态和工具数据
|
// 新增状态和工具数据
|
||||||
interface EnableToolItem {
|
export interface EnableToolItem {
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
inputSchema?: any;
|
inputSchema: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChatSetting {
|
export interface ChatSetting {
|
||||||
@ -61,10 +61,11 @@ export interface ChatSetting {
|
|||||||
temperature: number
|
temperature: number
|
||||||
enableWebSearch: boolean
|
enableWebSearch: boolean
|
||||||
contextLength: number
|
contextLength: number
|
||||||
|
parallelToolCalls: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChatStorage {
|
export interface ChatStorage {
|
||||||
messages: ChatMessage[]
|
messages: ChatMessage[]
|
||||||
settings: ChatSetting
|
settings: ChatSetting
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,8 +96,6 @@ interface TextItem {
|
|||||||
|
|
||||||
export type RichTextItem = PromptTextItem | ResourceTextItem | TextItem;
|
export type RichTextItem = PromptTextItem | ResourceTextItem | TextItem;
|
||||||
|
|
||||||
export const allTools = ref<ToolItem[]>([]);
|
|
||||||
|
|
||||||
export interface ICommonRenderMessage {
|
export interface ICommonRenderMessage {
|
||||||
role: 'user' | 'assistant/content';
|
role: 'user' | 'assistant/content';
|
||||||
content: string;
|
content: string;
|
||||||
@ -117,34 +116,20 @@ export type IRenderMessage = ICommonRenderMessage | IToolRenderMessage;
|
|||||||
|
|
||||||
export function getToolSchema(enableTools: EnableToolItem[]) {
|
export function getToolSchema(enableTools: EnableToolItem[]) {
|
||||||
const toolsSchema = [];
|
const toolsSchema = [];
|
||||||
for (let i = 0; i < enableTools.length; i++) {
|
for (let i = 0; i < enableTools.length; i++) {
|
||||||
const enableTool = enableTools[i];
|
const enableTool = enableTools[i];
|
||||||
|
|
||||||
if (enableTool.enabled) {
|
if (enableTool.enabled) {
|
||||||
|
toolsSchema.push({
|
||||||
if (enableTool.inputSchema) {
|
type: 'function',
|
||||||
toolsSchema.push({
|
function: {
|
||||||
type: 'function',
|
name: enableTool.name,
|
||||||
function: {
|
description: enableTool.description || "",
|
||||||
name: enableTool.name,
|
parameters: enableTool.inputSchema
|
||||||
description: enableTool.description || "",
|
}
|
||||||
parameters: enableTool.inputSchema
|
});
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
} else {
|
|
||||||
const tool = allTools.value[i];
|
|
||||||
|
|
||||||
toolsSchema.push({
|
|
||||||
type: 'function',
|
|
||||||
function: {
|
|
||||||
name: tool.name,
|
|
||||||
description: tool.description || "",
|
|
||||||
parameters: tool.inputSchema
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return toolsSchema;
|
return toolsSchema;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
<template>
|
||||||
|
<el-tooltip :content="t('parallel-tool-calls')" placement="top">
|
||||||
|
<div class="setting-button" :class="{ 'active': tabStorage.settings.parallelToolCalls }" size="small"
|
||||||
|
@click="toggle">
|
||||||
|
<span class="iconfont icon-parallel"></span>
|
||||||
|
</div>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { inject } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import type { ChatStorage } from '../chat';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const tabStorage = inject('tabStorage') as ChatStorage;
|
||||||
|
|
||||||
|
const toggle = () => {
|
||||||
|
tabStorage.settings.parallelToolCalls = !tabStorage.settings.parallelToolCalls;
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
@ -5,7 +5,7 @@
|
|||||||
<ToolUse />
|
<ToolUse />
|
||||||
<Prompt />
|
<Prompt />
|
||||||
<Resource />
|
<Resource />
|
||||||
<Websearch />
|
<ParallelToolCalls />
|
||||||
<Temperature />
|
<Temperature />
|
||||||
<ContextLength />
|
<ContextLength />
|
||||||
</div>
|
</div>
|
||||||
@ -22,7 +22,7 @@ import SystemPrompt from './system-prompt.vue';
|
|||||||
import ToolUse from './tool-use.vue';
|
import ToolUse from './tool-use.vue';
|
||||||
import Prompt from './prompt.vue';
|
import Prompt from './prompt.vue';
|
||||||
import Resource from './resource.vue';
|
import Resource from './resource.vue';
|
||||||
import Websearch from './websearch.vue';
|
import ParallelToolCalls from './parallel-tool-calls.vue';
|
||||||
import Temperature from './temperature.vue';
|
import Temperature from './temperature.vue';
|
||||||
import ContextLength from './context-length.vue';
|
import ContextLength from './context-length.vue';
|
||||||
|
|
||||||
@ -57,9 +57,10 @@ if (!tabStorage.settings) {
|
|||||||
modelIndex: llmManager.currentModelIndex,
|
modelIndex: llmManager.currentModelIndex,
|
||||||
enableTools: [],
|
enableTools: [],
|
||||||
enableWebSearch: false,
|
enableWebSearch: false,
|
||||||
temperature: 0.7,
|
temperature: 0.6,
|
||||||
contextLength: 20,
|
contextLength: 20,
|
||||||
systemPrompt: ''
|
systemPrompt: '',
|
||||||
|
parallelToolCalls: true
|
||||||
} as ChatSetting;
|
} as ChatSetting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,9 +37,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, inject, onMounted } from 'vue';
|
import { ref, computed, inject, onMounted } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { allTools, type ChatStorage, getToolSchema } from '../chat';
|
import { type ChatStorage, type EnableToolItem, getToolSchema } from '../chat';
|
||||||
import { markdownToHtml } from '@/components/main-panel/chat/markdown/markdown';
|
import { markdownToHtml } from '@/components/main-panel/chat/markdown/markdown';
|
||||||
import { useMessageBridge } from '@/api/message-bridge';
|
import { mcpClientAdapter } from '@/views/connect/core';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
@ -51,8 +51,6 @@ const availableToolsNum = computed(() => {
|
|||||||
return tabStorage.settings.enableTools.filter(tool => tool.enabled).length;
|
return tabStorage.settings.enableTools.filter(tool => tool.enabled).length;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 修改 toggleTools 方法
|
// 修改 toggleTools 方法
|
||||||
const toggleTools = () => {
|
const toggleTools = () => {
|
||||||
showToolsDialog.value = true;
|
showToolsDialog.value = true;
|
||||||
@ -82,19 +80,31 @@ const disableAllTools = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const bridge = useMessageBridge();
|
// 将新的 tool 和并进入 tabStorage.settings.enableTools 中
|
||||||
const res = await bridge.commandRequest('tools/list');
|
// 只需要保证 enable 信息同步即可,其余工具默认开启
|
||||||
if (res.code === 200) {
|
const disableToolNames = new Set<string>(
|
||||||
allTools.value = res.msg.tools || [];
|
tabStorage.settings.enableTools
|
||||||
tabStorage.settings.enableTools = [];
|
.filter(tool => !tool.enabled)
|
||||||
for (const tool of allTools.value) {
|
.map(tool => tool.name)
|
||||||
tabStorage.settings.enableTools.push({
|
);
|
||||||
name: tool.name,
|
|
||||||
description: tool.description,
|
const newTools: EnableToolItem[] = [];
|
||||||
enabled: true
|
|
||||||
});
|
for (const client of mcpClientAdapter.clients) {
|
||||||
}
|
const tools = await client.getTools();
|
||||||
|
for (const tool of tools.values()) {
|
||||||
|
const enabled = !disableToolNames.has(tool.name);
|
||||||
|
|
||||||
|
newTools.push({
|
||||||
|
name: tool.name,
|
||||||
|
description: tool.description,
|
||||||
|
inputSchema: tool.inputSchema,
|
||||||
|
enabled
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tabStorage.settings.enableTools = newTools;
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type { ToolCallContent, ToolCallResponse } from "@/hook/type";
|
import type { ToolCallContent, ToolCallResponse } from "@/hook/type";
|
||||||
import { callTool } from "../../tool/tools";
|
|
||||||
import { MessageState, type ToolCall } from "../chat-box/chat";
|
import { MessageState, type ToolCall } from "../chat-box/chat";
|
||||||
|
import { mcpClientAdapter } from "@/views/connect/core";
|
||||||
|
|
||||||
export interface ToolCallResult {
|
export interface ToolCallResult {
|
||||||
state: MessageState;
|
state: MessageState;
|
||||||
@ -25,7 +25,7 @@ export async function handleToolCalls(toolCall: ToolCall): Promise<ToolCallResul
|
|||||||
const toolArgs = argsResult.value;
|
const toolArgs = argsResult.value;
|
||||||
|
|
||||||
// 进行调用,根据结果返回不同的值
|
// 进行调用,根据结果返回不同的值
|
||||||
const toolResponse = await callTool(toolName, toolArgs);
|
const toolResponse = await mcpClientAdapter.callTool(toolName, toolArgs);
|
||||||
return handleToolResponse(toolResponse);
|
return handleToolResponse(toolResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,8 +157,6 @@ export class TaskLoop {
|
|||||||
|
|
||||||
}, { once: true });
|
}, { once: true });
|
||||||
|
|
||||||
console.log(chatData);
|
|
||||||
|
|
||||||
this.bridge.postMessage({
|
this.bridge.postMessage({
|
||||||
command: 'llm/chat/completions',
|
command: 'llm/chat/completions',
|
||||||
data: JSON.parse(JSON.stringify(chatData)),
|
data: JSON.parse(JSON.stringify(chatData)),
|
||||||
@ -182,6 +180,7 @@ export class TaskLoop {
|
|||||||
const model = this.getLlmConfig().userModel;
|
const model = this.getLlmConfig().userModel;
|
||||||
const temperature = tabStorage.settings.temperature;
|
const temperature = tabStorage.settings.temperature;
|
||||||
const tools = getToolSchema(tabStorage.settings.enableTools);
|
const tools = getToolSchema(tabStorage.settings.enableTools);
|
||||||
|
const parallelToolCalls = tabStorage.settings.parallelToolCalls;
|
||||||
|
|
||||||
const userMessages = [];
|
const userMessages = [];
|
||||||
|
|
||||||
@ -210,6 +209,7 @@ export class TaskLoop {
|
|||||||
model,
|
model,
|
||||||
temperature,
|
temperature,
|
||||||
tools,
|
tools,
|
||||||
|
parallelToolCalls,
|
||||||
messages: userMessages,
|
messages: userMessages,
|
||||||
} as ChatCompletionCreateParamsBase;
|
} as ChatCompletionCreateParamsBase;
|
||||||
|
|
||||||
|
@ -84,10 +84,6 @@ function handleClick(prompt: PromptTemplate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
for (const client of mcpClientAdapter.clients) {
|
|
||||||
await client.getPromptTemplates();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tabStorage.currentPromptName === undefined) {
|
if (tabStorage.currentPromptName === undefined) {
|
||||||
const masterNode = mcpClientAdapter.masterNode;
|
const masterNode = mcpClientAdapter.masterNode;
|
||||||
const prompt = masterNode.promptTemplates?.values().next();
|
const prompt = masterNode.promptTemplates?.values().next();
|
||||||
|
@ -89,10 +89,6 @@ function handleClick(template: ResourceTemplate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
for (const client of mcpClientAdapter.clients) {
|
|
||||||
await client.getResourceTemplates({ cache: false });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tabStorage.currentResourceName === undefined && tabStorage.currentType === 'template') {
|
if (tabStorage.currentResourceName === undefined && tabStorage.currentType === 'template') {
|
||||||
const masterNode = mcpClientAdapter.masterNode;
|
const masterNode = mcpClientAdapter.masterNode;
|
||||||
const resourceTemplate = masterNode?.resourceTemplates?.values().next();
|
const resourceTemplate = masterNode?.resourceTemplates?.values().next();
|
||||||
|
@ -91,10 +91,6 @@ async function handleClick(resource: Resources) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
for (const client of mcpClientAdapter.clients) {
|
|
||||||
await client.getResources();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tabStorage.currentResourceName === undefined && tabStorage.currentType === 'resource') {
|
if (tabStorage.currentResourceName === undefined && tabStorage.currentType === 'resource') {
|
||||||
const masterNode = mcpClientAdapter.masterNode;
|
const masterNode = mcpClientAdapter.masterNode;
|
||||||
const resource = masterNode.resources?.values().next();
|
const resource = masterNode.resources?.values().next();
|
||||||
|
@ -65,10 +65,6 @@ function handleClick(tool: { name: string }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
for (const client of mcpClientAdapter.clients) {
|
|
||||||
await client.getTools();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tabStorage.currentToolName === undefined) {
|
if (tabStorage.currentToolName === undefined) {
|
||||||
const masterNode = mcpClientAdapter.masterNode;
|
const masterNode = mcpClientAdapter.masterNode;
|
||||||
const tool = masterNode.tools?.values().next();
|
const tool = masterNode.tools?.values().next();
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
import { useMessageBridge } from '@/api/message-bridge';
|
import type { ToolCallResponse } from '@/hook/type';
|
||||||
import { mcpSetting } from '@/hook/mcp';
|
|
||||||
import type { ToolsListResponse, ToolCallResponse, CasualRestAPI } from '@/hook/type';
|
|
||||||
import { mcpClientAdapter } from '@/views/connect/core';
|
|
||||||
|
|
||||||
export interface ToolStorage {
|
export interface ToolStorage {
|
||||||
activeNames: any[];
|
activeNames: any[];
|
||||||
@ -9,25 +6,3 @@ export interface ToolStorage {
|
|||||||
lastToolCallResponse?: ToolCallResponse | string;
|
lastToolCallResponse?: ToolCallResponse | string;
|
||||||
formData: Record<string, any>;
|
formData: Record<string, any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 根据工具名字和参数调取工具
|
|
||||||
* @param toolName
|
|
||||||
* @param toolArgs
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
export async function callTool(toolName: string, toolArgs: Record<string, any>) {
|
|
||||||
|
|
||||||
mcpClientAdapter
|
|
||||||
|
|
||||||
const bridge = useMessageBridge();
|
|
||||||
const { msg } = await bridge.commandRequest<ToolCallResponse>('tools/call', {
|
|
||||||
toolName,
|
|
||||||
toolArgs: JSON.parse(JSON.stringify(toolArgs)),
|
|
||||||
callToolOption: {
|
|
||||||
timeout: mcpSetting.timeout * 1000
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return msg;
|
|
||||||
}
|
|
@ -155,5 +155,6 @@
|
|||||||
"return": "عودة",
|
"return": "عودة",
|
||||||
"error": "خطأ",
|
"error": "خطأ",
|
||||||
"feedback": "تعليقات",
|
"feedback": "تعليقات",
|
||||||
"waiting-mcp-server": "في انتظار استجابة خادم MCP"
|
"waiting-mcp-server": "في انتظار استجابة خادم MCP",
|
||||||
|
"parallel-tool-calls": "السماح للنموذج باستدعاء أدوات متعددة في رد واحد"
|
||||||
}
|
}
|
@ -155,5 +155,6 @@
|
|||||||
"return": "Zurück",
|
"return": "Zurück",
|
||||||
"error": "Fehler",
|
"error": "Fehler",
|
||||||
"feedback": "Feedback",
|
"feedback": "Feedback",
|
||||||
"waiting-mcp-server": "Warten auf Antwort vom MCP-Server"
|
"waiting-mcp-server": "Warten auf Antwort vom MCP-Server",
|
||||||
|
"parallel-tool-calls": "Erlauben Sie dem Modell, mehrere Tools in einer einzigen Antwort aufzurufen"
|
||||||
}
|
}
|
@ -155,5 +155,6 @@
|
|||||||
"return": "Back",
|
"return": "Back",
|
||||||
"error": "Error",
|
"error": "Error",
|
||||||
"feedback": "Feedback",
|
"feedback": "Feedback",
|
||||||
"waiting-mcp-server": "Waiting for MCP server response"
|
"waiting-mcp-server": "Waiting for MCP server response",
|
||||||
|
"parallel-tool-calls": "Allow the model to call multiple tools in a single reply"
|
||||||
}
|
}
|
@ -155,5 +155,6 @@
|
|||||||
"return": "Retour",
|
"return": "Retour",
|
||||||
"error": "Erreur",
|
"error": "Erreur",
|
||||||
"feedback": "Retour",
|
"feedback": "Retour",
|
||||||
"waiting-mcp-server": "En attente de la réponse du serveur MCP"
|
"waiting-mcp-server": "En attente de la réponse du serveur MCP",
|
||||||
|
"parallel-tool-calls": "Permettre au modèle d'appeler plusieurs outils en une seule réponse"
|
||||||
}
|
}
|
@ -155,5 +155,6 @@
|
|||||||
"return": "戻る",
|
"return": "戻る",
|
||||||
"error": "エラー",
|
"error": "エラー",
|
||||||
"feedback": "フィードバック",
|
"feedback": "フィードバック",
|
||||||
"waiting-mcp-server": "MCPサーバーの応答を待機中"
|
"waiting-mcp-server": "MCPサーバーの応答を待機中",
|
||||||
|
"parallel-tool-calls": "モデルが単一の返信で複数のツールを呼び出すことを許可する"
|
||||||
}
|
}
|
@ -155,5 +155,6 @@
|
|||||||
"return": "돌아가기",
|
"return": "돌아가기",
|
||||||
"error": "오류",
|
"error": "오류",
|
||||||
"feedback": "피드백",
|
"feedback": "피드백",
|
||||||
"waiting-mcp-server": "MCP 서버 응답 대기 중"
|
"waiting-mcp-server": "MCP 서버 응답 대기 중",
|
||||||
|
"parallel-tool-calls": "모델이 단일 응답에서 여러 도구를 호출할 수 있도록 허용"
|
||||||
}
|
}
|
@ -155,5 +155,6 @@
|
|||||||
"return": "Назад",
|
"return": "Назад",
|
||||||
"error": "Ошибка",
|
"error": "Ошибка",
|
||||||
"feedback": "Обратная связь",
|
"feedback": "Обратная связь",
|
||||||
"waiting-mcp-server": "Ожидание ответа от сервера MCP"
|
"waiting-mcp-server": "Ожидание ответа от сервера MCP",
|
||||||
|
"parallel-tool-calls": "Разрешить модели вызывать несколько инструментов в одном ответе"
|
||||||
}
|
}
|
@ -155,5 +155,6 @@
|
|||||||
"return": "返回",
|
"return": "返回",
|
||||||
"error": "错误",
|
"error": "错误",
|
||||||
"feedback": "反馈",
|
"feedback": "反馈",
|
||||||
"waiting-mcp-server": "等待 MCP 服务器响应"
|
"waiting-mcp-server": "等待 MCP 服务器响应",
|
||||||
|
"parallel-tool-calls": "允许模型在单轮回复中调用多个工具"
|
||||||
}
|
}
|
@ -155,5 +155,6 @@
|
|||||||
"return": "返回",
|
"return": "返回",
|
||||||
"error": "錯誤",
|
"error": "錯誤",
|
||||||
"feedback": "反饋",
|
"feedback": "反饋",
|
||||||
"waiting-mcp-server": "等待MCP伺服器響應"
|
"waiting-mcp-server": "等待MCP伺服器響應",
|
||||||
|
"parallel-tool-calls": "允許模型在單輪回覆中調用多個工具"
|
||||||
}
|
}
|
@ -11,13 +11,13 @@
|
|||||||
<template #title>
|
<template #title>
|
||||||
<div class="tool-calls">
|
<div class="tool-calls">
|
||||||
<div class="tool-call-header">
|
<div class="tool-call-header">
|
||||||
<span>{{ log.message.split('\n')[0] }}</span>
|
<span>{{ log.title }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div class="logger-inner">
|
<div class="logger-inner">
|
||||||
{{ log.message }}
|
{{ log.message || '' }}
|
||||||
</div>
|
</div>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
</el-collapse>
|
</el-collapse>
|
||||||
@ -52,7 +52,7 @@ function clearLogs() {
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
.connection-option {
|
.connection-option {
|
||||||
height: 98%;
|
height: 90vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.connection-option .el-scrollbar__view {
|
.connection-option .el-scrollbar__view {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
<div class="connection-container">
|
<div class="connection-container">
|
||||||
<div class="connect-panel-container"
|
<div class="connect-panel-container left"
|
||||||
:ref="el => client.connectionSettingRef = el"
|
:ref="el => client.connectionSettingRef = el"
|
||||||
>
|
>
|
||||||
<ConnectionMethod :index="props.index" />
|
<ConnectionMethod :index="props.index" />
|
||||||
@ -17,7 +17,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="connect-panel-container"
|
<div class="connect-panel-container right"
|
||||||
:ref="el => client.connectionLogRef = el"
|
:ref="el => client.connectionLogRef = el"
|
||||||
>
|
>
|
||||||
<ConnectionLog :index="props.index" />
|
<ConnectionLog :index="props.index" />
|
||||||
@ -75,15 +75,26 @@ async function connect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.connect-panel-container {
|
.connect-panel-container.left {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 45%;
|
width: 45%;
|
||||||
max-height: 85vh;
|
max-height: 85vh;
|
||||||
min-width: 300px;
|
max-width: 500px;
|
||||||
|
min-width: 350px;
|
||||||
padding: 5px 20px;
|
padding: 5px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.connect-panel-container.right {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 55%;
|
||||||
|
max-height: 85vh;
|
||||||
|
min-width: 450px;
|
||||||
|
padding: 5px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.connection-option {
|
.connection-option {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
@ -22,6 +22,14 @@ export const connectionSelectDataViewOption: ConnectionTypeOptionItem[] = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
function prettifyMapKeys(keys: MapIterator<string>) {
|
||||||
|
const result: string[] = [];
|
||||||
|
for (const key of keys) {
|
||||||
|
result.push('+ ' +key);
|
||||||
|
}
|
||||||
|
return result.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export class McpClient {
|
export class McpClient {
|
||||||
// 连接入参
|
// 连接入参
|
||||||
@ -60,6 +68,7 @@ export class McpClient {
|
|||||||
// 连接出参
|
// 连接出参
|
||||||
this.connectionResult = {
|
this.connectionResult = {
|
||||||
success: false,
|
success: false,
|
||||||
|
reuseConntion: false,
|
||||||
status: 'disconnected',
|
status: 'disconnected',
|
||||||
clientId: '',
|
clientId: '',
|
||||||
name: '',
|
name: '',
|
||||||
@ -263,6 +272,7 @@ export class McpClient {
|
|||||||
const message = msg.toString();
|
const message = msg.toString();
|
||||||
this.connectionResult.logString.push({
|
this.connectionResult.logString.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
title: '连接失败',
|
||||||
message
|
message
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -271,14 +281,46 @@ export class McpClient {
|
|||||||
} else {
|
} else {
|
||||||
this.connectionResult.logString.push({
|
this.connectionResult.logString.push({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: msg.name + ' ' + msg.version + ' 连接成功'
|
title: msg.name + ' ' + msg.version + ' 连接成功',
|
||||||
|
message: JSON.stringify(msg, null, 2)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.connectionResult.reuseConntion = msg.reuseConntion;
|
||||||
this.connectionResult.status = msg.status;
|
this.connectionResult.status = msg.status;
|
||||||
this.connectionResult.clientId = msg.clientId;
|
this.connectionResult.clientId = msg.clientId;
|
||||||
this.connectionResult.name = msg.name;
|
this.connectionResult.name = msg.name;
|
||||||
this.connectionResult.version = msg.version;
|
this.connectionResult.version = msg.version;
|
||||||
|
|
||||||
|
// 刷新所有资源
|
||||||
|
const tools = await this.getTools({ cache: false });
|
||||||
|
this.connectionResult.logString.push({
|
||||||
|
type: 'info',
|
||||||
|
title: `${this.name}'s tools loaded (${tools.size})`,
|
||||||
|
message: prettifyMapKeys(tools.keys())
|
||||||
|
});
|
||||||
|
|
||||||
|
const prompts = await this.getPromptTemplates({ cache: false });
|
||||||
|
this.connectionResult.logString.push({
|
||||||
|
type: 'info',
|
||||||
|
title: `${this.name}'s prompts loaded (${prompts.size})`,
|
||||||
|
message: prettifyMapKeys(prompts.keys())
|
||||||
|
});
|
||||||
|
|
||||||
|
const resources = await this.getResources({ cache: false });
|
||||||
|
this.connectionResult.logString.push({
|
||||||
|
type: 'info',
|
||||||
|
title: `${this.name}'s resources loaded (${resources.size})`,
|
||||||
|
message: prettifyMapKeys(resources.keys())
|
||||||
|
});
|
||||||
|
|
||||||
|
const resourceTemplates = await this.getResourceTemplates({ cache: false });
|
||||||
|
this.connectionResult.logString.push({
|
||||||
|
type: 'info',
|
||||||
|
title: `${this.name}'s resourceTemplates loaded (${resourceTemplates.size})`,
|
||||||
|
message: prettifyMapKeys(resourceTemplates.keys())
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,14 +372,15 @@ export class McpClient {
|
|||||||
if (code === 200) {
|
if (code === 200) {
|
||||||
this.connectionResult.logString.push({
|
this.connectionResult.logString.push({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: '预设环境变量同步完成'
|
title: '预设环境变量同步完成'
|
||||||
});
|
});
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
} else {
|
} else {
|
||||||
this.connectionResult.logString.push({
|
this.connectionResult.logString.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: '预设环境变量同步失败: ' + msg
|
title: '预设环境变量同步失败',
|
||||||
|
message: msg.toString()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -403,9 +446,7 @@ class McpClientAdapter {
|
|||||||
this.connectLogListenerCancel = bridge.addCommandListener('connect/log', (message) => {
|
this.connectLogListenerCancel = bridge.addCommandListener('connect/log', (message) => {
|
||||||
const { code, msg } = message;
|
const { code, msg } = message;
|
||||||
|
|
||||||
console.log(code, msg);
|
|
||||||
const client = this.clients.at(-1);
|
const client = this.clients.at(-1);
|
||||||
console.log(client);
|
|
||||||
|
|
||||||
if (!client) {
|
if (!client) {
|
||||||
return;
|
return;
|
||||||
@ -413,7 +454,8 @@ class McpClientAdapter {
|
|||||||
|
|
||||||
client.connectionResult.logString.push({
|
client.connectionResult.logString.push({
|
||||||
type: code === 200 ? 'info': 'error',
|
type: code === 200 ? 'info': 'error',
|
||||||
message: msg
|
title: msg.title,
|
||||||
|
message: msg.message
|
||||||
});
|
});
|
||||||
|
|
||||||
}, { once: false });
|
}, { once: false });
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
<span v-if="scope.item.client.connectionResult.success"
|
<span v-if="scope.item.client.connectionResult.success"
|
||||||
class="success"
|
class="success"
|
||||||
>
|
>
|
||||||
<span class="name">{{ scope.item.client.connectionResult.name }}</span>
|
|
||||||
<span class="iconfont icon-dui"></span>
|
<span class="iconfont icon-dui"></span>
|
||||||
|
<span class="name">{{ scope.item.client.connectionResult.name }}</span>
|
||||||
</span>
|
</span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
<span class="server-name" style="margin-right: 60px;">
|
<span class="server-name" style="margin-right: 60px;">
|
||||||
@ -124,7 +124,7 @@ function deleteServer(index: number) {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
margin-right: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.server-item .success {
|
.server-item .success {
|
||||||
|
@ -8,15 +8,17 @@ export interface ConnectionTypeOptionItem {
|
|||||||
|
|
||||||
|
|
||||||
export interface IConnectionResult {
|
export interface IConnectionResult {
|
||||||
info?: string;
|
info?: string
|
||||||
success: boolean;
|
success: boolean
|
||||||
|
reuseConntion: boolean
|
||||||
status: string
|
status: string
|
||||||
clientId: string
|
clientId: string
|
||||||
name: string
|
name: string
|
||||||
version: string
|
version: string
|
||||||
logString: {
|
logString: {
|
||||||
type: 'info' | 'error' | 'warning',
|
type: 'info' | 'error' | 'warning',
|
||||||
message: string
|
title: string
|
||||||
|
message?: string
|
||||||
}[]
|
}[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,12 +31,13 @@ export async function makeSimpleTalk() {
|
|||||||
const chatStorage: ChatStorage = {
|
const chatStorage: ChatStorage = {
|
||||||
messages: [],
|
messages: [],
|
||||||
settings: {
|
settings: {
|
||||||
temperature: 0.7,
|
temperature: 0.6,
|
||||||
modelIndex: llmManager.currentModelIndex,
|
modelIndex: llmManager.currentModelIndex,
|
||||||
systemPrompt: '',
|
systemPrompt: '',
|
||||||
enableTools: [],
|
enableTools: [],
|
||||||
enableWebSearch: false,
|
enableWebSearch: false,
|
||||||
contextLength: 5
|
contextLength: 5,
|
||||||
|
parallelToolCalls: true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,6 +23,30 @@ export const llms = [
|
|||||||
userToken: '',
|
userToken: '',
|
||||||
userModel: 'gpt-4-turbo'
|
userModel: 'gpt-4-turbo'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'qwen',
|
||||||
|
name: '通义千问 Qwen',
|
||||||
|
baseUrl: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
|
||||||
|
models: ['qwen-max', 'qwen-plus', 'qwen-turbo', 'qwen-long', 'qwen-omni-turbo', 'qwen-omni-turbo-realtime'],
|
||||||
|
provider: 'Alibaba',
|
||||||
|
isOpenAICompatible: true,
|
||||||
|
description: '阿里巴巴通义千问',
|
||||||
|
website: 'https://help.aliyun.com/zh/model-studio/models#cfc131abafghw',
|
||||||
|
userToken: '',
|
||||||
|
userModel: 'qwen-plus'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'doubao',
|
||||||
|
name: '豆包 Seed',
|
||||||
|
baseUrl: 'https://ark.cn-beijing.volces.com/api/v3',
|
||||||
|
models: ['doubao-1.5-pro-32k', 'doubao-1.5-pro-256k', 'doubao-1.5-lite', 'deepseek-v3'],
|
||||||
|
provider: 'bytedance',
|
||||||
|
isOpenAICompatible: true,
|
||||||
|
description: '字节跳动豆包 Seed',
|
||||||
|
website: 'https://help.aliyun.com/zh/model-studio/models#cfc131abafghw',
|
||||||
|
userToken: '',
|
||||||
|
userModel: 'doubao-1.5-pro-32k'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'mistral',
|
id: 'mistral',
|
||||||
name: 'Mistral',
|
name: 'Mistral',
|
||||||
|
@ -8,17 +8,6 @@ export class LlmController {
|
|||||||
|
|
||||||
@Controller('llm/chat/completions')
|
@Controller('llm/chat/completions')
|
||||||
async chatCompletion(data: RequestData, webview: PostMessageble) {
|
async chatCompletion(data: RequestData, webview: PostMessageble) {
|
||||||
let { tools = [] } = data;
|
|
||||||
|
|
||||||
const client = getClient(data.clientId);
|
|
||||||
|
|
||||||
if (tools.length > 0 && !client) {
|
|
||||||
return {
|
|
||||||
code: 501,
|
|
||||||
msg:'mcp client 尚未连接'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await streamingChatCompletion(data, webview);
|
await streamingChatCompletion(data, webview);
|
||||||
|
@ -12,7 +12,15 @@ export async function streamingChatCompletion(
|
|||||||
data: any,
|
data: any,
|
||||||
webview: PostMessageble
|
webview: PostMessageble
|
||||||
) {
|
) {
|
||||||
let { baseURL, apiKey, model, messages, temperature, tools = [] } = data;
|
let {
|
||||||
|
baseURL,
|
||||||
|
apiKey,
|
||||||
|
model,
|
||||||
|
messages,
|
||||||
|
temperature,
|
||||||
|
tools = [],
|
||||||
|
parallelToolCalls = true
|
||||||
|
} = data;
|
||||||
|
|
||||||
const client = new OpenAI({
|
const client = new OpenAI({
|
||||||
baseURL,
|
baseURL,
|
||||||
@ -30,8 +38,7 @@ export async function streamingChatCompletion(
|
|||||||
messages,
|
messages,
|
||||||
temperature,
|
temperature,
|
||||||
tools,
|
tools,
|
||||||
tool_choice: 'auto',
|
parallel_tool_calls: parallelToolCalls,
|
||||||
web_search_options: {},
|
|
||||||
stream: true
|
stream: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -13,9 +13,15 @@ export class ConnectController {
|
|||||||
|
|
||||||
@Controller('lookup-env-var')
|
@Controller('lookup-env-var')
|
||||||
async lookupEnvVar(data: RequestData, webview: PostMessageble) {
|
async lookupEnvVar(data: RequestData, webview: PostMessageble) {
|
||||||
const client = getClient(data.clientId);
|
|
||||||
const { keys } = data;
|
const { keys } = data;
|
||||||
const values = keys.map((key: string) => process.env[key] || '');
|
const values = keys.map((key: string) => {
|
||||||
|
// TODO: 在 Windows 上测试
|
||||||
|
if (process.platform === 'win32' && key.toLowerCase() === 'path') {
|
||||||
|
key = 'Path'; // 确保正确匹配环境变量的 ke
|
||||||
|
}
|
||||||
|
|
||||||
|
return process.env[key] || '';
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
code: 200,
|
code: 200,
|
||||||
|
@ -56,10 +56,20 @@ function getCommandFileExt(option: McpOptions) {
|
|||||||
|
|
||||||
function collectAllOutputExec(command: string, cwd: string) {
|
function collectAllOutputExec(command: string, cwd: string) {
|
||||||
return new Promise<string>((resolve, reject) => {
|
return new Promise<string>((resolve, reject) => {
|
||||||
|
const handler = setTimeout(() => {
|
||||||
|
resolve('');
|
||||||
|
}, 5000);
|
||||||
|
|
||||||
exec(command, { cwd }, (error, stdout, stderr) => {
|
exec(command, { cwd }, (error, stdout, stderr) => {
|
||||||
const errorString = error || '';
|
const errorString = error || '';
|
||||||
const stdoutString = stdout || '';
|
const stdoutString = stdout || '';
|
||||||
const stderrString = stderr || '';
|
const stderrString = stderr || '';
|
||||||
|
|
||||||
|
console.log('[collectAllOutputExec]', errorString);
|
||||||
|
console.log('[collectAllOutputExec]', stdoutString);
|
||||||
|
console.log('[collectAllOutputExec]', stderrString);
|
||||||
|
|
||||||
|
clearTimeout(handler);
|
||||||
resolve(errorString + stdoutString + stderrString);
|
resolve(errorString + stdoutString + stderrString);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -140,7 +150,10 @@ async function initUv(option: McpOptions, cwd: string, webview?: PostMessageble)
|
|||||||
command: 'connect/log',
|
command: 'connect/log',
|
||||||
data: {
|
data: {
|
||||||
code: syncOutput.toLowerCase().startsWith('error') ? 501: 200,
|
code: syncOutput.toLowerCase().startsWith('error') ? 501: 200,
|
||||||
msg: syncOutput
|
msg: {
|
||||||
|
title: 'uv sync',
|
||||||
|
message: syncOutput
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -149,7 +162,10 @@ async function initUv(option: McpOptions, cwd: string, webview?: PostMessageble)
|
|||||||
command: 'connect/log',
|
command: 'connect/log',
|
||||||
data: {
|
data: {
|
||||||
code: addOutput.toLowerCase().startsWith('error') ? 501: 200,
|
code: addOutput.toLowerCase().startsWith('error') ? 501: 200,
|
||||||
msg: addOutput
|
msg: {
|
||||||
|
title: 'uv add mcp "mcp[cli]"',
|
||||||
|
message: addOutput
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -175,7 +191,10 @@ async function initNpm(option: McpOptions, cwd: string, webview?: PostMessageble
|
|||||||
command: 'connect/log',
|
command: 'connect/log',
|
||||||
data: {
|
data: {
|
||||||
code: installOutput.toLowerCase().startsWith('error')? 200: 501,
|
code: installOutput.toLowerCase().startsWith('error')? 200: 501,
|
||||||
msg: installOutput
|
msg: {
|
||||||
|
title: 'npm i',
|
||||||
|
message: installOutput
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -212,6 +231,7 @@ export async function connectService(
|
|||||||
// 通过 option 字符串进行 hash,得到唯一的 uuid
|
// 通过 option 字符串进行 hash,得到唯一的 uuid
|
||||||
const uuid = await deterministicUUID(JSON.stringify(option));
|
const uuid = await deterministicUUID(JSON.stringify(option));
|
||||||
|
|
||||||
|
const reuseConntion = clientMap.has(uuid);
|
||||||
if (!clientMap.has(uuid)) {
|
if (!clientMap.has(uuid)) {
|
||||||
const client = await connect(option);
|
const client = await connect(option);
|
||||||
clientMap.set(uuid, client);
|
clientMap.set(uuid, client);
|
||||||
@ -226,6 +246,7 @@ export async function connectService(
|
|||||||
msg: {
|
msg: {
|
||||||
status: 'success',
|
status: 'success',
|
||||||
clientId: uuid,
|
clientId: uuid,
|
||||||
|
reuseConntion,
|
||||||
name: versionInfo?.name,
|
name: versionInfo?.name,
|
||||||
version: versionInfo?.version
|
version: versionInfo?.version
|
||||||
}
|
}
|
||||||
@ -234,7 +255,7 @@ export async function connectService(
|
|||||||
return connectResult;
|
return connectResult;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
console.log(error);
|
console.log('[connectService catch error]', error);
|
||||||
|
|
||||||
// TODO: 这边获取到的 error 不够精致,如何才能获取到更加精准的错误
|
// TODO: 这边获取到的 error 不够精致,如何才能获取到更加精准的错误
|
||||||
// 比如 error: Failed to spawn: `server.py`
|
// 比如 error: Failed to spawn: `server.py`
|
||||||
@ -243,7 +264,10 @@ export async function connectService(
|
|||||||
let errorMsg = '';
|
let errorMsg = '';
|
||||||
|
|
||||||
if (option.command) {
|
if (option.command) {
|
||||||
errorMsg += tryGetRunCommandError(option.command, option.args, option.cwd);
|
errorMsg += await collectAllOutputExec(
|
||||||
|
option.command + ' ' + (option.args || []).join(' '),
|
||||||
|
option.cwd || process.cwd()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
errorMsg += (error as any).toString();
|
errorMsg += (error as any).toString();
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user