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.

♻️ refactor: refactor all `@/types` in model runtime to `@lobechat/types` (#9383)

Arvin Xub050bd7b9f7a
diff --git a/packages/model-runtime/src/core/ModelRuntime.ts b/packages/model-runtime/src/core/ModelRuntime.ts
index 0291d32d8a7..76c2b77eb9b 100644
--- a/packages/model-runtime/src/core/ModelRuntime.ts
+++ b/packages/model-runtime/src/core/ModelRuntime.ts
@@ -1,7 +1,6 @@
+import type { TracePayload } from '@lobechat/types';
import { ClientOptions } from 'openai';
-import type { TracePayload } from '@/types/index';
-
import { LobeBedrockAIParams } from '../providers/bedrock';
import { LobeCloudflareParams } from '../providers/cloudflare';
import { LobeOpenAI } from '../providers/openai';
diff --git a/packages/model-runtime/src/core/RouterRuntime/createRuntime.ts b/packages/model-runtime/src/core/RouterRuntime/createRuntime.ts
index 35bbd5f14c7..e73408d44de 100644
--- a/packages/model-runtime/src/core/RouterRuntime/createRuntime.ts
+++ b/packages/model-runtime/src/core/RouterRuntime/createRuntime.ts
@@ -1,11 +1,10 @@
/**
* @see https://github.com/lobehub/lobe-chat/discussions/6563
*/
+import type { ChatModelCard } from '@lobechat/types';
import OpenAI, { ClientOptions } from 'openai';
import { Stream } from 'openai/streaming';
-import type { ChatModelCard } from '@/types/llm';
-
import { LobeOpenAI } from '../../providers/openai';
import { CreateImagePayload, CreateImageResponse, ILobeAgentRuntimeErrorType } from '../../types';
import {
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/index.ts b/packages/model-runtime/src/core/openaiCompatibleFactory/index.ts
index b4afe5d69b4..d16635f9de7 100644
--- a/packages/model-runtime/src/core/openaiCompatibleFactory/index.ts
+++ b/packages/model-runtime/src/core/openaiCompatibleFactory/index.ts
@@ -1,3 +1,4 @@
+import type { ChatModelCard } from '@lobechat/types';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import { LOBE_DEFAULT_MODEL_LIST } from 'model-bank';
@@ -5,8 +6,6 @@ import type { AiModelType } from 'model-bank';
import OpenAI, { ClientOptions } from 'openai';
import { Stream } from 'openai/streaming';
-import type { ChatModelCard } from '@/types/llm';
-
import {
ChatCompletionErrorPayload,
ChatCompletionTool,
diff --git a/packages/model-runtime/src/core/streams/anthropic.ts b/packages/model-runtime/src/core/streams/anthropic.ts
index fe0ea40a5ed..0fe2a192399 100644
--- a/packages/model-runtime/src/core/streams/anthropic.ts
+++ b/packages/model-runtime/src/core/streams/anthropic.ts
@@ -1,7 +1,6 @@
import Anthropic from '@anthropic-ai/sdk';
import type { Stream } from '@anthropic-ai/sdk/streaming';
-
-import { ChatCitationItem, ModelTokensUsage } from '@/types/message';
+import { ChatCitationItem, ModelTokensUsage } from '@lobechat/types';
import { ChatStreamCallbacks } from '../../types';
import {
diff --git a/packages/model-runtime/src/core/streams/google/const.ts b/packages/model-runtime/src/core/streams/google/const.ts
new file mode 100644
index 00000000000..adaa3fb3d58
--- /dev/null
+++ b/packages/model-runtime/src/core/streams/google/const.ts
@@ -0,0 +1,17 @@
+export const GOOGLE_AI_BLOCK_REASON = {
+ BLOCKLIST:
+ 'Your content contains prohibited terms. Please review and modify your input, then try again.',
+ IMAGE_SAFETY:
+ 'The generated image was blocked for safety reasons. Please try modifying your image request.',
+ LANGUAGE:
+ 'The language you are using is not supported. Please try again in English or another supported language.',
+ OTHER: 'The content was blocked for an unknown reason. Please try rephrasing your request.',
+ PROHIBITED_CONTENT:
+ 'Your request may contain prohibited content. Please adjust your request to comply with the usage guidelines.',
+ RECITATION:
+ 'Your content was blocked due to potential copyright concerns. Please try using original content or rephrase your request.',
+ SAFETY:
+ 'Your content was blocked for safety policy reasons. Please adjust your request to avoid potentially harmful or inappropriate content.',
+ SPII: 'Your content may contain sensitive personally identifiable information (PII). To protect privacy, please remove any sensitive details and try again.',
+ default: 'Content blocked: {{blockReason}}. Please adjust your request and try again.',
+} as const;
diff --git a/packages/model-runtime/src/core/streams/google-ai.test.ts b/packages/model-runtime/src/core/streams/google/google-ai.test.ts
similarity index 98%
rename from packages/model-runtime/src/core/streams/google-ai.test.ts
rename to packages/model-runtime/src/core/streams/google/google-ai.test.ts
index 15ebb58813c..811f1876d64 100644
--- a/packages/model-runtime/src/core/streams/google-ai.test.ts
+++ b/packages/model-runtime/src/core/streams/google/google-ai.test.ts
@@ -1,8 +1,8 @@
import { GenerateContentResponse } from '@google/genai';
import { describe, expect, it, vi } from 'vitest';
-import * as uuidModule from '../../utils/uuid';
-import { GoogleGenerativeAIStream, LOBE_ERROR_KEY } from './google-ai';
+import * as uuidModule from '../../../utils/uuid';
+import { GoogleGenerativeAIStream, LOBE_ERROR_KEY } from './index';
describe('GoogleGenerativeAIStream', () => {
it('should transform Google Generative AI stream to protocol stream', async () => {
@@ -25,9 +25,7 @@ describe('GoogleGenerativeAIStream', () => {
// final chunk should include finishReason and usageMetadata to mark terminal event
controller.enqueue({
text: ' world!',
- candidates: [
- { content: { role: 'model' }, finishReason: 'STOP', index: 0 },
- ],
+ candidates: [{ content: { role: 'model' }, finishReason: 'STOP', index: 0 }],
usageMetadata: {
promptTokenCount: 1,
totalTokenCount: 1,
@@ -908,7 +906,7 @@ describe('GoogleGenerativeAIStream', () => {
expect(chunks).toEqual([
'id: chat_1\n',
'event: error\n',
- `data: {"body":{"context":{"promptFeedback":{"blockReason":"PROHIBITED_CONTENT"}},"message":"您的请求可能包含违禁内容。请调整您的请求,确保内容符合使用规范。","provider":"google"},"type":"ProviderBizError"}\n\n`,
+ `data: {"body":{"context":{"promptFeedback":{"blockReason":"PROHIBITED_CONTENT"}},"message":"Your request may contain prohibited content. Please adjust your request to comply with the usage guidelines.","provider":"google"},"type":"ProviderBizError"}\n\n`,
]);
});
diff --git a/packages/model-runtime/src/core/streams/google-ai.ts b/packages/model-runtime/src/core/streams/google/index.ts
similarity index 95%
rename from packages/model-runtime/src/core/streams/google-ai.ts
rename to packages/model-runtime/src/core/streams/google/index.ts
index 5c5e0c717dd..65952977874 100644
--- a/packages/model-runtime/src/core/streams/google-ai.ts
+++ b/packages/model-runtime/src/core/streams/google/index.ts
@@ -1,11 +1,8 @@
import { GenerateContentResponse } from '@google/genai';
+import { GroundingSearch, ModelTokensUsage } from '@lobechat/types';
-import errorLocale from '@/locales/default/error';
-import { ModelTokensUsage } from '@/types/message';
-import { GroundingSearch } from '@/types/search';
-
-import { ChatStreamCallbacks } from '../../types';
-import { nanoid } from '../../utils/uuid';
+import { ChatStreamCallbacks } from '../../../types';
+import { nanoid } from '../../../utils/uuid';
import {
StreamContext,
StreamProtocolChunk,
@@ -14,12 +11,13 @@ import {
createSSEProtocolTransformer,
createTokenSpeedCalculator,
generateToolCallId,
-} from './protocol';
+} from '../protocol';
+import { GOOGLE_AI_BLOCK_REASON } from './const';
export const LOBE_ERROR_KEY = '__lobe_error';
const getBlockReasonMessage = (blockReason: string): string => {
- const blockReasonMessages = errorLocale.response.GoogleAIBlockReason;
+ const blockReasonMessages = GOOGLE_AI_BLOCK_REASON;
return (
blockReasonMessages[blockReason as keyof typeof blockReasonMessages] ||
diff --git a/packages/model-runtime/src/core/streams/index.ts b/packages/model-runtime/src/core/streams/index.ts
index bdc1cf3628e..07fd65d3ef0 100644
--- a/packages/model-runtime/src/core/streams/index.ts
+++ b/packages/model-runtime/src/core/streams/index.ts
@@ -1,6 +1,6 @@
export * from './anthropic';
export * from './bedrock';
-export * from './google-ai';
+export * from './google';
export * from './model';
export * from './ollama';
export * from './openai';
diff --git a/packages/model-runtime/src/core/streams/openai/openai.ts b/packages/model-runtime/src/core/streams/openai/openai.ts
index dfef9bf86c5..f5cded8c0db 100644
--- a/packages/model-runtime/src/core/streams/openai/openai.ts
+++ b/packages/model-runtime/src/core/streams/openai/openai.ts
@@ -1,8 +1,7 @@
+import { ChatCitationItem, ChatMessageError } from '@lobechat/types';
import OpenAI from 'openai';
import type { Stream } from 'openai/streaming';
-import { ChatCitationItem, ChatMessageError } from '@/types/message';
-
import { ChatStreamCallbacks } from '../../../types';
import { AgentRuntimeErrorType, ILobeAgentRuntimeErrorType } from '../../../types/error';
import { convertUsage } from '../../../utils/usageConverter';
@@ -57,8 +56,16 @@ const transformOpenAIStream = (
const errorData = {
body: chunk,
- message: 'message' in chunk ? typeof chunk.message === 'string' ? chunk.message : JSON.stringify(chunk) : JSON.stringify(chunk),
- type: 'errorType' in chunk ? chunk.errorType as typeof AgentRuntimeErrorType.ProviderBizError : AgentRuntimeErrorType.ProviderBizError,
+ message:
+ 'message' in chunk
+ ? typeof chunk.message === 'string'
+ ? chunk.message
+ : JSON.stringify(chunk)
+ : JSON.stringify(chunk),
+ type:
+ 'errorType' in chunk
+ ? (chunk.errorType as typeof AgentRuntimeErrorType.ProviderBizError)
+ : AgentRuntimeErrorType.ProviderBizError,
} satisfies ChatMessageError;
return { data: errorData, id: 'first_chunk_error', type: 'error' };
}
diff --git a/packages/model-runtime/src/core/streams/openai/responsesStream.ts b/packages/model-runtime/src/core/streams/openai/responsesStream.ts
index c97a76e8f05..c1a318b1e13 100644
--- a/packages/model-runtime/src/core/streams/openai/responsesStream.ts
+++ b/packages/model-runtime/src/core/streams/openai/responsesStream.ts
@@ -1,8 +1,7 @@
+import { ChatCitationItem, ChatMessageError } from '@lobechat/types';
import OpenAI from 'openai';
import type { Stream } from 'openai/streaming';
-import { ChatCitationItem, ChatMessageError } from '@/types/message';
-
import { AgentRuntimeErrorType } from '../../../types/error';
import { convertResponseUsage } from '../../../utils/usageConverter';
import {
@@ -45,8 +44,16 @@ const transformOpenAIStream = (
const errorData = {
body: chunk,
- message: 'message' in chunk ? typeof chunk.message === 'string' ? chunk.message : JSON.stringify(chunk) : JSON.stringify(chunk),
- type: 'errorType' in chunk ? chunk.errorType as typeof AgentRuntimeErrorType.ProviderBizError : AgentRuntimeErrorType.ProviderBizError,
+ message:
+ 'message' in chunk
+ ? typeof chunk.message === 'string'
+ ? chunk.message
+ : JSON.stringify(chunk)
+ : JSON.stringify(chunk),
+ type:
+ 'errorType' in chunk
+ ? (chunk.errorType as typeof AgentRuntimeErrorType.ProviderBizError)
+ : AgentRuntimeErrorType.ProviderBizError,
} satisfies ChatMessageError;
return { data: errorData, id: 'first_chunk_error', type: 'error' };
}
diff --git a/packages/model-runtime/src/core/streams/protocol.ts b/packages/model-runtime/src/core/streams/protocol.ts
index e5f0264851b..ae34182cc00 100644
--- a/packages/model-runtime/src/core/streams/protocol.ts
+++ b/packages/model-runtime/src/core/streams/protocol.ts
@@ -1,4 +1,4 @@
-import { ChatCitationItem, ModelSpeed, ModelTokensUsage } from '@/types/message';
+import { ChatCitationItem, ModelSpeed, ModelTokensUsage } from '@lobechat/types';
import { parseToolCalls } from '../../helpers';
import { ChatStreamCallbacks } from '../../types';
diff --git a/packages/model-runtime/src/core/streams/vertex-ai.ts b/packages/model-runtime/src/core/streams/vertex-ai.ts
index 76b897dd8ba..697557c49cb 100644
--- a/packages/model-runtime/src/core/streams/vertex-ai.ts
+++ b/packages/model-runtime/src/core/streams/vertex-ai.ts
@@ -1,10 +1,9 @@
import { GenerateContentResponse } from '@google/genai';
-
-import { GroundingSearch } from '@/types/search';
+import { GroundingSearch } from '@lobechat/types';
import { ModelTokensUsage } from '../../types';
import { nanoid } from '../../utils/uuid';
-import { type GoogleAIStreamOptions } from './google-ai';
+import { type GoogleAIStreamOptions } from './google';
import {
StreamContext,
StreamProtocolChunk,
diff --git a/packages/model-runtime/src/providers/ai360/index.ts b/packages/model-runtime/src/providers/ai360/index.ts
index 33d70d68d99..e43c111e0c6 100644
--- a/packages/model-runtime/src/providers/ai360/index.ts
+++ b/packages/model-runtime/src/providers/ai360/index.ts
@@ -1,7 +1,6 @@
+import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { ChatModelCard } from '@/types/llm';
-
import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
export interface Ai360ModelCard {
diff --git a/packages/model-runtime/src/providers/cohere/index.ts b/packages/model-runtime/src/providers/cohere/index.ts
index 6cc6e7e1f92..4b9451f91d5 100644
--- a/packages/model-runtime/src/providers/cohere/index.ts
+++ b/packages/model-runtime/src/providers/cohere/index.ts
@@ -1,7 +1,6 @@
+import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { ChatModelCard } from '@/types/llm';
-
import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
export interface CohereModelCard {
diff --git a/packages/model-runtime/src/providers/google/index.test.ts b/packages/model-runtime/src/providers/google/index.test.ts
index 449a2ab3cbb..d0e62eaed44 100644
--- a/packages/model-runtime/src/providers/google/index.test.ts
+++ b/packages/model-runtime/src/providers/google/index.test.ts
@@ -1,15 +1,14 @@
// @vitest-environment edge-runtime
import { GenerateContentResponse, Tool } from '@google/genai';
import { OpenAIChatMessage } from '@lobechat/model-runtime';
+import { ChatStreamPayload } from '@lobechat/types';
import OpenAI from 'openai';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import { ChatStreamPayload } from '@/types/openai/chat';
-
+import { LOBE_ERROR_KEY } from '../../core/streams';
+import { AgentRuntimeErrorType } from '../../types/error';
import * as debugStreamModule from '../../utils/debugStream';
import * as imageToBase64Module from '../../utils/imageToBase64';
-import { LOBE_ERROR_KEY } from '../../core/streams/google-ai';
-import { AgentRuntimeErrorType } from '../../types/error';
import { LobeGoogleAI } from './index';
const provider = 'google';
diff --git a/packages/model-runtime/src/providers/google/index.ts b/packages/model-runtime/src/providers/google/index.ts
index c5a214c81f0..4ae333b1c8a 100644
--- a/packages/model-runtime/src/providers/google/index.ts
+++ b/packages/model-runtime/src/providers/google/index.ts
@@ -9,10 +9,11 @@ import {
Type as SchemaType,
ThinkingConfig,
} from '@google/genai';
+import debug from 'debug';
-import { LOBE_ERROR_KEY } from '../../core/streams/google-ai';
import { LobeRuntimeAI } from '../../core/BaseAI';
import { GoogleGenerativeAIStream, VertexAIStream } from '../../core/streams';
+import { LOBE_ERROR_KEY } from '../../core/streams/google';
import {
ChatCompletionTool,
ChatMethodOptions,
@@ -30,7 +31,6 @@ import { StreamingResponse } from '../../utils/response';
import { safeParseJSON } from '../../utils/safeParseJSON';
import { parseDataUri } from '../../utils/uriParser';
import { createGoogleImage } from './createImage';
-import debug from 'debug';
const log = debug('model-runtime:google');
diff --git a/packages/model-runtime/src/providers/groq/index.ts b/packages/model-runtime/src/providers/groq/index.ts
index 48a64d1b817..56f7a7e1d70 100644
--- a/packages/model-runtime/src/providers/groq/index.ts
+++ b/packages/model-runtime/src/providers/groq/index.ts
@@ -1,7 +1,6 @@
+import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { ChatModelCard } from '@/types/llm';
-
import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
import { AgentRuntimeErrorType } from '../../types/error';
diff --git a/packages/model-runtime/src/providers/higress/index.ts b/packages/model-runtime/src/providers/higress/index.ts
index a4dcb970ca4..6508fab15ba 100644
--- a/packages/model-runtime/src/providers/higress/index.ts
+++ b/packages/model-runtime/src/providers/higress/index.ts
@@ -1,8 +1,7 @@
+import type { ChatModelCard } from '@lobechat/types';
import uniqueId from 'lodash-es/uniqueId';
import { ModelProvider } from 'model-bank';
-import type { ChatModelCard } from '@/types/index';
-
import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
export interface HigressModelCard {
diff --git a/packages/model-runtime/src/providers/ppio/index.ts b/packages/model-runtime/src/providers/ppio/index.ts
index 3cad6c48295..a61a04e1956 100644
--- a/packages/model-runtime/src/providers/ppio/index.ts
+++ b/packages/model-runtime/src/providers/ppio/index.ts
@@ -1,7 +1,6 @@
+import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { ChatModelCard } from '@/types/llm';
-
import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
import { PPIOModelCard } from './type';
diff --git a/packages/model-runtime/src/providers/sensenova/index.ts b/packages/model-runtime/src/providers/sensenova/index.ts
index b44e24f784e..e6093837821 100644
--- a/packages/model-runtime/src/providers/sensenova/index.ts
+++ b/packages/model-runtime/src/providers/sensenova/index.ts
@@ -1,7 +1,6 @@
+import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { ChatModelCard } from '@/types/llm';
-
import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
import { convertSenseNovaMessage } from '../../utils/sensenovaHelpers';
diff --git a/packages/model-runtime/src/providers/stepfun/index.ts b/packages/model-runtime/src/providers/stepfun/index.ts
index 1f225991613..051fed650aa 100644
--- a/packages/model-runtime/src/providers/stepfun/index.ts
+++ b/packages/model-runtime/src/providers/stepfun/index.ts
@@ -1,7 +1,6 @@
+import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { ChatModelCard } from '@/types/llm';
-
import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
export interface StepfunModelCard {
diff --git a/packages/model-runtime/src/providers/tencentcloud/index.ts b/packages/model-runtime/src/providers/tencentcloud/index.ts
index 42f196cfe35..5b4245cba1a 100644
--- a/packages/model-runtime/src/providers/tencentcloud/index.ts
+++ b/packages/model-runtime/src/providers/tencentcloud/index.ts
@@ -1,7 +1,6 @@
+import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { ChatModelCard } from '@/types/llm';
-
import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
export interface TencentCloudModelCard {
diff --git a/packages/model-runtime/src/providers/vllm/index.ts b/packages/model-runtime/src/providers/vllm/index.ts
index 4ce57db3cf3..96bcf5fecfe 100644
--- a/packages/model-runtime/src/providers/vllm/index.ts
+++ b/packages/model-runtime/src/providers/vllm/index.ts
@@ -1,7 +1,6 @@
+import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { ChatModelCard } from '@/types/llm';
-
import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
export interface VLLMModelCard {
diff --git a/packages/model-runtime/src/types/textToImage.ts b/packages/model-runtime/src/types/textToImage.ts
index 170c8eff6c2..35a2d5cb79a 100644
--- a/packages/model-runtime/src/types/textToImage.ts
+++ b/packages/model-runtime/src/types/textToImage.ts
@@ -1,4 +1,6 @@
-import { DallEImageQuality, DallEImageSize, DallEImageStyle } from '@/types/tool/dalle';
+export type DallEImageQuality = 'standard' | 'hd';
+export type DallEImageStyle = 'vivid' | 'natural';
+export type DallEImageSize = '1792x1024' | '1024x1024' | '1024x1792';
export interface TextToImagePayload {
model: string;
diff --git a/packages/model-runtime/src/utils/modelParse.test.ts b/packages/model-runtime/src/utils/modelParse.test.ts
index f8581b14223..0e5b27ac197 100644
--- a/packages/model-runtime/src/utils/modelParse.test.ts
+++ b/packages/model-runtime/src/utils/modelParse.test.ts
@@ -1,7 +1,6 @@
+import type { ChatModelCard } from '@lobechat/types';
import { afterEach, describe, expect, it, vi } from 'vitest';
-import type { ChatModelCard } from '@/types/llm';
-
import {
MODEL_LIST_CONFIGS,
MODEL_OWNER_DETECTION_CONFIG,
diff --git a/packages/model-runtime/src/utils/postProcessModelList.test.ts b/packages/model-runtime/src/utils/postProcessModelList.test.ts
index f63a51bf614..9faeace7b6a 100644
--- a/packages/model-runtime/src/utils/postProcessModelList.test.ts
+++ b/packages/model-runtime/src/utils/postProcessModelList.test.ts
@@ -1,8 +1,7 @@
+import type { ChatModelCard } from '@lobechat/types';
import type { AiModelType } from 'model-bank';
import { describe, expect, it, vi } from 'vitest';
-import type { ChatModelCard } from '@/types/llm';
-
import { IMAGE_GENERATION_MODEL_WHITELIST, postProcessModelList } from './postProcessModelList';
// Mock model-bank
diff --git a/packages/model-runtime/src/utils/postProcessModelList.ts b/packages/model-runtime/src/utils/postProcessModelList.ts
index 7a95f8e3e28..7c48a4e543e 100644
--- a/packages/model-runtime/src/utils/postProcessModelList.ts
+++ b/packages/model-runtime/src/utils/postProcessModelList.ts
@@ -1,7 +1,6 @@
+import type { ChatModelCard } from '@lobechat/types';
import { AiModelType, CHAT_MODEL_IMAGE_GENERATION_PARAMS } from 'model-bank';
-import type { ChatModelCard } from '@/types/llm';
-
// Whitelist for automatic image model generation
export const IMAGE_GENERATION_MODEL_WHITELIST = [
'gemini-2.5-flash-image-preview',
diff --git a/packages/model-runtime/src/utils/usageConverter.ts b/packages/model-runtime/src/utils/usageConverter.ts
index d03fe7aee01..a17765730f0 100644
--- a/packages/model-runtime/src/utils/usageConverter.ts
+++ b/packages/model-runtime/src/utils/usageConverter.ts
@@ -1,7 +1,6 @@
+import { ModelTokensUsage } from '@lobechat/types';
import OpenAI from 'openai';
-import { ModelTokensUsage } from '@/types/message';
-
export const convertUsage = (
usage: OpenAI.Completions.CompletionUsage,
provider?: string,
diff --git a/packages/model-runtime/vitest.config.mts b/packages/model-runtime/vitest.config.mts
index e769c7cd856..0a3de8bc107 100644
--- a/packages/model-runtime/vitest.config.mts
+++ b/packages/model-runtime/vitest.config.mts
@@ -4,6 +4,7 @@ import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
alias: {
+ // TODO: 目前仍然残留 ModelRuntime.test.ts 中的部分测试依赖了主项目的内容,后续需要拆分测试
'@': resolve(__dirname, '../../src'),
},
coverage: {