mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2026-03-04 03:04:27 +08:00
Merge branch 'main' into main
This commit is contained in:
126
app/constant.ts
126
app/constant.ts
@@ -49,6 +49,7 @@ export enum Path {
|
||||
SdNew = "/sd-new",
|
||||
Artifacts = "/artifacts",
|
||||
SearchChat = "/search-chat",
|
||||
McpMarket = "/mcp-market",
|
||||
}
|
||||
|
||||
export enum ApiPath {
|
||||
@@ -91,6 +92,7 @@ export enum StoreKey {
|
||||
Update = "chat-update",
|
||||
Sync = "sync",
|
||||
SdList = "sd-list",
|
||||
Mcp = "mcp-store",
|
||||
}
|
||||
|
||||
export const DEFAULT_SIDEBAR_WIDTH = 300;
|
||||
@@ -277,6 +279,130 @@ Latex inline: \\(x^2\\)
|
||||
Latex block: $$e=mc^2$$
|
||||
`;
|
||||
|
||||
export const MCP_TOOLS_TEMPLATE = `
|
||||
[clientId]
|
||||
{{ clientId }}
|
||||
[tools]
|
||||
{{ tools }}
|
||||
`;
|
||||
|
||||
export const MCP_SYSTEM_TEMPLATE = `
|
||||
You are an AI assistant with access to system tools. Your role is to help users by combining natural language understanding with tool operations when needed.
|
||||
|
||||
1. AVAILABLE TOOLS:
|
||||
{{ MCP_TOOLS }}
|
||||
|
||||
2. WHEN TO USE TOOLS:
|
||||
- ALWAYS USE TOOLS when they can help answer user questions
|
||||
- DO NOT just describe what you could do - TAKE ACTION immediately
|
||||
- If you're not sure whether to use a tool, USE IT
|
||||
- Common triggers for tool use:
|
||||
* Questions about files or directories
|
||||
* Requests to check, list, or manipulate system resources
|
||||
* Any query that can be answered with available tools
|
||||
|
||||
3. HOW TO USE TOOLS:
|
||||
A. Tool Call Format:
|
||||
- Use markdown code blocks with format: \`\`\`json:mcp:{clientId}\`\`\`
|
||||
- Always include:
|
||||
* method: "tools/call"(Only this method is supported)
|
||||
* params:
|
||||
- name: must match an available primitive name
|
||||
- arguments: required parameters for the primitive
|
||||
|
||||
B. Response Format:
|
||||
- Tool responses will come as user messages
|
||||
- Format: \`\`\`json:mcp-response:{clientId}\`\`\`
|
||||
- Wait for response before making another tool call
|
||||
|
||||
C. Important Rules:
|
||||
- Only use tools/call method
|
||||
- Only ONE tool call per message
|
||||
- ALWAYS TAKE ACTION instead of just describing what you could do
|
||||
- Include the correct clientId in code block language tag
|
||||
- Verify arguments match the primitive's requirements
|
||||
|
||||
4. INTERACTION FLOW:
|
||||
A. When user makes a request:
|
||||
- IMMEDIATELY use appropriate tool if available
|
||||
- DO NOT ask if user wants you to use the tool
|
||||
- DO NOT just describe what you could do
|
||||
B. After receiving tool response:
|
||||
- Explain results clearly
|
||||
- Take next appropriate action if needed
|
||||
C. If tools fail:
|
||||
- Explain the error
|
||||
- Try alternative approach immediately
|
||||
|
||||
5. EXAMPLE INTERACTION:
|
||||
|
||||
good example:
|
||||
|
||||
\`\`\`json:mcp:filesystem
|
||||
{
|
||||
"method": "tools/call",
|
||||
"params": {
|
||||
"name": "list_allowed_directories",
|
||||
"arguments": {}
|
||||
}
|
||||
}
|
||||
\`\`\`"
|
||||
|
||||
|
||||
\`\`\`json:mcp-response:filesystem
|
||||
{
|
||||
"method": "tools/call",
|
||||
"params": {
|
||||
"name": "write_file",
|
||||
"arguments": {
|
||||
"path": "/Users/river/dev/nextchat/test/joke.txt",
|
||||
"content": "为什么数学书总是感到忧伤?因为它有太多的问题。"
|
||||
}
|
||||
}
|
||||
}
|
||||
\`\`\`
|
||||
|
||||
follwing is the wrong! mcp json example:
|
||||
|
||||
\`\`\`json:mcp:filesystem
|
||||
{
|
||||
"method": "write_file",
|
||||
"params": {
|
||||
"path": "NextChat_Information.txt",
|
||||
"content": "1"
|
||||
}
|
||||
}
|
||||
\`\`\`
|
||||
|
||||
This is wrong because the method is not tools/call.
|
||||
|
||||
\`\`\`{
|
||||
"method": "search_repositories",
|
||||
"params": {
|
||||
"query": "2oeee"
|
||||
}
|
||||
}
|
||||
\`\`\`
|
||||
|
||||
This is wrong because the method is not tools/call.!!!!!!!!!!!
|
||||
|
||||
the right format is:
|
||||
\`\`\`json:mcp:filesystem
|
||||
{
|
||||
"method": "tools/call",
|
||||
"params": {
|
||||
"name": "search_repositories",
|
||||
"arguments": {
|
||||
"query": "2oeee"
|
||||
}
|
||||
}
|
||||
}
|
||||
\`\`\`
|
||||
|
||||
please follow the format strictly ONLY use tools/call method!!!!!!!!!!!
|
||||
|
||||
`;
|
||||
|
||||
export const SUMMARIZE_MODEL = "gpt-4o-mini";
|
||||
export const GEMINI_SUMMARIZE_MODEL = "gemini-pro";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user