@lobehub/chat 1.86.0 → 1.86.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +3 -3
- package/README.zh-CN.md +3 -3
- package/changelog/v1.json +9 -0
- package/package.json +1 -1
- package/src/app/(backend)/middleware/auth/index.test.ts +1 -1
- package/src/app/(backend)/middleware/auth/index.ts +1 -1
- package/src/app/(backend)/middleware/auth/utils.ts +1 -1
- package/src/app/(backend)/webapi/chat/[provider]/route.test.ts +1 -1
- package/src/app/(backend)/webapi/chat/[provider]/route.ts +1 -1
- package/src/app/(backend)/webapi/chat/vertexai/route.ts +2 -2
- package/src/app/(backend)/webapi/models/[provider]/pull/route.ts +1 -1
- package/src/app/(backend)/webapi/models/[provider]/route.ts +1 -1
- package/src/app/(backend)/webapi/plugin/gateway/route.ts +1 -1
- package/src/app/(backend)/webapi/text-to-image/[provider]/route.ts +2 -2
- package/src/app/[variants]/(main)/settings/llm/ProviderList/Azure/index.tsx +1 -1
- package/src/app/[variants]/(main)/settings/provider/(detail)/azure/page.tsx +1 -1
- package/src/app/[variants]/(main)/settings/provider/(detail)/azureai/page.tsx +1 -1
- package/src/const/settings/llm.ts +1 -1
- package/src/database/models/__tests__/aiProvider.test.ts +1 -1
- package/src/database/models/aiProvider.ts +1 -1
- package/src/features/Conversation/Error/APIKeyForm/Bedrock.tsx +1 -1
- package/src/features/Conversation/Error/APIKeyForm/index.tsx +1 -1
- package/src/features/Conversation/Error/index.tsx +1 -1
- package/src/libs/{agent-runtime → model-runtime}/AgentRuntime.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/ai21/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/ai360/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/anthropic/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/baichuan/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/bedrock/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/cloudflare/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/deepseek/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/fireworksai/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/giteeai/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/github/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/google/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/groq/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/hunyuan/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/internlm/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/lmstudio/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/mistral/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/moonshot/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/novita/index.test.ts +3 -3
- package/src/libs/{agent-runtime → model-runtime}/ollama/index.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/openai/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/openrouter/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/perplexity/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/ppio/index.test.ts +4 -4
- package/src/libs/{agent-runtime → model-runtime}/providerTestUtils.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/qiniu/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/qwen/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/sensenova/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/siliconcloud/index.ts +1 -6
- package/src/libs/{agent-runtime → model-runtime}/spark/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/stepfun/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/taichu/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/tencentcloud/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/togetherai/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/upstage/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/utils/openaiCompatibleFactory/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/utils/openaiHelpers.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/utils/streams/ollama.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/utils/streams/openai.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/utils/streams/qwen.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/wenxin/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/xai/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/zeroone/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/zhipu/index.test.ts +2 -2
- package/src/libs/trpc/client/lambda.ts +1 -1
- package/src/server/globalConfig/_deprecated.test.ts +1 -1
- package/src/server/globalConfig/_deprecated.ts +1 -1
- package/src/server/globalConfig/genServerAiProviderConfig.ts +1 -1
- package/src/server/modules/AgentRuntime/index.test.ts +4 -4
- package/src/server/modules/AgentRuntime/index.ts +1 -1
- package/src/server/modules/AgentRuntime/trace.ts +1 -1
- package/src/server/routers/async/ragEval.ts +1 -1
- package/src/services/__tests__/_auth.test.ts +1 -1
- package/src/services/__tests__/chat.test.ts +3 -3
- package/src/services/_auth.ts +1 -1
- package/src/services/chat.ts +1 -1
- package/src/services/textToImage.ts +1 -1
- package/src/services/upload.ts +1 -1
- package/src/store/user/slices/modelList/action.ts +1 -1
- package/src/types/fetch.ts +1 -1
- package/src/types/message/chat.ts +1 -1
- package/src/types/user/settings/modelProvider.ts +1 -1
- package/src/utils/errorResponse.test.ts +1 -1
- package/src/utils/errorResponse.ts +1 -1
- package/src/utils/fetch/fetchSSE.ts +1 -1
- package/src/utils/genUserLLMConfig.test.ts +1 -1
- package/src/utils/genUserLLMConfig.ts +1 -1
- /package/src/libs/{agent-runtime → model-runtime}/AgentRuntime.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/BaseAI.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/UniformRuntime/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/ai21/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/ai360/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/anthropic/handleAnthropicError.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/anthropic/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/azureOpenai/index.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/azureOpenai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/azureai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/baichuan/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/bedrock/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/cloudflare/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/cohere/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/deepseek/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/error.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/fireworksai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/giteeai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/github/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/google/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/groq/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/helpers/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/helpers/parseToolCalls.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/helpers/parseToolCalls.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/higress/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/huggingface/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/hunyuan/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/infiniai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/internlm/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/jina/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/lmstudio/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/minimax/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/mistral/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/moonshot/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/novita/__snapshots__/index.test.ts.snap +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/novita/fixtures/models.json +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/novita/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/novita/type.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/nvidia/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/ollama/index.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/ollama/type.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/openai/__snapshots__/index.test.ts.snap +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/openai/fixtures/openai-models.json +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/openai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/openrouter/__snapshots__/index.test.ts.snap +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/openrouter/fixtures/frontendModels.json +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/openrouter/fixtures/models.json +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/openrouter/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/openrouter/type.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/perplexity/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/ppio/__snapshots__/index.test.ts.snap +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/ppio/fixtures/models.json +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/ppio/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/ppio/type.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/providerTestUtils.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/qiniu/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/qwen/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/runtimeMap.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/sambanova/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/search1api/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/sensenova/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/spark/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/stepfun/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/taichu/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/tencentcloud/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/togetherai/fixtures/models.json +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/togetherai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/togetherai/type.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/types/chat.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/types/embeddings.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/types/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/types/model.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/types/textToImage.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/types/tts.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/types/type.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/upstage/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/anthropicHelpers.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/anthropicHelpers.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/cloudflareHelpers.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/cloudflareHelpers.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/createError.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/debugStream.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/debugStream.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/desensitizeUrl.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/desensitizeUrl.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/handleOpenAIError.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/openaiCompatibleFactory/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/openaiHelpers.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/response.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/sensenovaHelpers.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/sensenovaHelpers.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/__snapshots__/protocol.test.ts.snap +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/anthropic.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/anthropic.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/bedrock/claude.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/bedrock/common.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/bedrock/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/bedrock/llama.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/bedrock/llama.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/google-ai.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/google-ai.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/model.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/ollama.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/openai.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/protocol.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/protocol.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/qwen.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/spark.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/spark.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/vertex-ai.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/vertex-ai.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/uriParser.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/uriParser.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/usageConverter.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/usageConverter.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/vertexai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/vllm/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/volcengine/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/wenxin/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/xai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/xinference/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/zeroone/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/zhipu/index.ts +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
// @vitest-environment node
|
2
|
-
import { ModelProvider } from '@/libs/
|
3
|
-
import { testProvider } from '@/libs/
|
2
|
+
import { ModelProvider } from '@/libs/model-runtime';
|
3
|
+
import { testProvider } from '@/libs/model-runtime/providerTestUtils';
|
4
4
|
|
5
5
|
import { LobeQwenAI } from './index';
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// @vitest-environment node
|
2
|
-
import { ModelProvider } from '@/libs/
|
3
|
-
import { testProvider } from '@/libs/
|
2
|
+
import { ModelProvider } from '@/libs/model-runtime';
|
3
|
+
import { testProvider } from '@/libs/model-runtime/providerTestUtils';
|
4
4
|
|
5
5
|
import { LobeSenseNovaAI } from './index';
|
6
6
|
|
@@ -89,12 +89,7 @@ export const LobeSiliconCloudAI = LobeOpenAICompatibleFactory({
|
|
89
89
|
'deepseek-ai/deepseek-vl',
|
90
90
|
];
|
91
91
|
|
92
|
-
const reasoningKeywords = [
|
93
|
-
'deepseek-ai/deepseek-r1',
|
94
|
-
'qwen/qvq',
|
95
|
-
'qwen/qwq',
|
96
|
-
'qwen/qwen3',
|
97
|
-
];
|
92
|
+
const reasoningKeywords = ['deepseek-ai/deepseek-r1', 'qwen/qvq', 'qwen/qwq', 'qwen/qwen3'];
|
98
93
|
|
99
94
|
const modelsPage = (await client.models.list()) as any;
|
100
95
|
const modelList: SiliconCloudModelCard[] = modelsPage.data;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// @vitest-environment node
|
2
|
-
import { ModelProvider } from '@/libs/
|
3
|
-
import { testProvider } from '@/libs/
|
2
|
+
import { ModelProvider } from '@/libs/model-runtime';
|
3
|
+
import { testProvider } from '@/libs/model-runtime/providerTestUtils';
|
4
4
|
|
5
5
|
import { LobeSparkAI } from './index';
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// @vitest-environment node
|
2
|
-
import { ModelProvider } from '@/libs/
|
3
|
-
import { testProvider } from '@/libs/
|
2
|
+
import { ModelProvider } from '@/libs/model-runtime';
|
3
|
+
import { testProvider } from '@/libs/model-runtime/providerTestUtils';
|
4
4
|
|
5
5
|
import { LobeStepfunAI } from './index';
|
6
6
|
|
@@ -7,8 +7,8 @@ import {
|
|
7
7
|
LobeMoonshotAI,
|
8
8
|
LobeOpenAICompatibleRuntime,
|
9
9
|
ModelProvider,
|
10
|
-
} from '@/libs/
|
11
|
-
import { testProvider } from '@/libs/
|
10
|
+
} from '@/libs/model-runtime';
|
11
|
+
import { testProvider } from '@/libs/model-runtime/providerTestUtils';
|
12
12
|
|
13
13
|
import * as debugStreamModule from '../utils/debugStream';
|
14
14
|
import { LobeTaichuAI } from './index';
|
package/src/libs/{agent-runtime → model-runtime}/utils/openaiCompatibleFactory/index.test.ts
RENAMED
@@ -9,8 +9,8 @@ import {
|
|
9
9
|
ChatStreamPayload,
|
10
10
|
LobeOpenAICompatibleRuntime,
|
11
11
|
ModelProvider,
|
12
|
-
} from '@/libs/
|
13
|
-
import officalOpenAIModels from '@/libs/
|
12
|
+
} from '@/libs/model-runtime';
|
13
|
+
import officalOpenAIModels from '@/libs/model-runtime/openai/fixtures/openai-models.json';
|
14
14
|
import { sleep } from '@/utils/sleep';
|
15
15
|
|
16
16
|
import * as debugStreamModule from '../debugStream';
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import OpenAI from 'openai';
|
2
2
|
|
3
3
|
import { disableStreamModels, systemToUserModels } from '@/const/models';
|
4
|
-
import { ChatStreamPayload, OpenAIChatMessage } from '@/libs/
|
4
|
+
import { ChatStreamPayload, OpenAIChatMessage } from '@/libs/model-runtime';
|
5
5
|
import { imageUrlToBase64 } from '@/utils/imageToBase64';
|
6
6
|
|
7
7
|
import { parseDataUri } from './uriParser';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { describe, expect, it, vi } from 'vitest';
|
2
2
|
|
3
|
-
import { AgentRuntimeErrorType } from '@/libs/
|
3
|
+
import { AgentRuntimeErrorType } from '@/libs/model-runtime';
|
4
4
|
|
5
5
|
import { OpenAIStream } from './openai';
|
6
6
|
import { FIRST_CHUNK_ERROR_KEY } from './protocol';
|
@@ -365,7 +365,7 @@ describe('transformQwenStream', () => {
|
|
365
365
|
prompt_tokens: 100,
|
366
366
|
total_tokens: 150,
|
367
367
|
completion_tokens_details: {}, // Ensure these exist even if empty
|
368
|
-
prompt_tokens_details: {},
|
368
|
+
prompt_tokens_details: {}, // Ensure these exist even if empty
|
369
369
|
},
|
370
370
|
};
|
371
371
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
// @vitest-environment node
|
2
2
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
3
3
|
|
4
|
-
import { LobeOpenAICompatibleRuntime, ModelProvider } from '@/libs/
|
5
|
-
import { testProvider } from '@/libs/
|
4
|
+
import { LobeOpenAICompatibleRuntime, ModelProvider } from '@/libs/model-runtime';
|
5
|
+
import { testProvider } from '@/libs/model-runtime/providerTestUtils';
|
6
6
|
|
7
7
|
import { LobeWenxinAI } from './index';
|
8
8
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// @vitest-environment node
|
2
|
-
import { ModelProvider } from '@/libs/
|
3
|
-
import { testProvider } from '@/libs/
|
2
|
+
import { ModelProvider } from '@/libs/model-runtime';
|
3
|
+
import { testProvider } from '@/libs/model-runtime/providerTestUtils';
|
4
4
|
|
5
5
|
import { LobeXAI } from './index';
|
6
6
|
|
@@ -2,8 +2,8 @@
|
|
2
2
|
import { OpenAI } from 'openai';
|
3
3
|
import { Mock, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
4
4
|
|
5
|
-
import { ChatStreamCallbacks, LobeOpenAI, LobeOpenAICompatibleRuntime } from '@/libs/
|
6
|
-
import * as debugStreamModule from '@/libs/
|
5
|
+
import { ChatStreamCallbacks, LobeOpenAI, LobeOpenAICompatibleRuntime } from '@/libs/model-runtime';
|
6
|
+
import * as debugStreamModule from '@/libs/model-runtime/utils/debugStream';
|
7
7
|
|
8
8
|
import { LobeZhipuAI } from './index';
|
9
9
|
|
@@ -3,7 +3,7 @@ import { createTRPCReact } from '@trpc/react-query';
|
|
3
3
|
import superjson from 'superjson';
|
4
4
|
|
5
5
|
import { isDesktop } from '@/const/version';
|
6
|
-
import { ModelProvider } from '@/libs/
|
6
|
+
import { ModelProvider } from '@/libs/model-runtime';
|
7
7
|
import type { LambdaRouter } from '@/server/routers/lambda';
|
8
8
|
|
9
9
|
import { ErrorResponse } from './types';
|
@@ -3,7 +3,7 @@ import { describe, expect, it, vi } from 'vitest';
|
|
3
3
|
import { genServerLLMConfig } from './_deprecated';
|
4
4
|
|
5
5
|
// Mock ModelProvider enum
|
6
|
-
vi.mock('@/libs/
|
6
|
+
vi.mock('@/libs/model-runtime', () => ({
|
7
7
|
ModelProvider: {
|
8
8
|
Azure: 'azure',
|
9
9
|
Bedrock: 'bedrock',
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { getLLMConfig } from '@/config/llm';
|
2
2
|
import * as ProviderCards from '@/config/modelProviders';
|
3
|
-
import { ModelProvider } from '@/libs/
|
3
|
+
import { ModelProvider } from '@/libs/model-runtime';
|
4
4
|
import { ModelProviderCard } from '@/types/llm';
|
5
5
|
import { extractEnabledModels, transformToChatModelCards } from '@/utils/_deprecated/parseModels';
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as AiModels from '@/config/aiModels';
|
2
2
|
import { getLLMConfig } from '@/config/llm';
|
3
|
-
import { ModelProvider } from '@/libs/
|
3
|
+
import { ModelProvider } from '@/libs/model-runtime';
|
4
4
|
import { AiFullModelCard } from '@/types/aiModel';
|
5
5
|
import { ProviderConfig } from '@/types/user/settings';
|
6
6
|
import { extractEnabledModels, transformToAiChatModelList } from '@/utils/parseModels';
|
@@ -22,9 +22,9 @@ import {
|
|
22
22
|
LobeZeroOneAI,
|
23
23
|
LobeZhipuAI,
|
24
24
|
ModelProvider,
|
25
|
-
} from '@/libs/
|
26
|
-
import { AgentRuntime } from '@/libs/
|
27
|
-
import { LobeStepfunAI } from '@/libs/
|
25
|
+
} from '@/libs/model-runtime';
|
26
|
+
import { AgentRuntime } from '@/libs/model-runtime';
|
27
|
+
import { LobeStepfunAI } from '@/libs/model-runtime/stepfun';
|
28
28
|
|
29
29
|
import { initAgentRuntimeWithUserPayload } from './index';
|
30
30
|
|
@@ -60,7 +60,7 @@ vi.mock('@/config/llm', () => ({
|
|
60
60
|
|
61
61
|
/**
|
62
62
|
* Test cases for function initAgentRuntimeWithUserPayload
|
63
|
-
* this method will use AgentRuntime from `@/libs/
|
63
|
+
* this method will use AgentRuntime from `@/libs/model-runtime`
|
64
64
|
* and method `getLlmOptionsFromPayload` to initialize runtime
|
65
65
|
* with user payload. Test case below will test both the methods
|
66
66
|
*/
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { getLLMConfig } from '@/config/llm';
|
2
2
|
import { JWTPayload } from '@/const/auth';
|
3
|
-
import { AgentRuntime, ModelProvider } from '@/libs/
|
3
|
+
import { AgentRuntime, ModelProvider } from '@/libs/model-runtime';
|
4
4
|
|
5
5
|
import apiKeyManager from './apiKeyManager';
|
6
6
|
|
@@ -7,7 +7,7 @@ import {
|
|
7
7
|
TracePayload,
|
8
8
|
TraceTagMap,
|
9
9
|
} from '@/const/trace';
|
10
|
-
import { ChatStreamCallbacks, ChatStreamPayload } from '@/libs/
|
10
|
+
import { ChatStreamCallbacks, ChatStreamPayload } from '@/libs/model-runtime';
|
11
11
|
import { TraceClient } from '@/libs/traces';
|
12
12
|
|
13
13
|
export interface AgentChatOptions {
|
@@ -12,7 +12,7 @@ import {
|
|
12
12
|
EvalEvaluationModel,
|
13
13
|
EvaluationRecordModel,
|
14
14
|
} from '@/database/server/models/ragEval';
|
15
|
-
import { ModelProvider } from '@/libs/
|
15
|
+
import { ModelProvider } from '@/libs/model-runtime';
|
16
16
|
import { asyncAuthedProcedure, asyncRouter as router } from '@/libs/trpc/async';
|
17
17
|
import { initAgentRuntimeWithUserPayload } from '@/server/modules/AgentRuntime';
|
18
18
|
import { ChunkService } from '@/server/services/chunk';
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { act } from '@testing-library/react';
|
2
2
|
import { describe, expect, it, vi } from 'vitest';
|
3
3
|
|
4
|
-
import { ModelProvider } from '@/libs/
|
4
|
+
import { ModelProvider } from '@/libs/model-runtime';
|
5
5
|
import { useUserStore } from '@/store/user';
|
6
6
|
import {
|
7
7
|
GlobalLLMProviderKey,
|
@@ -24,8 +24,8 @@ import {
|
|
24
24
|
LobeZeroOneAI,
|
25
25
|
LobeZhipuAI,
|
26
26
|
ModelProvider,
|
27
|
-
} from '@/libs/
|
28
|
-
import { AgentRuntime } from '@/libs/
|
27
|
+
} from '@/libs/model-runtime';
|
28
|
+
import { AgentRuntime } from '@/libs/model-runtime';
|
29
29
|
import { agentChatConfigSelectors } from '@/store/agent/selectors';
|
30
30
|
import { aiModelSelectors } from '@/store/aiInfra';
|
31
31
|
import { useToolStore } from '@/store/tool';
|
@@ -1381,7 +1381,7 @@ describe('AgentRuntimeOnClient', () => {
|
|
1381
1381
|
|
1382
1382
|
it('ZhiPu AI provider: with apiKey', async () => {
|
1383
1383
|
// Mock the generateApiToken function
|
1384
|
-
vi.mock('@/libs/
|
1384
|
+
vi.mock('@/libs/model-runtime/zhipu/authToken', () => ({
|
1385
1385
|
generateApiToken: vi
|
1386
1386
|
.fn()
|
1387
1387
|
.mockResolvedValue(
|
package/src/services/_auth.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { JWTPayload, LOBE_CHAT_AUTH_HEADER } from '@/const/auth';
|
2
2
|
import { isDeprecatedEdition } from '@/const/version';
|
3
|
-
import { ModelProvider } from '@/libs/
|
3
|
+
import { ModelProvider } from '@/libs/model-runtime';
|
4
4
|
import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
|
5
5
|
import { useUserStore } from '@/store/user';
|
6
6
|
import { keyVaultsConfigSelectors, userProfileSelectors } from '@/store/user/selectors';
|
package/src/services/chat.ts
CHANGED
@@ -14,7 +14,7 @@ import {
|
|
14
14
|
AgentRuntimeError,
|
15
15
|
ChatCompletionErrorPayload,
|
16
16
|
ModelProvider,
|
17
|
-
} from '@/libs/
|
17
|
+
} from '@/libs/model-runtime';
|
18
18
|
import { filesPrompts } from '@/prompts/files';
|
19
19
|
import { BuiltinSystemRolePrompts } from '@/prompts/systemRole';
|
20
20
|
import { getAgentStoreState } from '@/store/agent';
|
package/src/services/upload.ts
CHANGED
@@ -3,7 +3,7 @@ import { sha256 } from 'js-sha256';
|
|
3
3
|
|
4
4
|
import { fileEnv } from '@/config/file';
|
5
5
|
import { isDesktop, isServerMode } from '@/const/version';
|
6
|
-
import { parseDataUri } from '@/libs/
|
6
|
+
import { parseDataUri } from '@/libs/model-runtime/utils/uriParser';
|
7
7
|
import { edgeClient } from '@/libs/trpc/client';
|
8
8
|
import { API_ENDPOINTS } from '@/services/_url';
|
9
9
|
import { clientS3Storage } from '@/services/file/ClientS3';
|
@@ -3,7 +3,7 @@ import useSWR, { SWRResponse } from 'swr';
|
|
3
3
|
import type { StateCreator } from 'zustand/vanilla';
|
4
4
|
|
5
5
|
import { DEFAULT_MODEL_PROVIDER_LIST } from '@/config/modelProviders';
|
6
|
-
import { ModelProvider } from '@/libs/
|
6
|
+
import { ModelProvider } from '@/libs/model-runtime';
|
7
7
|
import { UserStore } from '@/store/user';
|
8
8
|
import type { ChatModelCard, ModelProviderCard } from '@/types/llm';
|
9
9
|
import type {
|
package/src/types/fetch.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { IPluginErrorType } from '@lobehub/chat-plugin-sdk';
|
2
2
|
|
3
|
-
import { ILobeAgentRuntimeErrorType } from '@/libs/
|
3
|
+
import { ILobeAgentRuntimeErrorType } from '@/libs/model-runtime';
|
4
4
|
import { ErrorType } from '@/types/fetch';
|
5
5
|
import { MetaData } from '@/types/meta';
|
6
6
|
import { MessageSemanticSearchChunk } from '@/types/rag';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { describe, expect, it, vi } from 'vitest';
|
2
2
|
|
3
|
-
import { AgentRuntimeErrorType } from '@/libs/
|
3
|
+
import { AgentRuntimeErrorType } from '@/libs/model-runtime';
|
4
4
|
import { ChatErrorType } from '@/types/fetch';
|
5
5
|
|
6
6
|
import { createErrorResponse } from './errorResponse';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AgentRuntimeErrorType, ILobeAgentRuntimeErrorType } from '@/libs/
|
1
|
+
import { AgentRuntimeErrorType, ILobeAgentRuntimeErrorType } from '@/libs/model-runtime';
|
2
2
|
import { ChatErrorType, ErrorResponse, ErrorType } from '@/types/fetch';
|
3
3
|
|
4
4
|
const getStatus = (errorType: ILobeAgentRuntimeErrorType | ErrorType) => {
|
@@ -2,7 +2,7 @@ import { isObject } from 'lodash-es';
|
|
2
2
|
|
3
3
|
import { MESSAGE_CANCEL_FLAT } from '@/const/message';
|
4
4
|
import { LOBE_CHAT_OBSERVATION_ID, LOBE_CHAT_TRACE_ID } from '@/const/trace';
|
5
|
-
import { parseToolCalls } from '@/libs/
|
5
|
+
import { parseToolCalls } from '@/libs/model-runtime';
|
6
6
|
import { ChatErrorType } from '@/types/fetch';
|
7
7
|
import { SmoothingParams } from '@/types/llm';
|
8
8
|
import {
|
@@ -5,7 +5,7 @@ import { ModelProviderCard } from '@/types/llm';
|
|
5
5
|
import { genUserLLMConfig } from './genUserLLMConfig';
|
6
6
|
|
7
7
|
// Mock ModelProvider enum
|
8
|
-
vi.mock('@/libs/
|
8
|
+
vi.mock('@/libs/model-runtime', () => ({
|
9
9
|
ModelProvider: {
|
10
10
|
Ollama: 'ollama',
|
11
11
|
OpenAI: 'openai',
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as ProviderCards from '@/config/modelProviders';
|
2
|
-
import { ModelProvider } from '@/libs/
|
2
|
+
import { ModelProvider } from '@/libs/model-runtime';
|
3
3
|
import { ModelProviderCard } from '@/types/llm';
|
4
4
|
import { UserModelProviderConfig } from '@/types/user/settings';
|
5
5
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/package/src/libs/{agent-runtime → model-runtime}/openrouter/__snapshots__/index.test.ts.snap
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|