Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(settings): file & knowledge-base embedding model in Service Model (#23256)

Lobehub Coder86ce14aedb94
diff --git a/apps/server/src/globalConfig/getServerGlobalConfig.test.ts b/apps/server/src/globalConfig/getServerGlobalConfig.test.ts
index 17b9d3daa7c..e145e1723c3 100644
--- a/apps/server/src/globalConfig/getServerGlobalConfig.test.ts
+++ b/apps/server/src/globalConfig/getServerGlobalConfig.test.ts
@@ -22,6 +22,7 @@ interface MockGlobalConfigOptions {
enableAgentGateway?: boolean;
enablePageCollab?: boolean;
enableWorkspacePageCollab?: boolean;
+ filesConfigEnv?: string;
toolNameMaxLengthEnv?: string;
}
@@ -81,7 +82,7 @@ const mockGlobalConfigDependencies = (
vi.doMock('@/envs/knowledge', () => ({
knowledgeEnv: {
- DEFAULT_FILES_CONFIG: undefined,
+ DEFAULT_FILES_CONFIG: options.filesConfigEnv,
},
}));
@@ -116,7 +117,10 @@ const mockGlobalConfigDependencies = (
}));
vi.doMock('./parseFilesConfig', () => ({
- parseFilesConfig: vi.fn(() => ({})),
+ parseFilesConfig: vi.fn((envString?: string) => {
+ if (envString === 'invalid') throw new Error('Invalid environment variable format.');
+ return envString ? { embeddingModel: { model: envString, provider: 'ollama' } } : {};
+ }),
}));
vi.doMock('./parseMemoryExtractionConfig', () => ({
@@ -314,6 +318,18 @@ describe('getServerGlobalConfig', () => {
expect(config.deviceGatewayUrl).toBeUndefined();
});
+ it('should show the DEFAULT_FILES_CONFIG embedding model as the file embedding default', async () => {
+ const config = await loadServerConfig(false, { filesConfigEnv: 'bge-m3' });
+
+ expect(config.systemAgent?.fileEmbedding).toEqual({ model: 'bge-m3', provider: 'ollama' });
+ });
+
+ it('should not fail the client config on an invalid DEFAULT_FILES_CONFIG', async () => {
+ const config = await loadServerConfig(false, { filesConfigEnv: 'invalid' });
+
+ expect(config.systemAgent?.fileEmbedding).toBeUndefined();
+ });
+
it('should omit the OIDC issuer when APP_URL is not configured', async () => {
await expect(loadServerConfig(false)).resolves.not.toHaveProperty('oidcIssuer');
});
diff --git a/apps/server/src/globalConfig/index.ts b/apps/server/src/globalConfig/index.ts
index d3b018d3837..d012f7d9337 100644
--- a/apps/server/src/globalConfig/index.ts
+++ b/apps/server/src/globalConfig/index.ts
@@ -151,6 +151,19 @@ export const getServerAiProviderConfig = async (provider: ModelProvider) => {
};
};
+/**
+ * The model an unset file embedding slot runs, for Service Model to show. An
+ * invalid `DEFAULT_FILES_CONFIG` still fails where embedding runs, as before;
+ * it must not take the whole client config down with it.
+ */
+const getDeploymentFileEmbeddingModel = () => {
+ try {
+ return parseFilesConfig(knowledgeEnv.DEFAULT_FILES_CONFIG).embeddingModel;
+ } catch {
+ return undefined;
+ }
+};
+
export const getServerGlobalConfig = async () => {
const { DEFAULT_AGENT_CONFIG } = getAppConfig();
@@ -219,7 +232,10 @@ export const getServerGlobalConfig = async () => {
// Same derivation as the provider's own issuer (`libs/oidc-provider/provider.ts`).
...(appEnv.APP_URL ? { oidcIssuer: urlJoin(appEnv.APP_URL, OIDC_ISSUER_PATH) } : undefined),
sandbox: getSandboxDeployment(),
- systemAgent: parseSystemAgent(appEnv.SYSTEM_AGENT),
+ systemAgent: {
+ ...parseSystemAgent(appEnv.SYSTEM_AGENT),
+ fileEmbedding: getDeploymentFileEmbeddingModel(),
+ },
telemetry: {
langfuse: langfuseEnv.ENABLE_LANGFUSE,
},
diff --git a/apps/server/src/globalConfig/parseSystemAgent.test.ts b/apps/server/src/globalConfig/parseSystemAgent.test.ts
index 4acced74eea..0a9d75d3e0d 100644
--- a/apps/server/src/globalConfig/parseSystemAgent.test.ts
+++ b/apps/server/src/globalConfig/parseSystemAgent.test.ts
@@ -184,4 +184,12 @@ describe('parseSystemAgent', () => {
expect(result.asr).toEqual({ provider: 'lobehub', model: 'gpt-4o-mini-transcribe' });
});
+
+ it('leaves the file embedding slot to DEFAULT_FILES_CONFIG', () => {
+ const result = parseSystemAgent('default=ollama/deepseek-v3,fileEmbedding=openai/text-embed');
+
+ // `default=` names a chat model, and an explicit entry would be a second
+ // knob next to `DEFAULT_FILES_CONFIG` that file indexing never reads.
+ expect(result.fileEmbedding).toBeUndefined();
+ });
});
diff --git a/apps/server/src/globalConfig/parseSystemAgent.ts b/apps/server/src/globalConfig/parseSystemAgent.ts
index a20b8b00eb4..c3343b484e9 100644
--- a/apps/server/src/globalConfig/parseSystemAgent.ts
+++ b/apps/server/src/globalConfig/parseSystemAgent.ts
@@ -1,7 +1,12 @@
import { DEFAULT_SYSTEM_AGENT_CONFIG } from '@/const/settings';
import { type UserServiceModelConfig } from '@/types/user/settings';
-const protectedKeys = Object.keys(DEFAULT_SYSTEM_AGENT_CONFIG);
+// `DEFAULT_FILES_CONFIG` owns the deployment default of the file embedding
+// slot; a second knob here could disagree with what file indexing runs.
+const otherEnvKeys = new Set(['fileEmbedding']);
+const protectedKeys = Object.keys(DEFAULT_SYSTEM_AGENT_CONFIG).filter(
+ (key) => !otherEnvKeys.has(key),
+);
const defaultTrueLey = new Set(['promptRewrite', 'autoSuggestion']);
const memoryServiceModelKeys = new Set([
diff --git a/apps/server/src/routers/async/__tests__/file.embeddingChunks.test.ts b/apps/server/src/routers/async/__tests__/file.embeddingChunks.test.ts
index cd5d2437ec2..8e1ef0e1c96 100644
--- a/apps/server/src/routers/async/__tests__/file.embeddingChunks.test.ts
+++ b/apps/server/src/routers/async/__tests__/file.embeddingChunks.test.ts
@@ -6,6 +6,7 @@ import { ChunkModel } from '@/database/models/chunk';
import { EmbeddingModel } from '@/database/models/embedding';
import { FileModel } from '@/database/models/file';
import { initModelRuntimeFromDB } from '@/server/modules/ModelRuntime';
+import { resolveFileEmbeddingModel } from '@/server/services/knowledgeBase/fileEmbeddingModel';
import { AsyncTaskErrorType, AsyncTaskStatus } from '@/types/asyncTask';
import { fileRouter } from '../file';
@@ -20,6 +21,9 @@ vi.mock('@/server/services/chunk', () => ({ ChunkService: vi.fn() }));
vi.mock('@/server/services/document', () => ({ DocumentService: vi.fn() }));
vi.mock('@/server/services/file', () => ({ FileService: vi.fn() }));
vi.mock('@/server/modules/ModelRuntime', () => ({ initModelRuntimeFromDB: vi.fn() }));
+vi.mock('@/server/services/knowledgeBase/fileEmbeddingModel', () => ({
+ resolveFileEmbeddingModel: vi.fn(),
+}));
vi.mock('@/business/server/trpc-middlewares/async', () => ({
checkEmbeddingUsage: async (opts: any) => opts.next({ ctx: opts.ctx }),
}));
@@ -57,6 +61,10 @@ describe('fileRouter.embeddingChunks timeout', () => {
vi.mocked(EmbeddingModel).mockImplementation(function () {
return embeddingModelMock as any;
});
+ vi.mocked(resolveFileEmbeddingModel).mockResolvedValue({
+ model: 'text-embedding-3-small',
+ provider: 'openai',
+ });
Reflect.set(FileModel, 'getFileById', undefined);
});
@@ -132,3 +140,54 @@ describe('fileRouter.embeddingChunks timeout', () => {
expect(errorUpdates()).toHaveLength(1);
});
});
+
+describe('fileRouter.embeddingChunks model', () => {
+ const asyncTaskModelMock = { findById: vi.fn(), update: vi.fn() };
+ const embeddingModelMock = { bulkCreate: vi.fn() };
+
+ beforeEach(() => {
+ vi.clearAllMocks();
+
+ asyncTaskModelMock.findById.mockResolvedValue({ id: 'task-1' });
+ vi.mocked(AsyncTaskModel).mockImplementation(function () {
+ return asyncTaskModelMock as any;
+ });
+ vi.mocked(FileModel).mockImplementation(function () {
+ return { findById: vi.fn().mockResolvedValue({ id: 'file-1', name: 'a.md' }) } as any;
+ });
+ vi.mocked(ChunkModel).mockImplementation(function () {
+ return {
+ getChunksTextByFileId: vi.fn().mockResolvedValue([{ id: 'chunk-1', text: 'hello' }]),
+ } as any;
+ });
+ vi.mocked(EmbeddingModel).mockImplementation(function () {
+ return embeddingModelMock as any;
+ });
+ Reflect.set(FileModel, 'getFileById', undefined);
+ });
+
+ it("embeds a new file's chunks with the resolved model and records that model", async () => {
+ vi.mocked(resolveFileEmbeddingModel).mockResolvedValue({
+ model: 'text-embedding-3-large',
+ provider: 'azure',
+ });
+ const embeddings = vi.fn().mockResolvedValue([[0.1]]);
+ vi.mocked(initModelRuntimeFromDB).mockResolvedValue({ embeddings } as any);
+ const serverDB = {};
+
+ const caller = fileRouter.createCaller({ serverDB, userId: 'user-1' } as any);
+ await expect(
+ caller.embeddingChunks({ fileId: 'file-1', taskId: 'task-1', workspaceId: 'ws-1' }),
+ ).resolves.toMatchObject({ success: true });
+
+ expect(resolveFileEmbeddingModel).toHaveBeenCalledWith(serverDB, 'user-1', 'ws-1');
+ expect(initModelRuntimeFromDB).toHaveBeenCalledWith(serverDB, 'user-1', 'azure', 'ws-1');
+ expect(embeddings).toHaveBeenCalledWith(
+ expect.objectContaining({ dimensions: 1024, model: 'text-embedding-3-large' }),
+ expect.anything(),
+ );
+ expect(embeddingModelMock.bulkCreate).toHaveBeenCalledWith([
+ expect.objectContaining({ chunkId: 'chunk-1', model: 'text-embedding-3-large' }),
+ ]);
+ });
+});
diff --git a/apps/server/src/routers/async/file.ts b/apps/server/src/routers/async/file.ts
index 74ddae92e32..a784f87c30b 100644
--- a/apps/server/src/routers/async/file.ts
+++ b/apps/server/src/routers/async/file.ts
@@ -7,7 +7,6 @@ import { z } from 'zod';
import { checkEmbeddingUsage } from '@/business/server/trpc-middlewares/async';
import { FILE_PARSE_SIZE_LIMIT_ERROR_MESSAGE, MAX_FILE_PARSE_SIZE } from '@/const/file';
-import { DEFAULT_FILE_EMBEDDING_MODEL_ITEM } from '@/const/settings/knowledge';
import { AsyncTaskModel } from '@/database/models/asyncTask';
import { ChunkModel } from '@/database/models/chunk';
import { EmbeddingModel } from '@/database/models/embedding';
@@ -16,12 +15,12 @@ import { type NewChunkItem, type NewEmbeddingsItem } from '@/database/schemas';
import type { LobeChatDatabase } from '@/database/type';
import { fileEnv } from '@/envs/file';
import { asyncAuthedProcedure, asyncRouter as router } from '@/libs/trpc/async';
-import { getServerDefaultFilesConfig } from '@/server/globalConfig';
import { initModelRuntimeFromDB } from '@/server/modules/ModelRuntime';
import { ChunkService } from '@/server/services/chunk';
import { DocumentService } from '@/server/services/document';
import { FileService } from '@/server/services/file';
import { isSharedLimitFailure, toAsyncTaskErrorType } from '@/server/services/fileParse/failure';
+import { resolveFileEmbeddingModel } from '@/server/services/knowledgeBase/fileEmbeddingModel';
import { type IAsyncTaskError } from '@/types/asyncTask';
import { AsyncTaskError, AsyncTaskErrorType, AsyncTaskStatus } from '@/types/asyncTask';
import { safeParseJSON } from '@/utils/safeParseJSON';
@@ -138,8 +137,11 @@ export const fileRouter = router({
const asyncTask = await asyncTaskModel.findById(input.taskId);
- const { model, provider } =
- getServerDefaultFilesConfig().embeddingModel || DEFAULT_FILE_EMBEDDING_MODEL_ITEM;
+ const { model, provider } = await resolveFileEmbeddingModel(
+ ctx.serverDB,
+ ctx.userId,
+ workspaceId,
+ );
if (!asyncTask) throw new TRPCError({ code: 'BAD_REQUEST', message: 'Async Task not found' });
diff --git a/apps/server/src/routers/lambda/chunk.ts b/apps/server/src/routers/lambda/chunk.ts
index 44a30dd1a76..867bf3dfa7b 100644
--- a/apps/server/src/routers/lambda/chunk.ts
+++ b/apps/server/src/routers/lambda/chunk.ts
@@ -1,4 +1,3 @@
-import { DEFAULT_FILE_EMBEDDING_MODEL_ITEM } from '@lobechat/const';
import { RequestTrigger, SemanticSearchSchema } from '@lobechat/types';
import { TRPCError } from '@trpc/server';
import { z } from 'zod';
@@ -13,11 +12,11 @@ import { FileModel } from '@/database/models/file';
import { MessageModel } from '@/database/models/message';
import { router } from '@/libs/trpc/lambda';
import { serverDatabase } from '@/libs/trpc/lambda/middleware';
-import { getServerDefaultFilesConfig } from '@/server/globalConfig';
import { initModelRuntimeFromDB } from '@/server/modules/ModelRuntime';
import { ChunkService } from '@/server/services/chunk';
import { DocumentService } from '@/server/services/document';
import { KnowledgeBaseSearchService } from '@/server/services/knowledgeBase';
+import { resolveFileEmbeddingModel } from '@/server/services/knowledgeBase/fileEmbeddingModel';
import { assertFileNotInRestrictedKnowledgeBase } from './_helpers/knowledgeBaseAccess';
@@ -133,14 +132,18 @@ export const chunkRouter = router({
}),
)
.mutation(async ({ ctx, input }) => {
- const { model, provider } =
- getServerDefaultFilesConfig().embeddingModel || DEFAULT_FILE_EMBEDDING_MODEL_ITEM;
+ const workspaceId = ctx.workspaceId ?? undefined;
+ const { model, provider } = await resolveFileEmbeddingModel(
+ ctx.serverDB,
+ ctx.userId,
+ workspaceId,
+ );
// Read user's provider config from database
const agentRuntime = await initModelRuntimeFromDB(
ctx.serverDB,
ctx.userId,
provider,
- ctx.workspaceId ?? undefined,
+ workspaceId,
);
const embeddings = await agentRuntime.embeddings(
diff --git a/apps/server/src/services/knowledgeBase/fileEmbeddingModel.test.ts b/apps/server/src/services/knowledgeBase/fileEmbeddingModel.test.ts
new file mode 100644
index 00000000000..d0d430cd492
--- /dev/null
+++ b/apps/server/src/services/knowledgeBase/fileEmbeddingModel.test.ts
@@ -0,0 +1,100 @@
+// @vitest-environment node
+import { DEFAULT_FILE_EMBEDDING_MODEL_ITEM } from '@lobechat/const';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { UserModel } from '@/database/models/user';
+import { getServerDefaultFilesConfig } from '@/server/globalConfig';
+
+import { resolveFileEmbeddingModel } from './fileEmbeddingModel';
+
+vi.mock('@/database/models/user', () => ({ UserModel: vi.fn() }));
+vi.mock('@/server/globalConfig', () => ({ getServerDefaultFilesConfig: vi.fn() }));
+
+const serverDB = {} as any;
+
+const withSettings = (systemAgent?: Record<string, unknown>) => {
+ const getUserSettings = vi.fn().mockResolvedValue(systemAgent ? { systemAgent } : undefined);
+ vi.mocked(UserModel).mockImplementation(function () {
+ return { getUserSettings } as any;
+ });
+};
+
+describe('resolveFileEmbeddingModel', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ vi.mocked(getServerDefaultFilesConfig).mockReturnValue({
+ embeddingModel: { model: 'bge-m3', provider: 'ollama' },
+ } as any);
+ });
+
+ it('uses the model picked in Service Model over DEFAULT_FILES_CONFIG', async () => {
+ withSettings({ fileEmbedding: { model: 'text-embedding-3-large', provider: 'azure' } });
+
+ await expect(resolveFileEmbeddingModel(serverDB, 'user-1')).resolves.toEqual({
+ model: 'text-embedding-3-large',
+ provider: 'azure',
+ });
+ expect(UserModel).toHaveBeenCalledWith(serverDB, 'user-1');
+ });
+
+ it('does not parse DEFAULT_FILES_CONFIG when the user picked a model', async () => {
+ withSettings({ fileEmbedding: { model: 'text-embedding-3-large', provider: 'azure' } });
+ vi.mocked(getServerDefaultFilesConfig).mockImplementation(() => {
+ throw new Error('Invalid environment variable format.');
+ });
+
+ await expect(resolveFileEmbeddingModel(serverDB, 'user-1')).resolves.toEqual({
+ model: 'text-embedding-3-large',
+ provider: 'azure',
+ });
+ });
+
+ it('runs DEFAULT_FILES_CONFIG when nothing is picked, as before the setting existed', async () => {
+ withSettings({ topic: { model: 'gpt-4o-mini', provider: 'openai' } });
+
+ await expect(resolveFileEmbeddingModel(serverDB, 'user-1')).resolves.toEqual({
+ model: 'bge-m3',
+ provider: 'ollama',
+ });
+ });
+
+ it('uses the same default for two members of a workspace with different personal picks', async () => {
+ withSettings({ fileEmbedding: { model: 'text-embedding-3-large', provider: 'azure' } });
+ const indexingModel = await resolveFileEmbeddingModel(serverDB, 'uploader', 'workspace-1');
+
+ withSettings({ fileEmbedding: { model: 'text-embedding-3-small', provider: 'openai' } });
+ const searchModel = await resolveFileEmbeddingModel(serverDB, 'searcher', 'workspace-1');
+
+ expect(indexingModel).toEqual({ model: 'bge-m3', provider: 'ollama' });
+ expect(searchModel).toEqual(indexingModel);
+ });
+
+ it('ignores a half-set pick', async () => {
+ withSettings({ fileEmbedding: { model: 'text-embedding-3-large' } });
+
+ await expect(resolveFileEmbeddingModel(serverDB, 'user-1')).resolves.toEqual({
+ model: 'bge-m3',
+ provider: 'ollama',
+ });
+ });
+
+ it('falls back to the code default without settings or an embedding_model entry', async () => {
+ withSettings();
+ vi.mocked(getServerDefaultFilesConfig).mockReturnValue({ queryMode: 'full_text' } as any);
+
+ await expect(resolveFileEmbeddingModel(serverDB, 'user-1')).resolves.toEqual(
+ DEFAULT_FILE_EMBEDDING_MODEL_ITEM,
+ );
+ });
+
+ it('keeps failing on an invalid DEFAULT_FILES_CONFIG when nothing is picked', async () => {
+ withSettings();
+ vi.mocked(getServerDefaultFilesConfig).mockImplementation(() => {
+ throw new Error('Invalid environment variable format.');
+ });
+
+ await expect(resolveFileEmbeddingModel(serverDB, 'user-1')).rejects.toThrow(
+ 'Invalid environment variable format.',
+ );
+ });
+});
diff --git a/apps/server/src/services/knowledgeBase/fileEmbeddingModel.ts b/apps/server/src/services/knowledgeBase/fileEmbeddingModel.ts
new file mode 100644
index 00000000000..8f2d694feab
--- /dev/null
+++ b/apps/server/src/services/knowledgeBase/fileEmbeddingModel.ts
@@ -0,0 +1,38 @@
+import { DEFAULT_FILE_EMBEDDING_MODEL_ITEM } from '@lobechat/const';
+import { type LobeChatDatabase } from '@lobechat/database';
+import type { FilesConfigItem, UserSystemAgentConfig } from '@lobechat/types';
+import debug from 'debug';
+
+import { UserModel } from '@/database/models/user';
+import { normalizeWorkspaceId } from '@/database/utils/workspace';
+import { getServerDefaultFilesConfig } from '@/server/globalConfig';
+
+const log = debug('lobe-server:file-embedding-model');
+
+/** Team members share a vector index, so use the deployment default for its reads and writes. */
+export const resolveFileEmbeddingModel = async (
+ db: LobeChatDatabase,
+ userId: string,
+ workspaceId?: string,
+): Promise<FilesConfigItem> => {
+ if (!normalizeWorkspaceId(workspaceId)) {
+ const settings = await new UserModel(db, userId).getUserSettings();
+ const picked = (settings?.systemAgent as Partial<UserSystemAgentConfig> | undefined)
+ ?.fileEmbedding;
+
+ if (picked?.model && picked.provider) {
+ log('user setting: %s/%s', picked.provider, picked.model);
+ return { model: picked.model, provider: picked.provider };
+ }
+ }
+
+ const deployment = getServerDefaultFilesConfig().embeddingModel;
+ const resolved = deployment || DEFAULT_FILE_EMBEDDING_MODEL_ITEM;
+ log(
+ '%s: %s/%s',
+ deployment ? 'DEFAULT_FILES_CONFIG' : 'code default',
+ resolved.provider,
+ resolved.model,
+ );
+ return resolved;
+};
diff --git a/apps/server/src/services/knowledgeBase/index.test.ts b/apps/server/src/services/knowledgeBase/index.test.ts
index 6b507a21e01..a15068c9e5a 100644
--- a/apps/server/src/services/knowledgeBase/index.test.ts
+++ b/apps/server/src/services/knowledgeBase/index.test.ts
@@ -7,11 +7,11 @@ import { DocumentModel } from '@/database/models/document';
import { FileModel } from '@/database/models/file';
import { knowledgeBaseFiles } from '@/database/schemas';
import { buildWorkspaceWhere } from '@/database/utils/workspace';
-import { getServerDefaultFilesConfig } from '@/server/globalConfig';
import { initModelRuntimeFromDB } from '@/server/modules/ModelRuntime';
import { createFtsSearchRepo } from '@/server/services/ftsSearch';
import { DocumentService } from '../document';
+import { resolveFileEmbeddingModel } from './fileEmbeddingModel';
import { KnowledgeBaseSearchService } from './index';
vi.mock('@/database/models/agentDocuments', () => ({ AgentDocumentModel: vi.fn() }));
@@ -20,7 +20,7 @@ vi.mock('@/database/models/document', () => ({ DocumentModel: vi.fn() }));
vi.mock('@/database/models/file', () => ({ FileModel: vi.fn() }));
vi.mock('@/server/services/ftsSearch', () => ({ createFtsSearchRepo: vi.fn() }));
vi.mock('../document', () => ({ DocumentService: vi.fn() }));
-vi.mock('@/server/globalConfig', () => ({ getServerDefaultFilesConfig: vi.fn() }));
+vi.mock('./fileEmbeddingModel', () => ({ resolveFileEmbeddingModel: vi.fn() }));
vi.mock('@/server/modules/ModelRuntime', () => ({ initModelRuntimeFromDB: vi.fn() }));
vi.mock('@/database/utils/workspace', () => ({
buildWorkspaceWhere: vi.fn(function () {
@@ -295,14 +295,36 @@ describe('KnowledgeBaseSearchService', () => {
describe('semanticSearchForChat', () => {
beforeEach(() => {
- vi.mocked(getServerDefaultFilesConfig).mockReturnValue({
- embeddingModel: { model: 'text-embedding-3-small', provider: 'openai' },
- } as any);
+ vi.mocked(resolveFileEmbeddingModel).mockResolvedValue({
+ model: 'text-embedding-3-small',
+ provider: 'openai',
+ });
vi.mocked(initModelRuntimeFromDB).mockResolvedValue({
embeddings: vi.fn().mockResolvedValue([[0.1, 0.2, 0.3]]),
} as any);
});
+ it('embeds the query with the resolved workspace model', async () => {
+ vi.mocked(resolveFileEmbeddingModel).mockResolvedValue({
+ model: 'text-embedding-3-large',
+ provider: 'azure',
+ });
+ const embeddings = vi.fn().mockResolvedValue([[0.1, 0.2, 0.3]]);
+ vi.mocked(initModelRuntimeFromDB).mockResolvedValue({ embeddings } as any);
+ chunkModelMock.semanticSearchForChat.mockResolvedValue([]);
+ searchRepoMock.searchKnowledgeBaseDocuments.mockResolvedValue([]);
+
+ const scopedService = new KnowledgeBaseSearchService(serverDB, userId, 'workspace-1');
+ await scopedService.semanticSearchForChat({ fileIds: ['f1'], query: 'hello' });
+
+ expect(resolveFileEmbeddingModel).toHaveBeenCalledWith(serverDB, userId, 'workspace-1');
+ expect(initModelRuntimeFromDB).toHaveBeenCalledWith(serverDB, userId, 'azure', 'workspace-1');
+ expect(embeddings).toHaveBeenCalledWith(
+ expect.objectContaining({ input: 'hello', model: 'text-embedding-3-large' }),
+ expect.anything(),
+ );
+ });
+
it('forwards the caller agent visibility to the selected BM25 backend', async () => {
chunkModelMock.semanticSearchForChat.mockResolvedValue([]);
searchRepoMock.searchKnowledgeBaseDocuments.mockResolvedValue([]);
diff --git a/apps/server/src/services/knowledgeBase/index.ts b/apps/server/src/services/knowledgeBase/index.ts
index 7eb637b2b0f..fad60acf0a0 100644
--- a/apps/server/src/services/knowledgeBase/index.ts
+++ b/apps/server/src/services/knowledgeBase/index.ts
@@ -1,4 +1,3 @@
-import { DEFAULT_FILE_EMBEDDING_MODEL_ITEM } from '@lobechat/const';
import { type LobeChatDatabase } from '@lobechat/database';
import {
type ChatSemanticSearchChunk,
@@ -18,7 +17,6 @@ import { knowledgeBaseFiles } from '@/database/schemas';
import { isFileBackedPlaceholder } from '@/database/utils/fileBackedPlaceholder';
import { readOriginalCharCount } from '@/database/utils/parsedDocument';
import { buildWorkspaceWhere } from '@/database/utils/workspace';
-import { getServerDefaultFilesConfig } from '@/server/globalConfig';
import { initModelRuntimeFromDB } from '@/server/modules/ModelRuntime';
import { DocumentService } from '@/server/services/document';
import { resolveEnterpriseContentScopes } from '@/server/services/enterpriseKnowledge/contentAccess';
@@ -28,6 +26,8 @@ import {
type UsableKnowledgeBaseResolver,
} from '@/server/services/knowledgeBaseAccess';
+import { resolveFileEmbeddingModel } from './fileEmbeddingModel';
+
export interface FileContentResult {
content: string;
error?: string;
@@ -142,8 +142,11 @@ export class KnowledgeBaseSearchService {
// Path 1: vector search over file chunks
const vectorPath = async (): Promise<ChatSemanticSearchChunk[]> => {
- const { model, provider } =
- getServerDefaultFilesConfig().embeddingModel || DEFAULT_FILE_EMBEDDING_MODEL_ITEM;
+ const { model, provider } = await resolveFileEmbeddingModel(
+ this.serverDB,
+ this.userId,
+ this.workspaceId,
+ );
const modelRuntime = await initModelRuntimeFromDB(
this.serverDB,
this.userId,
diff --git a/locales/en-US/setting.json b/locales/en-US/setting.json
index 48d100f29b3..e62a0c5ebf1 100644
--- a/locales/en-US/setting.json
+++ b/locales/en-US/setting.json
@@ -2332,6 +2332,11 @@
"systemAgent.customPrompt.title": "Custom Prompt",
"systemAgent.expertise.modelDesc": "Model used to draft expertise domains and extract reusable experience from conversations.",
"systemAgent.expertise.title": "Agent Self-Evolution",
+ "systemAgent.fileEmbedding.modelDesc": "Embeds file chunks and knowledge base search queries",
+ "systemAgent.fileEmbedding.precedence": "In your personal space, this choice overrides the deployment default. System recommended uses DEFAULT_FILES_CONFIG or the built-in default.",
+ "systemAgent.fileEmbedding.reindexHint": "Only files embedded after a change use the new model. Files already embedded keep their old vectors and may match poorly in semantic search; delete and re-upload them to embed them with the new model.",
+ "systemAgent.fileEmbedding.title": "File & Knowledge Base Embedding",
+ "systemAgent.fileEmbedding.workspaceDefault": "Team workspaces use the deployment default for file embedding and knowledge base search.",
"systemAgent.followUpAction.label": "Follow-up Suggestions Model",
"systemAgent.followUpAction.modelDesc": "Model used to suggest one-click follow-up replies under each assistant message",
"systemAgent.followUpAction.title": "Follow-up Suggestions",
diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.json
index 66e489c37ba..c592a803658 100644
--- a/locales/zh-CN/setting.json
+++ b/locales/zh-CN/setting.json
@@ -2332,6 +2332,11 @@
"systemAgent.customPrompt.title": "自定义提示词",
"systemAgent.expertise.modelDesc": "用于生成专长领域,并从对话中提炼可复用经验的模型。",
"systemAgent.expertise.title": "Agent 自进化",
+ "systemAgent.fileEmbedding.modelDesc": "文件分块与知识库检索的向量化",
+ "systemAgent.fileEmbedding.precedence": "个人空间优先使用此处选择的模型。「系统推荐」使用 DEFAULT_FILES_CONFIG 中的模型,未配置时使用内置默认模型。",
+ "systemAgent.fileEmbedding.reindexHint": "切换后,只有之后向量化的文件使用新模型。已向量化的文件仍保留旧模型的向量,语义检索可能不准确;如需改用新模型,请删除后重新上传。",
+ "systemAgent.fileEmbedding.title": "文件与知识库向量化",
+ "systemAgent.fileEmbedding.workspaceDefault": "团队空间使用部署默认模型进行文件向量化和知识库检索。",
"systemAgent.followUpAction.label": "跟进建议模型",
"systemAgent.followUpAction.modelDesc": "用于在每条助手回复下生成一键跟进建议的模型",
"systemAgent.followUpAction.title": "跟进建议",
diff --git a/packages/const/src/settings/systemAgent.ts b/packages/const/src/settings/systemAgent.ts
index 248e8ca3372..17868bcd667 100644
--- a/packages/const/src/settings/systemAgent.ts
+++ b/packages/const/src/settings/systemAgent.ts
@@ -16,6 +16,7 @@ import type {
UserServiceModelConfigKey,
} from '@lobechat/types';
+import { DEFAULT_FILE_EMBEDDING_MODEL_ITEM } from './knowledge';
import { DEFAULT_EMBEDDING_MODEL, DEFAULT_MINI_MODEL, DEFAULT_MODEL } from './llm';
export const DEFAULT_SYSTEM_AGENT_ITEM: SystemAgentItem = {
@@ -93,6 +94,8 @@ export const DEFAULT_SYSTEM_AGENT_CONFIG: UserServiceModelConfig = {
provider: typeof channelRoutingProvider === 'string' ? channelRoutingProvider : 'typesafe',
},
expertise: DEFAULT_SYSTEM_AGENT_ITEM,
+ // The deployment default comes from `DEFAULT_FILES_CONFIG`, not `SYSTEM_AGENT`.
+ fileEmbedding: DEFAULT_FILE_EMBEDDING_MODEL_ITEM,
followUpAction: DEFAULT_FOLLOW_UP_ACTION_SYSTEM_AGENT_ITEM,
generationTopic: DEFAULT_MINI_SYSTEM_AGENT_ITEM,
goal: DEFAULT_SYSTEM_AGENT_ITEM,
@@ -115,7 +118,9 @@ export const DEFAULT_SYSTEM_AGENT_CONFIG: UserServiceModelConfig = {
* above is its tier's default, so a slot that follows an unset tier runs the
* same system-recommended model the tier shows. The first slot of a tier
* stands for the tier's own recommendation. Slots left out (`asr`,
- * `channelRouting`, onboarding) keep their own system default and ignore tier changes.
+ * `channelRouting`, `fileEmbedding`, onboarding) keep their own system default and
+ * ignore tier changes. `fileEmbedding` must stay out: following a tier would move
+ * file indexing to a new model and strand the vectors of files already embedded.
*/
export const SERVICE_MODEL_TIER_SLOTS: Record<ServiceModelTier, UserServiceModelConfigKey[]> = {
embedding: ['userMemoryEmbedding'],
diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.ts
index 6bb93dbe33b..4296f734813 100644
--- a/packages/locales/src/default/setting.ts
+++ b/packages/locales/src/default/setting.ts
@@ -2160,6 +2160,14 @@ When I am ___, I need ___
'systemAgent.expertise.modelDesc':
'Model used to draft expertise domains and extract reusable experience from conversations.',
'systemAgent.expertise.title': 'Agent Self-Evolution',
+ 'systemAgent.fileEmbedding.modelDesc': 'Embeds file chunks and knowledge base search queries',
+ 'systemAgent.fileEmbedding.precedence':
+ 'In your personal space, this choice overrides the deployment default. System recommended uses DEFAULT_FILES_CONFIG or the built-in default.',
+ 'systemAgent.fileEmbedding.reindexHint':
+ 'Only files embedded after a change use the new model. Files already embedded keep their old vectors and may match poorly in semantic search; delete and re-upload them to embed them with the new model.',
+ 'systemAgent.fileEmbedding.title': 'File & Knowledge Base Embedding',
+ 'systemAgent.fileEmbedding.workspaceDefault':
+ 'Team workspaces use the deployment default for file embedding and knowledge base search.',
'systemAgent.goal.modelDesc':
'Model used to turn a persistent goal into its standing acceptance criteria.',
'systemAgent.goal.title': 'Goal Creation',
diff --git a/packages/types/src/user/settings/systemAgent.ts b/packages/types/src/user/settings/systemAgent.ts
index fe74a568d1e..c9329d85f71 100644
--- a/packages/types/src/user/settings/systemAgent.ts
+++ b/packages/types/src/user/settings/systemAgent.ts
@@ -22,6 +22,13 @@ export interface UserSystemAgentConfig {
channelRouting: SystemAgentItem;
/** Model used to draft expertise domains and extract reusable experience from conversations. */
expertise: SystemAgentItem;
+ /**
+ * Embedding model for file chunks and knowledge-base semantic search. An unset
+ * slot runs the deployment's `DEFAULT_FILES_CONFIG` `embedding_model`, else the
+ * code default. Follows no Service Model tier: switching it leaves files that
+ * were already embedded on their old vectors.
+ */
+ fileEmbedding: SystemAgentItem;
followUpAction: SystemAgentItem;
generationTopic: SystemAgentItem;
/** Model used to turn a persistent goal into its standing acceptance criteria. */
diff --git a/src/features/ServiceModel/ServiceModelForm/index.tsx b/src/features/ServiceModel/ServiceModelForm/index.tsx
index c5913f5d67b..c27e41e3017 100644
--- a/src/features/ServiceModel/ServiceModelForm/index.tsx
+++ b/src/features/ServiceModel/ServiceModelForm/index.tsx
@@ -73,12 +73,19 @@ const TIERS: { key: ServiceModelTier; modelKind: ModelKind; rows: RowKey[] }[] =
/** Speech-to-text follows no tier; it is its own row after the tiers. */
const ASR_ROW = 'asr' satisfies RowKey;
-/** A settings card: one per tier, plus voice. */
-type Section = ServiceModelTier | 'channelRouting' | 'voice';
+/**
+ * File and knowledge-base embedding follows no tier either: a tier change must
+ * not move indexing to a model the files already embedded were not built with.
+ */
+const FILE_EMBEDDING_ROW = 'fileEmbedding' satisfies RowKey;
+
+/** A settings card: one per tier, plus file embedding and voice. */
+type Section = ServiceModelTier | 'channelRouting' | typeof FILE_EMBEDDING_ROW | 'voice';
const sectionOf = (row: RowKey | UserServiceModelConfigKey): Section => {
if (row === DEFAULT_AGENT_ROW) return 'main';
if (row === ASR_ROW) return 'voice';
+ if (row === FILE_EMBEDDING_ROW) return FILE_EMBEDDING_ROW;
if (row === 'channelRouting') return 'channelRouting';
return tierOfSlot(row) ?? 'main';
};
@@ -93,14 +100,10 @@ const PERSONAL_SLOTS = new Set<UserServiceModelConfigKey>(PERSONAL_SYSTEM_AGENT_
const NO_SLOTS = new Set<UserServiceModelConfigKey>();
interface ServiceModelFormProps {
- /**
- * Drop the personal chat-assist rows (follow-up, input completion). The
- * workspace surface edits them on its own Chat Preferences tab instead.
- */
- hidePersonalPreferences?: boolean;
+ scope?: 'personal' | 'workspace';
}
-const ServiceModelForm = ({ hidePersonalPreferences }: ServiceModelFormProps) => {
+const ServiceModelForm = ({ scope = 'personal' }: ServiceModelFormProps) => {
const { t } = useTranslation('setting');
const enableChannels = useServerConfigStore(serverConfigSelectors.enableChannels);
const { allowed: canManage, reason } = usePermission('manage_settings');
@@ -144,7 +147,8 @@ const ServiceModelForm = ({ hidePersonalPreferences }: ServiceModelFormProps) =>
return <ServiceModelFormSkeleton />;
}
- const skipSlots = hidePersonalPreferences ? PERSONAL_SLOTS : NO_SLOTS;
+ const isWorkspaceSettings = scope === 'workspace';
+ const skipSlots = isWorkspaceSettings ? PERSONAL_SLOTS : NO_SLOTS;
const tiers = TIERS.map((tier) => ({
...tier,
rows: tier.rows.filter(
@@ -393,7 +397,9 @@ const ServiceModelForm = ({ hidePersonalPreferences }: ServiceModelFormProps) =>
// One settings group per model kind, like 生图 below: each tier is its own
// card with its picker on top and the tasks that follow it in a lighter
- // 「高级」 under it. Voice follows no tier, so it is a card of its own.
+ // 「高级」 under it. File embedding and voice follow no tier, so each is a
+ // card of its own.
+ const fileEmbeddingState = rowState(FILE_EMBEDDING_ROW);
const groups: FormGroupItem[] = [
...tiers.map(({ key, modelKind, rows }, index): FormGroupItem => {
const title = t(`serviceModel.tier.${key}.title`);
@@ -429,6 +435,56 @@ const ServiceModelForm = ({ hidePersonalPreferences }: ServiceModelFormProps) =>
),
};
}),
+ {
+ children: (
+ <>
+ {/* Same picker as a tier: it names the deployment default it falls back to. */}
+ <Form.Field label={t('serviceModel.tierPicker')}>
+ <TierRow
+ disabled={isWorkspaceSettings || !canManage}
+ modelKind={'embedding'}
+ recommended={followModelOf(FILE_EMBEDDING_ROW)!}
+ title={t(`systemAgent.${FILE_EMBEDDING_ROW}.title`)}
+ value={
+ !isWorkspaceSettings && fileEmbeddingState.kind === 'custom'
+ ? fileEmbeddingState.value
+ : undefined
+ }
+ onChange={(value) =>
+ writeSlot(
+ FILE_EMBEDDING_ROW,
+ value ? { kind: 'custom', value } : { kind: 'follow' },
+ )
+ }
+ />
+ </Form.Field>
+ <Flexbox gap={4} {...stylex.props(styles.note)}>
+ {isWorkspaceSettings ? (
+ <span {...stylex.props(styles.sectionDesc)}>
+ {t(`systemAgent.${FILE_EMBEDDING_ROW}.workspaceDefault`)}
+ </span>
+ ) : (
+ <>
+ <span {...stylex.props(styles.sectionDesc)}>
+ {t(`systemAgent.${FILE_EMBEDDING_ROW}.precedence`)}
+ </span>
+ <span {...stylex.props(styles.sectionDesc)}>
+ {t(`systemAgent.${FILE_EMBEDDING_ROW}.reindexHint`)}
+ </span>
+ </>
+ )}
+ </Flexbox>
+ </>
+ ),
+ collapsible: false,
+ desc: withReason(t(`systemAgent.${FILE_EMBEDDING_ROW}.modelDesc`)),
+ extra: saveHint(FILE_EMBEDDING_ROW),
+ title: (
+ <SettingsSearchAnchor id={`service-model-${FILE_EMBEDDING_ROW}`}>
+ {t(`systemAgent.${FILE_EMBEDDING_ROW}.title`)}
+ </SettingsSearchAnchor>
+ ),
+ },
{
children: (
<Form.Field
diff --git a/src/features/ServiceModel/ServiceModelForm/styles.ts b/src/features/ServiceModel/ServiceModelForm/styles.ts
index b5dc1feaea6..de0d76c8350 100644
--- a/src/features/ServiceModel/ServiceModelForm/styles.ts
+++ b/src/features/ServiceModel/ServiceModelForm/styles.ts
@@ -22,6 +22,10 @@ export const styles = stylex.create({
advanced: {
paddingBlockEnd: 16,
},
+ /** Notes under a card's picker, closed by the next card's divider like 「高级」. */
+ note: {
+ paddingBlockEnd: 16,
+ },
/** Compact rows: the picker is 32px, so 40 leaves 4px above and below. */
row: {
minHeight: 40,
diff --git a/src/features/ServiceModel/serviceModelState.test.ts b/src/features/ServiceModel/serviceModelState.test.ts
index 7df906b8578..c340bf767cf 100644
--- a/src/features/ServiceModel/serviceModelState.test.ts
+++ b/src/features/ServiceModel/serviceModelState.test.ts
@@ -188,6 +188,35 @@ describe('canDisableSlot', () => {
});
});
+describe('file embedding', () => {
+ const EMBED = { model: 'embed-a', provider: 'acme' };
+
+ it('stays on the deployment default when the memory embedding tier changes', () => {
+ const next = applyTierChoice({}, 'embedding', EMBED);
+
+ // Following the tier would re-index new files with another model than the
+ // files already embedded, so it is not a tier slot.
+ expect(next.userMemoryEmbedding).toEqual(EMBED);
+ expect(next.fileEmbedding).toBeUndefined();
+ expect(resolveSlotState(next, defaults, 'fileEmbedding')).toEqual({
+ kind: 'follow',
+ value: defaults.fileEmbedding,
+ });
+ });
+
+ it('pins a picked model and drops it again on 系统推荐', () => {
+ const pinned = applySlotChoice({}, 'fileEmbedding', { kind: 'custom', value: EMBED });
+ expect(pinned).toEqual({ fileEmbedding: EMBED });
+ expect(resolveSlotState(pinned, defaults, 'fileEmbedding')).toEqual({
+ kind: 'custom',
+ value: EMBED,
+ });
+
+ expect(applySlotChoice(pinned, 'fileEmbedding', { kind: 'follow' })).toEqual({});
+ expect(canDisableSlot('fileEmbedding')).toBe(false);
+ });
+});
+
describe('channel decision settings', () => {
it('defaults to an enabled decision model independent of chat tiers', () => {
const stored = applyTierChoice({}, 'flash', FLASH);
diff --git a/src/features/Settings/service-model/index.tsx b/src/features/Settings/service-model/index.tsx
index c9450db342f..8abca5a458c 100644
--- a/src/features/Settings/service-model/index.tsx
+++ b/src/features/Settings/service-model/index.tsx
@@ -9,17 +9,17 @@ import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfi
import Image from '../image/features/Image';
interface PageProps {
- hidePersonalPreferences?: boolean;
+ scope?: 'personal' | 'workspace';
showSettingHeader?: boolean;
}
-const Page = ({ hidePersonalPreferences, showSettingHeader = true }: PageProps) => {
+const Page = ({ scope, showSettingHeader = true }: PageProps) => {
const { t } = useTranslation('setting');
const { showAiImage } = useServerConfigStore(featureFlagsSelectors);
return (
<>
{showSettingHeader && <SettingHeader title={t('tab.serviceModel')} />}
- <ServiceModelForm hidePersonalPreferences={hidePersonalPreferences} />
+ <ServiceModelForm scope={scope} />
{showAiImage && <Image />}
</>
);
diff --git a/src/features/SettingsSearch/items.ts b/src/features/SettingsSearch/items.ts
index 38ef177d375..34bd84e7a65 100644
--- a/src/features/SettingsSearch/items.ts
+++ b/src/features/SettingsSearch/items.ts
@@ -544,6 +544,13 @@ export const SETTINGS_SEARCH_ITEMS: SettingsSearchItem[] = [
labelKey: 'serviceModel.tier.verify.title',
tab: SettingsTabs.ServiceModel,
},
+ {
+ anchor: 'service-model-fileEmbedding',
+ descKey: 'systemAgent.fileEmbedding.modelDesc',
+ keywords: ['embedding', 'file', 'knowledge base', 'vector', 'DEFAULT_FILES_CONFIG'],
+ labelKey: 'systemAgent.fileEmbedding.title',
+ tab: SettingsTabs.ServiceModel,
+ },
{
anchor: 'service-model-asr',
keywords: ['voice', 'transcription', 'speech to text'],
diff --git a/src/routes/(main)/[workspaceSlug]/settings/service-model/index.test.tsx b/src/routes/(main)/[workspaceSlug]/settings/service-model/index.test.tsx
index 8a4e5944ddb..00c75589fb2 100644
--- a/src/routes/(main)/[workspaceSlug]/settings/service-model/index.test.tsx
+++ b/src/routes/(main)/[workspaceSlug]/settings/service-model/index.test.tsx
@@ -14,8 +14,8 @@ vi.mock('@/business/client/hooks/useIsWorkspaceLoading', () => ({
}));
vi.mock('@/features/Settings/service-model', () => ({
- default: ({ hidePersonalPreferences }: { hidePersonalPreferences?: boolean }) => (
- <div data-hide-personal={String(!!hidePersonalPreferences)} data-testid="service-model-page">
+ default: ({ scope }: { scope?: 'personal' | 'workspace' }) => (
+ <div data-scope={scope} data-testid="service-model-page">
service model settings
</div>
),
@@ -29,11 +29,11 @@ describe('WorkspaceServiceModelSetting', () => {
expect(screen.getByTestId('service-model-page')).toHaveTextContent('service model settings');
});
- it('leaves the personal chat-assist rows to the Chat Preferences tab', () => {
+ it('renders the service model page in workspace scope', () => {
managePermission.allowed = true;
render(<WorkspaceServiceModelSetting />);
- expect(screen.getByTestId('service-model-page')).toHaveAttribute('data-hide-personal', 'true');
+ expect(screen.getByTestId('service-model-page')).toHaveAttribute('data-scope', 'workspace');
});
it('renders forbidden screen without manage_settings permission', () => {
diff --git a/src/routes/(main)/[workspaceSlug]/settings/service-model/index.tsx b/src/routes/(main)/[workspaceSlug]/settings/service-model/index.tsx
index 7214b41007c..7f7c6e5af5b 100644
--- a/src/routes/(main)/[workspaceSlug]/settings/service-model/index.tsx
+++ b/src/routes/(main)/[workspaceSlug]/settings/service-model/index.tsx
@@ -7,7 +7,7 @@ const WorkspaceServiceModelSetting = () => (
<WorkspaceAdminOnly>
{/* Follow-up / input completion are personal: members edit them on the
Chat Preferences tab, so admins don't get a second entry here. */}
- <Page hidePersonalPreferences showSettingHeader={false} />
+ <Page scope={'workspace'} showSettingHeader={false} />
</WorkspaceAdminOnly>
);
diff --git a/src/store/user/slices/settings/selectors/__snapshots__/settings.test.ts.snap b/src/store/user/slices/settings/selectors/__snapshots__/settings.test.ts.snap
index 6bcd62bc022..00e2f7ac221 100644
--- a/src/store/user/slices/settings/selectors/__snapshots__/settings.test.ts.snap
+++ b/src/store/user/slices/settings/selectors/__snapshots__/settings.test.ts.snap
@@ -64,6 +64,10 @@ exports[`settingsSelectors > currentSystemAgent > should merge DEFAULT_SYSTEM_AG
"model": "deepseek-v4-flash",
"provider": "deepseek",
},
+ "fileEmbedding": {
+ "model": "text-embedding-3-small",
+ "provider": "openai",
+ },
"followUpAction": {
"enabled": false,
"model": "gpt-5.6-luna",