feat(mcp): add registryUrl to initialState for improved package manag… (#4279)
* feat(mcp): add registryUrl to initialState for improved package management * feat(mcp): initialize registryUrl in MCP server state for future enhancements * fix(inputbar):mcp server list * refactor(Inputbar): remove unused MCP server variable and console log for cleaner code * fix(Inputbar): 还原 * fix(Inputbar): Add activedMcpServers to Inputbar component props
This commit is contained in:
parent
06c730aaf6
commit
23de48ecbd
@ -180,15 +180,11 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
|
||||
if (mentionModels) {
|
||||
userMessage.mentions = mentionModels
|
||||
}
|
||||
|
||||
if (isFunctionCallingModel(model)) {
|
||||
if (!isEmpty(enabledMCPs) && !isEmpty(activedMcpServers)) {
|
||||
userMessage.enabledMCPs = activedMcpServers.filter((server) =>
|
||||
enabledMCPs?.some((s) => s.id === server.id)
|
||||
)
|
||||
userMessage.enabledMCPs = activedMcpServers.filter((server) => enabledMCPs?.some((s) => s.id === server.id))
|
||||
}
|
||||
}
|
||||
|
||||
userMessage.usage = await estimateMessageUsage(userMessage)
|
||||
currentMessageId.current = userMessage.id
|
||||
|
||||
@ -208,7 +204,6 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
|
||||
console.error('Failed to send message:', error)
|
||||
}
|
||||
}, [
|
||||
activedMcpServers,
|
||||
assistant,
|
||||
dispatch,
|
||||
files,
|
||||
@ -219,7 +214,9 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
|
||||
resizeTextArea,
|
||||
selectedKnowledgeBases,
|
||||
text,
|
||||
topic
|
||||
topic,
|
||||
enabledMCPs,
|
||||
activedMcpServers
|
||||
])
|
||||
|
||||
const translate = async () => {
|
||||
|
||||
@ -11,6 +11,7 @@ const initialState: MCPConfig = {
|
||||
baseUrl: '',
|
||||
command: 'npx',
|
||||
args: ['-y', '@mcpmarket/mcp-auto-install', 'connect', '--json'],
|
||||
registryUrl: 'https://registry.npmmirror.com',
|
||||
env: {},
|
||||
isActive: false
|
||||
}
|
||||
|
||||
@ -245,6 +245,7 @@ export async function callMCPTool(tool: MCPTool): Promise<any> {
|
||||
command: resp.data.command,
|
||||
args: resp.data.args,
|
||||
env: resp.data.env,
|
||||
registryUrl: '',
|
||||
isActive: false
|
||||
}
|
||||
store.dispatch(addMCPServer(mcpServer))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user