fix(ai): enable all tools for default assistants

This commit is contained in:
digua committed 2026-07-17 10:29:59 +08:00
1 parent 79e2027b43
commit e6059ffd75
3 files changed
+31 -3

No files matched your search

@@ -323,9 +323,9 @@ presetQuestions:
it('uses the stored digest to upgrade an untouched tracked assistant', () => {
manager.init()
const nextBuiltin = SAMPLE_BUILTIN.replace('你是一个通用助手。', '新版内置提示词。').replace(
const nextBuiltin = SAMPLE_BUILTIN.replace(
'name: 通用助手',
'name: 通用助手\nbuiltinVersion: 2'
'name: 通用助手\nbuiltinVersion: 2\nallowedBuiltinTools:\n - keyword_frequency\n - execute_sql'
)
const next = createManager({
fs: memFs,
@@ -335,7 +335,10 @@ presetQuestions:
const result = next.manager.init()
assert.equal(result.generalUpdated, true)
assert.equal(next.manager.getAssistantConfig('general_cn')!.systemPrompt, '新版内置提示词。')
assert.deepEqual(next.manager.getAssistantConfig('general_cn')!.allowedBuiltinTools, [
'keyword_frequency',
'execute_sql',
])
assert.equal(next.manager.getAssistantConfig('general_cn')!.builtinVersion, 2)
})
@@ -0,0 +1,16 @@
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import { BUILTIN_TOOL_CATALOG } from '@openchatlab/core'
import { DEFAULT_GENERAL_ASSISTANT_CONFIGS } from '../default-assistants'
describe('default general assistants', () => {
it('enable every analysis tool by default', () => {
const analysisToolNames = BUILTIN_TOOL_CATALOG.filter((tool) => tool.category === 'analysis')
.map((tool) => tool.name)
.sort()
for (const config of DEFAULT_GENERAL_ASSISTANT_CONFIGS) {
assert.deepEqual([...(config.allowedBuiltinTools ?? [])].sort(), analysisToolNames, config.id)
}
})
})
@@ -1,6 +1,11 @@
import type { AssistantConfig } from '@openchatlab/shared-types'
import { BUILTIN_TOOL_CATALOG } from '@openchatlab/core'
import { serializeAssistant } from './assistant-parser'
const ALL_ANALYSIS_TOOL_NAMES = BUILTIN_TOOL_CATALOG.filter((tool) => tool.category === 'analysis').map(
(tool) => tool.name
)
/** Canonical built-in assistant templates shared by Desktop, CLI and CLI Web. */
export const DEFAULT_GENERAL_ASSISTANT_CONFIGS: readonly AssistantConfig[] = [
{
@@ -8,6 +13,7 @@ export const DEFAULT_GENERAL_ASSISTANT_CONFIGS: readonly AssistantConfig[] = [
name: '通用分析助手',
builtinVersion: 2,
supportedLocales: ['zh-CN'],
allowedBuiltinTools: [...ALL_ANALYSIS_TOOL_NAMES],
presetQuestions: [
'最近都在聊什么?',
'谁是最活跃的人?',
@@ -36,6 +42,7 @@ export const DEFAULT_GENERAL_ASSISTANT_CONFIGS: readonly AssistantConfig[] = [
name: '通用分析助手',
builtinVersion: 2,
supportedLocales: ['zh-TW'],
allowedBuiltinTools: [...ALL_ANALYSIS_TOOL_NAMES],
presetQuestions: [
'最近都在聊什麼?',
'誰是最活躍的人?',
@@ -64,6 +71,7 @@ export const DEFAULT_GENERAL_ASSISTANT_CONFIGS: readonly AssistantConfig[] = [
name: 'General Analysis Assistant',
builtinVersion: 2,
supportedLocales: ['en'],
allowedBuiltinTools: [...ALL_ANALYSIS_TOOL_NAMES],
presetQuestions: [
'What have people been chatting about recently?',
'Who are the most active members?',
@@ -91,6 +99,7 @@ export const DEFAULT_GENERAL_ASSISTANT_CONFIGS: readonly AssistantConfig[] = [
name: '汎用分析アシスタント',
builtinVersion: 2,
supportedLocales: ['ja'],
allowedBuiltinTools: [...ALL_ANALYSIS_TOOL_NAMES],
presetQuestions: [
'最近みんな何を話してる?',
'一番アクティブなメンバーは誰?',