Compare commits

..

4 Commits

Author SHA1 Message Date
gaoziman
5ad191684a refactor(前端): 移除 useSettings 中的 code_execution 默认配置
- 从前端默认设置中移除 code_execution 工具
2025-12-22 00:21:33 +08:00
gaoziman
1c28484091 refactor(聊天): 移除 code_execution 工具完整实现
- 移除系统提示词中的代码执行相关说明
- 移除图表绘制规范说明
- 移除 Claude/OpenAI/Codex 格式的 code_execution 工具定义
2025-12-22 00:21:23 +08:00
gaoziman
d581b8668a refactor(API): 移除 code_execution 工具相关配置
- 用户注册时默认工具列表移除 code_execution
- 设置接口默认工具列表移除 code_execution
- 工具列表接口过滤掉 code_execution 工具
2025-12-22 00:21:13 +08:00
gaoziman
65028e37ed refactor(数据库): 移除 code_execution 工具配置
- 从 userSettings 表的 defaultTools 默认值中移除 code_execution
- 从种子数据中移除 code_execution 工具定义
- 调整 web_fetch 工具的排序值
2025-12-22 00:21:02 +08:00
7 changed files with 10 additions and 93 deletions

View File

@ -129,7 +129,7 @@ export async function POST(request: NextRequest) {
cchApiKey: null,
cchApiKeyConfigured: false,
defaultModel: 'claude-sonnet-4-5-20250929',
defaultTools: ['web_search', 'code_execution', 'web_fetch'],
defaultTools: ['web_search', 'web_fetch'],
theme: 'light',
language: 'zh-CN',
fontSize: 15,

View File

@ -122,7 +122,6 @@ const DEFAULT_SYSTEM_PROMPT = `你是一个专业、友好的 AI 助手。请遵
## 使
- 使 web_search
- 使 code_execution
- 使 web_fetch
- ****
@ -133,21 +132,12 @@ const DEFAULT_SYSTEM_PROMPT = `你是一个专业、友好的 AI 助手。请遵
3. ****
- "今天北京天气晴朗气温15°C。来源weather.com"
-
4. ****
##
-
-
-
##
使 code_execution
1. **** code_execution
2. ****
3. **使** seaborn-whitegrid plt.style.use()
4. ****Noto Sans SC使
5. ****使使(subplot)
##
/****
@ -1643,24 +1633,6 @@ function buildClaudeToolDefinitions(toolIds: string[]) {
required: ['query'],
},
},
code_execution: {
name: 'code_execution',
description: '执行代码并返回结果。支持 Python、JavaScript、TypeScript、Java、C、C++、Go、Rust 等多种语言。当需要验证代码、进行计算或演示代码运行结果时,请使用此工具。',
input_schema: {
type: 'object',
properties: {
code: {
type: 'string',
description: '要执行的代码',
},
language: {
type: 'string',
description: '编程语言 (python, javascript, typescript, java, c, cpp, go, rust, ruby, php 等)',
},
},
required: ['code', 'language'],
},
},
web_fetch: {
name: 'web_fetch',
description: '获取指定 URL 的网页内容。当用户提供了具体的网址并想了解该页面的内容时,请使用此工具。',
@ -1702,27 +1674,6 @@ function buildOpenAIToolDefinitions(toolIds: string[]) {
},
},
},
code_execution: {
type: 'function',
function: {
name: 'code_execution',
description: '执行代码并返回结果。支持 Python、JavaScript、TypeScript、Java、C、C++、Go、Rust 等多种语言。当需要验证代码、进行计算或演示代码运行结果时,请使用此工具。',
parameters: {
type: 'object',
properties: {
code: {
type: 'string',
description: '要执行的代码',
},
language: {
type: 'string',
description: '编程语言 (python, javascript, typescript, java, c, cpp, go, rust, ruby, php 等)',
},
},
required: ['code', 'language'],
},
},
},
web_fetch: {
type: 'function',
function: {
@ -1765,25 +1716,6 @@ function buildCodexToolDefinitions(toolIds: string[]) {
required: ['query'],
},
},
code_execution: {
type: 'function',
name: 'code_execution',
description: '执行代码并返回结果。支持 Python、JavaScript、TypeScript、Java、C、C++、Go、Rust 等多种语言。当需要验证代码、进行计算或演示代码运行结果时,请使用此工具。',
parameters: {
type: 'object',
properties: {
code: {
type: 'string',
description: '要执行的代码',
},
language: {
type: 'string',
description: '编程语言 (python, javascript, typescript, java, c, cpp, go, rust, ruby, php 等)',
},
},
required: ['code', 'language'],
},
},
web_fetch: {
type: 'function',
name: 'web_fetch',

View File

@ -11,7 +11,7 @@ const DEFAULT_SETTINGS = {
cchApiKeyConfigured: false,
apiFormat: 'claude' as 'claude' | 'openai', // API 格式claude原生| openai兼容
defaultModel: 'claude-sonnet-4-5-20250929',
defaultTools: ['web_search', 'code_execution', 'web_fetch'],
defaultTools: ['web_search', 'web_fetch'],
systemPrompt: '',
temperature: '0.7',
theme: 'light',

View File

@ -11,7 +11,10 @@ export async function GET() {
orderBy: [asc(tools.sortOrder)],
});
return NextResponse.json(toolList);
// 过滤掉 code_execution 工具
const filteredTools = toolList.filter(tool => tool.toolId !== 'code_execution');
return NextResponse.json(filteredTools);
} catch (error) {
console.error('Failed to get tools:', error);
return NextResponse.json(

View File

@ -67,7 +67,7 @@ export const userSettings = pgTable('user_settings', {
apiFormat: varchar('api_format', { length: 20 }).default('claude'),
// 默认设置
defaultModel: varchar('default_model', { length: 64 }).default('claude-sonnet-4-5-20250929'),
defaultTools: jsonb('default_tools').$type<string[]>().default(['web_search', 'code_execution', 'web_fetch']),
defaultTools: jsonb('default_tools').$type<string[]>().default(['web_search', 'web_fetch']),
// AI 行为设置
systemPrompt: text('system_prompt'), // 系统提示词
temperature: varchar('temperature', { length: 10 }).default('0.7'), // 温度参数 (0-1)

View File

@ -14,7 +14,7 @@ async function seedUserSettings() {
cchUrl: 'http://localhost:13500',
cchApiKeyConfigured: false,
defaultModel: 'claude-sonnet-4-5-20250929',
defaultTools: ['web_search', 'code_execution', 'web_fetch'],
defaultTools: ['web_search', 'web_fetch'],
theme: 'light',
language: 'zh-CN',
enableThinking: false,
@ -46,24 +46,6 @@ async function seedTools() {
isDefault: true,
sortOrder: 1,
},
{
toolId: 'code_execution',
name: 'code_execution',
displayName: 'Code Execution',
description: '执行代码片段并返回结果',
icon: 'Terminal',
inputSchema: {
type: 'object',
properties: {
code: { type: 'string', description: '要执行的代码' },
language: { type: 'string', description: '编程语言' },
},
required: ['code', 'language'],
},
isEnabled: true,
isDefault: true,
sortOrder: 2,
},
{
toolId: 'web_fetch',
name: 'web_fetch',
@ -79,7 +61,7 @@ async function seedTools() {
},
isEnabled: true,
isDefault: true,
sortOrder: 3,
sortOrder: 2,
},
];

View File

@ -53,7 +53,7 @@ const defaultSettings: Settings = {
cchApiKeyConfigured: false,
apiFormat: 'claude',
defaultModel: 'claude-sonnet-4-5-20250929',
defaultTools: ['web_search', 'code_execution', 'web_fetch'],
defaultTools: ['web_search', 'web_fetch'],
systemPrompt: '',
temperature: '0.7',
theme: 'light',