mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-08 06:57:33 +08:00
feat: Send MCP response as a user
This commit is contained in:
11
app/mcp/utils.ts
Normal file
11
app/mcp/utils.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export function isMcpJson(content: string) {
|
||||
return content.match(/```json:mcp:(\w+)([\s\S]*?)```/);
|
||||
}
|
||||
|
||||
export function extractMcpJson(content: string) {
|
||||
const match = content.match(/```json:mcp:(\w+)([\s\S]*?)```/);
|
||||
if (match) {
|
||||
return { clientId: match[1], mcp: JSON.parse(match[2]) };
|
||||
}
|
||||
return null;
|
||||
}
|
Reference in New Issue
Block a user