feat: Send MCP response as a user

This commit is contained in:
Kadxy
2024-12-29 08:29:02 +08:00
parent 664879b9df
commit e1ba8f1b0f
2 changed files with 42 additions and 21 deletions

11
app/mcp/utils.ts Normal file
View 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;
}