@lobehub/chat 1.111.5 → 1.111.7
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/.github/workflows/claude-code-review.yml +78 -0
- package/.github/workflows/claude.yml +64 -0
- package/.github/workflows/desktop-pr-build.yml +2 -2
- package/.github/workflows/release-desktop-beta.yml +2 -2
- package/CHANGELOG.md +50 -0
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/changelog/v1.json +18 -0
- package/docker-compose/local/.env.example +1 -0
- package/docker-compose/local/.env.zh-CN.example +1 -0
- package/docker-compose/local/docker-compose.yml +1 -1
- package/docker-compose/local/init_data.json +994 -488
- package/docker-compose/setup.sh +3 -3
- package/package.json +4 -4
- package/packages/model-runtime/package.json +12 -0
- package/{src/libs/model-runtime → packages/model-runtime/src}/anthropic/index.ts +8 -6
- package/{src/libs/model-runtime → packages/model-runtime/src}/google/index.ts +1 -2
- package/{src/libs/model-runtime → packages/model-runtime/src}/minimax/createImage.test.ts +12 -15
- package/{src/libs/model-runtime → packages/model-runtime/src}/minimax/createImage.ts +1 -2
- package/{src/libs/model-runtime → packages/model-runtime/src}/moonshot/index.ts +1 -1
- package/{src/libs/model-runtime → packages/model-runtime/src}/qwen/createImage.ts +5 -5
- package/{src/libs/model-runtime → packages/model-runtime/src}/qwen/index.ts +2 -2
- package/{src/libs/model-runtime → packages/model-runtime/src}/sensenova/index.ts +14 -4
- package/{src/libs/model-runtime → packages/model-runtime/src}/utils/googleErrorParser.test.ts +46 -34
- package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/openai/responsesStream.ts +14 -12
- package/{src/libs/model-runtime → packages/model-runtime/src}/utils/usageConverter.test.ts +1 -1
- package/{src/libs/model-runtime → packages/model-runtime/src}/utils/usageConverter.ts +9 -5
- package/{src/libs/model-runtime → packages/model-runtime/src}/volcengine/index.ts +4 -4
- package/src/app/(backend)/middleware/auth/index.test.ts +1 -1
- package/src/app/(backend)/middleware/auth/index.ts +5 -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 +4 -4
- package/src/app/(backend)/webapi/chat/vertexai/route.ts +2 -1
- 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 +2 -2
- package/src/app/(backend)/webapi/text-to-image/[provider]/route.ts +1 -1
- 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/components/InvalidAPIKey/APIKeyForm/Bedrock.tsx +1 -1
- package/src/components/InvalidAPIKey/APIKeyForm/index.tsx +1 -1
- package/src/const/settings/llm.ts +2 -1
- package/src/database/models/__tests__/aiProvider.test.ts +1 -1
- package/src/database/models/aiProvider.ts +1 -1
- package/src/features/Conversation/Error/index.tsx +1 -1
- package/src/features/Conversation/components/ChatItem/ShareMessageModal/ShareImage/Preview.tsx +55 -48
- package/src/features/Conversation/components/ChatItem/ShareMessageModal/ShareImage/index.tsx +82 -75
- package/src/features/Conversation/components/ChatItem/ShareMessageModal/index.tsx +5 -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 +2 -1
- package/src/server/globalConfig/genServerAiProviderConfig.test.ts +1 -1
- package/src/server/globalConfig/genServerAiProviderConfig.ts +2 -1
- package/src/server/modules/ModelRuntime/index.test.ts +10 -7
- package/src/server/modules/ModelRuntime/index.ts +2 -1
- package/src/server/modules/ModelRuntime/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 +11 -11
- package/src/services/_auth.ts +2 -1
- package/src/services/chat.ts +6 -6
- package/src/services/textToImage.ts +2 -1
- package/src/store/image/slices/generationConfig/initialState.ts +2 -1
- package/src/store/user/slices/modelList/action.ts +1 -1
- package/src/utils/errorResponse.test.ts +1 -2
- package/src/utils/errorResponse.ts +1 -2
- package/src/utils/fetch/fetchSSE.ts +1 -1
- package/src/utils/genUserLLMConfig.test.ts +1 -1
- package/src/utils/genUserLLMConfig.ts +2 -1
- package/tsconfig.json +2 -0
- package/vitest.config.ts +1 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/BaseAI.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/ModelRuntime.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/ModelRuntime.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/RouterRuntime/baseRuntimeMap.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/RouterRuntime/createRuntime.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/RouterRuntime/createRuntime.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/RouterRuntime/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/UniformRuntime/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/ai21/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/ai21/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/ai302/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/ai360/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/ai360/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/aihubmix/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/anthropic/handleAnthropicError.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/anthropic/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/azureOpenai/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/azureOpenai/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/azureai/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/baichuan/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/baichuan/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/bedrock/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/bedrock/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/cloudflare/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/cloudflare/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/cohere/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/deepseek/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/deepseek/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/error.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/fal/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/fal/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/fireworksai/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/fireworksai/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/giteeai/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/giteeai/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/github/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/github/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/google/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/groq/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/groq/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/helpers/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/helpers/parseToolCalls.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/helpers/parseToolCalls.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/higress/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/huggingface/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/hunyuan/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/hunyuan/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/infiniai/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/internlm/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/internlm/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/jina/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/lmstudio/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/lmstudio/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/minimax/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/mistral/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/mistral/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/modelscope/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/moonshot/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/novita/__snapshots__/index.test.ts.snap +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/novita/fixtures/models.json +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/novita/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/novita/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/novita/type.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/nvidia/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/ollama/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/ollama/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/ollama/type.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/openai/__snapshots__/index.test.ts.snap +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/openai/fixtures/openai-models.json +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/openai/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/openai/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/openrouter/__snapshots__/index.test.ts.snap +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/openrouter/fixtures/frontendModels.json +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/openrouter/fixtures/models.json +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/openrouter/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/openrouter/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/openrouter/type.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/perplexity/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/perplexity/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/ppio/__snapshots__/index.test.ts.snap +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/ppio/fixtures/models.json +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/ppio/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/ppio/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/ppio/type.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/providerTestUtils.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/providerTestUtils.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/qiniu/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/qiniu/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/qwen/createImage.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/qwen/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/runtimeMap.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/sambanova/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/search1api/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/sensenova/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/siliconcloud/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/spark/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/spark/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/stepfun/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/stepfun/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/taichu/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/taichu/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/tencentcloud/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/tencentcloud/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/togetherai/fixtures/models.json +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/togetherai/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/togetherai/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/togetherai/type.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/types/chat.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/types/embeddings.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/types/image.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/types/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/types/model.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/types/textToImage.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/types/tts.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/types/type.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/upstage/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/upstage/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/anthropicHelpers.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/anthropicHelpers.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/cloudflareHelpers.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/cloudflareHelpers.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/createError.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/debugStream.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/debugStream.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/desensitizeUrl.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/desensitizeUrl.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/googleErrorParser.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/handleOpenAIError.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/modelParse.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/modelParse.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/openaiCompatibleFactory/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/openaiCompatibleFactory/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/openaiHelpers.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/openaiHelpers.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/response.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/sensenovaHelpers.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/sensenovaHelpers.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/__snapshots__/protocol.test.ts.snap +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/anthropic.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/anthropic.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/bedrock/claude.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/bedrock/common.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/bedrock/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/bedrock/llama.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/bedrock/llama.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/google-ai.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/google-ai.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/model.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/ollama.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/ollama.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/openai/__snapshots__/responsesStream.test.ts.snap +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/openai/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/openai/openai.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/openai/openai.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/openai/responsesStream.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/protocol.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/protocol.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/qwen.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/qwen.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/spark.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/spark.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/utils.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/vertex-ai.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/streams/vertex-ai.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/uriParser.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/utils/uriParser.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/v0/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/vertexai/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/vllm/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/wenxin/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/wenxin/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/xai/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/xai/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/xinference/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/zeroone/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/zeroone/index.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/zhipu/index.test.ts +0 -0
- /package/{src/libs/model-runtime → packages/model-runtime/src}/zhipu/index.ts +0 -0
@@ -1,5 +1,6 @@
|
|
1
|
+
import { ModelProvider, ModelRuntime } from '@lobechat/model-runtime';
|
2
|
+
|
1
3
|
import { checkAuth } from '@/app/(backend)/middleware/auth';
|
2
|
-
import { ModelProvider, ModelRuntime } from '@/libs/model-runtime';
|
3
4
|
import { LobeVertexAI } from '@/libs/model-runtime/vertexai';
|
4
5
|
import { safeParseJSON } from '@/utils/safeParseJSON';
|
5
6
|
|
@@ -1,7 +1,7 @@
|
|
1
|
+
import { ChatCompletionErrorPayload, PullModelParams } from '@lobechat/model-runtime';
|
1
2
|
import { ChatErrorType } from '@lobechat/types';
|
2
3
|
|
3
4
|
import { checkAuth } from '@/app/(backend)/middleware/auth';
|
4
|
-
import { ChatCompletionErrorPayload, PullModelParams } from '@/libs/model-runtime';
|
5
5
|
import { initModelRuntimeWithUserPayload } from '@/server/modules/ModelRuntime';
|
6
6
|
import { createErrorResponse } from '@/utils/errorResponse';
|
7
7
|
|
@@ -1,8 +1,8 @@
|
|
1
|
+
import { ChatCompletionErrorPayload, ModelProvider } from '@lobechat/model-runtime';
|
1
2
|
import { ChatErrorType } from '@lobechat/types';
|
2
3
|
import { NextResponse } from 'next/server';
|
3
4
|
|
4
5
|
import { checkAuth } from '@/app/(backend)/middleware/auth';
|
5
|
-
import { ChatCompletionErrorPayload, ModelProvider } from '@/libs/model-runtime';
|
6
6
|
import { initModelRuntimeWithUserPayload } from '@/server/modules/ModelRuntime';
|
7
7
|
import { createErrorResponse } from '@/utils/errorResponse';
|
8
8
|
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import {
|
1
|
+
import { AgentRuntimeError } from '@lobechat/model-runtime';
|
2
|
+
import { ChatErrorType, ErrorType, TraceNameMap } from '@lobechat/types';
|
2
3
|
import { PluginRequestPayload } from '@lobehub/chat-plugin-sdk';
|
3
4
|
import { createGatewayOnEdgeRuntime } from '@lobehub/chat-plugins-gateway';
|
4
5
|
|
5
6
|
import { LOBE_CHAT_AUTH_HEADER, OAUTH_AUTHORIZED, enableNextAuth } from '@/const/auth';
|
6
7
|
import { LOBE_CHAT_TRACE_ID } from '@/const/trace';
|
7
8
|
import { getAppConfig } from '@/envs/app';
|
8
|
-
import { AgentRuntimeError } from '@/libs/model-runtime';
|
9
9
|
import { TraceClient } from '@/libs/traces';
|
10
10
|
import { createErrorResponse } from '@/utils/errorResponse';
|
11
11
|
import { getXorPayload } from '@/utils/server/xor';
|
@@ -1,8 +1,8 @@
|
|
1
|
+
import { ChatCompletionErrorPayload } from '@lobechat/model-runtime';
|
1
2
|
import { ChatErrorType } from '@lobechat/types';
|
2
3
|
import { NextResponse } from 'next/server';
|
3
4
|
|
4
5
|
import { checkAuth } from '@/app/(backend)/middleware/auth';
|
5
|
-
import { ChatCompletionErrorPayload } from '@/libs/model-runtime';
|
6
6
|
import { TextToImagePayload } from '@/libs/model-runtime/types';
|
7
7
|
import { initModelRuntimeWithUserPayload } from '@/server/modules/ModelRuntime';
|
8
8
|
import { createErrorResponse } from '@/utils/errorResponse';
|
@@ -1,11 +1,11 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
|
+
import { ModelProvider } from '@lobechat/model-runtime';
|
3
4
|
import { AutoComplete, Input, InputPassword, Markdown } from '@lobehub/ui';
|
4
5
|
import { createStyles } from 'antd-style';
|
5
6
|
import { useTranslation } from 'react-i18next';
|
6
7
|
|
7
8
|
import { AzureProviderCard } from '@/config/modelProviders';
|
8
|
-
import { ModelProvider } from '@/libs/model-runtime';
|
9
9
|
import { useUserStore } from '@/store/user';
|
10
10
|
import { modelProviderSelectors } from '@/store/user/selectors';
|
11
11
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
|
+
import { ModelProvider } from '@lobechat/model-runtime';
|
3
4
|
import { AutoComplete, Markdown } from '@lobehub/ui';
|
4
5
|
import { createStyles } from 'antd-style';
|
5
6
|
import { useTranslation } from 'react-i18next';
|
6
7
|
|
7
8
|
import { FormInput, FormPassword } from '@/components/FormInput';
|
8
9
|
import { AzureProviderCard } from '@/config/modelProviders';
|
9
|
-
import { ModelProvider } from '@/libs/model-runtime';
|
10
10
|
import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
|
11
11
|
import { useUserStore } from '@/store/user';
|
12
12
|
import { modelProviderSelectors } from '@/store/user/selectors';
|
@@ -1,10 +1,10 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
|
+
import { ModelProvider } from '@lobechat/model-runtime';
|
3
4
|
import { useTranslation } from 'react-i18next';
|
4
5
|
|
5
6
|
import { FormInput, FormPassword } from '@/components/FormInput';
|
6
7
|
import { AzureAIProviderCard } from '@/config/modelProviders';
|
7
|
-
import { ModelProvider } from '@/libs/model-runtime';
|
8
8
|
import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
|
9
9
|
|
10
10
|
import { KeyVaultsConfigKey, LLMProviderApiTokenKey, LLMProviderBaseUrlKey } from '../../const';
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { ModelProvider } from '@lobechat/model-runtime';
|
1
2
|
import { Aws } from '@lobehub/icons';
|
2
3
|
import { Button, Icon, InputPassword, Select } from '@lobehub/ui';
|
3
4
|
import { useTheme } from 'antd-style';
|
@@ -6,7 +7,6 @@ import { memo, useState } from 'react';
|
|
6
7
|
import { useTranslation } from 'react-i18next';
|
7
8
|
|
8
9
|
import { FormAction } from '@/features/Conversation/Error/style';
|
9
|
-
import { ModelProvider } from '@/libs/model-runtime';
|
10
10
|
import { useUserStore } from '@/store/user';
|
11
11
|
import { keyVaultsConfigSelectors } from '@/store/user/selectors';
|
12
12
|
|
@@ -1,10 +1,10 @@
|
|
1
|
+
import { ModelProvider } from '@lobechat/model-runtime';
|
1
2
|
import { ProviderIcon } from '@lobehub/icons';
|
2
3
|
import { Button } from '@lobehub/ui';
|
3
4
|
import { memo, useMemo, useState } from 'react';
|
4
5
|
import { useTranslation } from 'react-i18next';
|
5
6
|
import { Center, Flexbox } from 'react-layout-kit';
|
6
7
|
|
7
|
-
import { ModelProvider } from '@/libs/model-runtime';
|
8
8
|
import { GlobalLLMProviderKey } from '@/types/user/settings';
|
9
9
|
|
10
10
|
import BedrockForm from './Bedrock';
|
@@ -1,9 +1,9 @@
|
|
1
1
|
// @vitest-environment node
|
2
|
+
import { ModelProvider } from '@lobechat/model-runtime';
|
2
3
|
import { eq } from 'drizzle-orm';
|
3
4
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
4
5
|
|
5
6
|
import { LobeChatDatabase } from '@/database/type';
|
6
|
-
import { ModelProvider } from '@/libs/model-runtime';
|
7
7
|
import { sleep } from '@/utils/sleep';
|
8
8
|
|
9
9
|
import { aiProviders, users } from '../../schemas';
|
@@ -1,9 +1,9 @@
|
|
1
|
+
import { ModelProvider } from '@lobechat/model-runtime';
|
1
2
|
import { and, asc, desc, eq } from 'drizzle-orm';
|
2
3
|
import { isEmpty } from 'lodash-es';
|
3
4
|
|
4
5
|
import { DEFAULT_MODEL_PROVIDER_LIST } from '@/config/modelProviders';
|
5
6
|
import { LobeChatDatabase } from '@/database/type';
|
6
|
-
import { ModelProvider } from '@/libs/model-runtime';
|
7
7
|
import {
|
8
8
|
AiProviderDetailItem,
|
9
9
|
AiProviderListItem,
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { AgentRuntimeErrorType, ILobeAgentRuntimeErrorType } from '@lobechat/model-runtime';
|
1
2
|
import { ChatErrorType, ErrorType } from '@lobechat/types';
|
2
3
|
import { IPluginErrorType } from '@lobehub/chat-plugin-sdk';
|
3
4
|
import type { AlertProps } from '@lobehub/ui';
|
@@ -7,7 +8,6 @@ import { Suspense, memo, useMemo } from 'react';
|
|
7
8
|
import { useTranslation } from 'react-i18next';
|
8
9
|
|
9
10
|
import { useProviderName } from '@/hooks/useProviderName';
|
10
|
-
import { AgentRuntimeErrorType, ILobeAgentRuntimeErrorType } from '@/libs/model-runtime';
|
11
11
|
import { ChatMessage, ChatMessageError } from '@/types/message';
|
12
12
|
|
13
13
|
import ChatInvalidAPIKey from './ChatInvalidApiKey';
|
package/src/features/Conversation/components/ChatItem/ShareMessageModal/ShareImage/Preview.tsx
CHANGED
@@ -21,63 +21,70 @@ import { FieldType } from './type';
|
|
21
21
|
|
22
22
|
interface PreviewProps extends FieldType {
|
23
23
|
message: ChatMessage;
|
24
|
+
previewId?: string;
|
24
25
|
title?: string;
|
25
26
|
}
|
26
27
|
|
27
|
-
const Preview = memo<PreviewProps>(
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
const Preview = memo<PreviewProps>(
|
29
|
+
({ title, withBackground, withFooter, message, previewId = 'preview' }) => {
|
30
|
+
const [model, plugins] = useAgentStore((s) => [
|
31
|
+
agentSelectors.currentAgentModel(s),
|
32
|
+
agentSelectors.currentAgentPlugins(s),
|
33
|
+
]);
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
const [isInbox, description, avatar, backgroundColor] = useSessionStore((s) => [
|
36
|
+
sessionSelectors.isInboxSession(s),
|
37
|
+
sessionMetaSelectors.currentAgentDescription(s),
|
38
|
+
sessionMetaSelectors.currentAgentAvatar(s),
|
39
|
+
sessionMetaSelectors.currentAgentBackgroundColor(s),
|
40
|
+
]);
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
42
|
+
const { t } = useTranslation('chat');
|
43
|
+
const { styles } = useStyles(withBackground);
|
44
|
+
const { styles: containerStyles } = useContainerStyles();
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
+
const displayTitle = isInbox ? t('inbox.title') : title;
|
47
|
+
const displayDesc = isInbox ? t('inbox.desc') : description;
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
49
|
+
return (
|
50
|
+
<div className={containerStyles.preview}>
|
51
|
+
<div className={withBackground ? styles.background : undefined} id={previewId}>
|
52
|
+
<Flexbox className={styles.container} gap={16}>
|
53
|
+
<div className={styles.header}>
|
54
|
+
<Flexbox align={'flex-start'} gap={12} horizontal>
|
55
|
+
<Avatar avatar={avatar} background={backgroundColor} size={40} title={title} />
|
56
|
+
<ChatHeaderTitle
|
57
|
+
desc={displayDesc}
|
58
|
+
tag={
|
59
|
+
<Flexbox gap={4} horizontal>
|
60
|
+
<ModelTag model={model} />
|
61
|
+
{plugins?.length > 0 && <PluginTag plugins={plugins} />}
|
62
|
+
</Flexbox>
|
63
|
+
}
|
64
|
+
title={displayTitle}
|
65
|
+
/>
|
66
|
+
</Flexbox>
|
67
|
+
</div>
|
68
|
+
<Flexbox
|
69
|
+
height={'100%'}
|
70
|
+
style={{ paddingTop: 24, position: 'relative' }}
|
71
|
+
width={'100%'}
|
72
|
+
>
|
73
|
+
<ChatItem id={message.id} index={0} />
|
64
74
|
</Flexbox>
|
65
|
-
|
66
|
-
|
67
|
-
|
75
|
+
{withFooter ? (
|
76
|
+
<Flexbox align={'center'} className={styles.footer} gap={4}>
|
77
|
+
<ProductLogo type={'combine'} />
|
78
|
+
<div className={styles.url}>{pkg.homepage}</div>
|
79
|
+
</Flexbox>
|
80
|
+
) : (
|
81
|
+
<div />
|
82
|
+
)}
|
68
83
|
</Flexbox>
|
69
|
-
|
70
|
-
<Flexbox align={'center'} className={styles.footer} gap={4}>
|
71
|
-
<ProductLogo type={'combine'} />
|
72
|
-
<div className={styles.url}>{pkg.homepage}</div>
|
73
|
-
</Flexbox>
|
74
|
-
) : (
|
75
|
-
<div />
|
76
|
-
)}
|
77
|
-
</Flexbox>
|
84
|
+
</div>
|
78
85
|
</div>
|
79
|
-
|
80
|
-
|
81
|
-
|
86
|
+
);
|
87
|
+
},
|
88
|
+
);
|
82
89
|
|
83
90
|
export default Preview;
|
package/src/features/Conversation/components/ChatItem/ShareMessageModal/ShareImage/index.tsx
CHANGED
@@ -23,84 +23,91 @@ const DEFAULT_FIELD_VALUE: FieldType = {
|
|
23
23
|
withFooter: true,
|
24
24
|
};
|
25
25
|
|
26
|
-
const ShareImage = memo<{ message: ChatMessage; mobile?: boolean }>(
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
imageType: fieldValue.imageType,
|
33
|
-
title: currentAgentTitle,
|
34
|
-
});
|
35
|
-
const { loading: copyLoading, onCopy } = useImgToClipboard();
|
36
|
-
const settings: FormItemProps[] = [
|
37
|
-
{
|
38
|
-
children: <Switch />,
|
39
|
-
label: t('shareModal.withBackground'),
|
40
|
-
layout: 'horizontal',
|
41
|
-
minWidth: undefined,
|
42
|
-
name: 'withBackground',
|
43
|
-
valuePropName: 'checked',
|
44
|
-
},
|
45
|
-
{
|
46
|
-
children: <Switch />,
|
47
|
-
label: t('shareModal.withFooter'),
|
48
|
-
layout: 'horizontal',
|
49
|
-
minWidth: undefined,
|
50
|
-
name: 'withFooter',
|
51
|
-
valuePropName: 'checked',
|
52
|
-
},
|
53
|
-
{
|
54
|
-
children: <Segmented options={imageTypeOptions} />,
|
55
|
-
label: t('shareModal.imageType'),
|
56
|
-
layout: 'horizontal',
|
57
|
-
minWidth: undefined,
|
58
|
-
name: 'imageType',
|
59
|
-
},
|
60
|
-
];
|
26
|
+
const ShareImage = memo<{ message: ChatMessage; mobile?: boolean; uniqueId?: string }>(
|
27
|
+
({ message, uniqueId }) => {
|
28
|
+
const currentAgentTitle = useSessionStore(sessionMetaSelectors.currentAgentTitle);
|
29
|
+
const [fieldValue, setFieldValue] = useState<FieldType>(DEFAULT_FIELD_VALUE);
|
30
|
+
const { t } = useTranslation(['chat', 'common']);
|
31
|
+
const { styles } = useStyles();
|
61
32
|
|
62
|
-
|
33
|
+
// 生成唯一的预览ID,避免DOM冲突
|
34
|
+
const previewId = uniqueId ? `preview-${uniqueId}` : 'preview';
|
63
35
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
36
|
+
const { loading, onDownload, title } = useScreenshot({
|
37
|
+
id: `#${previewId}`,
|
38
|
+
imageType: fieldValue.imageType,
|
39
|
+
title: currentAgentTitle,
|
40
|
+
});
|
41
|
+
const { loading: copyLoading, onCopy } = useImgToClipboard({ id: `#${previewId}` });
|
42
|
+
const settings: FormItemProps[] = [
|
43
|
+
{
|
44
|
+
children: <Switch />,
|
45
|
+
label: t('shareModal.withBackground'),
|
46
|
+
layout: 'horizontal',
|
47
|
+
minWidth: undefined,
|
48
|
+
name: 'withBackground',
|
49
|
+
valuePropName: 'checked',
|
50
|
+
},
|
51
|
+
{
|
52
|
+
children: <Switch />,
|
53
|
+
label: t('shareModal.withFooter'),
|
54
|
+
layout: 'horizontal',
|
55
|
+
minWidth: undefined,
|
56
|
+
name: 'withFooter',
|
57
|
+
valuePropName: 'checked',
|
58
|
+
},
|
59
|
+
{
|
60
|
+
children: <Segmented options={imageTypeOptions} />,
|
61
|
+
label: t('shareModal.imageType'),
|
62
|
+
layout: 'horizontal',
|
63
|
+
minWidth: undefined,
|
64
|
+
name: 'imageType',
|
65
|
+
},
|
66
|
+
];
|
81
67
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
<
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
{
|
95
|
-
</
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
68
|
+
const isMobile = useIsMobile();
|
69
|
+
|
70
|
+
const button = (
|
71
|
+
<>
|
72
|
+
<Button
|
73
|
+
block
|
74
|
+
icon={CopyIcon}
|
75
|
+
loading={copyLoading}
|
76
|
+
onClick={() => onCopy()}
|
77
|
+
size={isMobile ? undefined : 'large'}
|
78
|
+
type={'primary'}
|
79
|
+
>
|
80
|
+
{t('copy', { ns: 'common' })}
|
81
|
+
</Button>
|
82
|
+
<Button block loading={loading} onClick={onDownload} size={isMobile ? undefined : 'large'}>
|
83
|
+
{t('shareModal.download')}
|
84
|
+
</Button>
|
85
|
+
</>
|
86
|
+
);
|
87
|
+
|
88
|
+
return (
|
89
|
+
<>
|
90
|
+
<Flexbox className={styles.body} gap={16} horizontal={!isMobile}>
|
91
|
+
<Preview title={title} {...fieldValue} message={message} previewId={previewId} />
|
92
|
+
<Flexbox className={styles.sidebar} gap={12}>
|
93
|
+
<Form
|
94
|
+
initialValues={DEFAULT_FIELD_VALUE}
|
95
|
+
items={settings}
|
96
|
+
itemsType={'flat'}
|
97
|
+
onValuesChange={(_, v) => setFieldValue(v)}
|
98
|
+
{...FORM_STYLE}
|
99
|
+
/>
|
100
|
+
{!isMobile && button}
|
101
|
+
</Flexbox>
|
100
102
|
</Flexbox>
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
103
|
+
{isMobile && (
|
104
|
+
<Flexbox className={styles.footer} gap={8} horizontal>
|
105
|
+
{button}
|
106
|
+
</Flexbox>
|
107
|
+
)}
|
108
|
+
</>
|
109
|
+
);
|
110
|
+
},
|
111
|
+
);
|
105
112
|
|
106
113
|
export default ShareImage;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Modal, Segmented, type SegmentedProps } from '@lobehub/ui';
|
2
|
-
import { memo, useMemo, useState } from 'react';
|
2
|
+
import { memo, useId, useMemo, useState } from 'react';
|
3
3
|
import { useTranslation } from 'react-i18next';
|
4
4
|
import { Flexbox } from 'react-layout-kit';
|
5
5
|
|
@@ -23,6 +23,7 @@ interface ShareModalProps {
|
|
23
23
|
const ShareModal = memo<ShareModalProps>(({ onCancel, open, message }) => {
|
24
24
|
const [tab, setTab] = useState<Tab>(Tab.Screenshot);
|
25
25
|
const { t } = useTranslation('chat');
|
26
|
+
const uniqueId = useId();
|
26
27
|
|
27
28
|
const options: SegmentedProps['options'] = useMemo(
|
28
29
|
() => [
|
@@ -58,7 +59,9 @@ const ShareModal = memo<ShareModalProps>(({ onCancel, open, message }) => {
|
|
58
59
|
value={tab}
|
59
60
|
variant={'filled'}
|
60
61
|
/>
|
61
|
-
{tab === Tab.Screenshot &&
|
62
|
+
{tab === Tab.Screenshot && (
|
63
|
+
<ShareImage message={message} mobile={isMobile} uniqueId={uniqueId} />
|
64
|
+
)}
|
62
65
|
{tab === Tab.Text && <ShareText item={message} />}
|
63
66
|
</Flexbox>
|
64
67
|
</Modal>
|
@@ -1,10 +1,10 @@
|
|
1
|
+
import { ModelProvider } from '@lobechat/model-runtime';
|
1
2
|
import { createTRPCClient, httpBatchLink } from '@trpc/client';
|
2
3
|
import { createTRPCReact } from '@trpc/react-query';
|
3
4
|
import debug from 'debug';
|
4
5
|
import superjson from 'superjson';
|
5
6
|
|
6
7
|
import { isDesktop } from '@/const/version';
|
7
|
-
import { ModelProvider } from '@/libs/model-runtime';
|
8
8
|
import type { LambdaRouter } from '@/server/routers/lambda';
|
9
9
|
|
10
10
|
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('
|
6
|
+
vi.mock('@lobechat/model-runtime', () => ({
|
7
7
|
ModelProvider: {
|
8
8
|
Azure: 'azure',
|
9
9
|
Bedrock: 'bedrock',
|
@@ -1,6 +1,7 @@
|
|
1
|
+
import { ModelProvider } from '@lobechat/model-runtime';
|
2
|
+
|
1
3
|
import { getLLMConfig } from '@/config/llm';
|
2
4
|
import * as ProviderCards from '@/config/modelProviders';
|
3
|
-
import { ModelProvider } from '@/libs/model-runtime';
|
4
5
|
import { ModelProviderCard } from '@/types/llm';
|
5
6
|
import { extractEnabledModels, transformToChatModelCards } from '@/utils/_deprecated/parseModels';
|
6
7
|
|
@@ -212,7 +212,7 @@ describe('genServerAiProvidersConfig Error Handling', () => {
|
|
212
212
|
}));
|
213
213
|
|
214
214
|
// Mock ModelProvider to include the missing provider
|
215
|
-
vi.doMock('
|
215
|
+
vi.doMock('@lobechat/model-runtime', () => ({
|
216
216
|
ModelProvider: {
|
217
217
|
openai: 'openai', // This exists in enum
|
218
218
|
anthropic: 'anthropic', // This exists in both enum and aiModels
|
@@ -1,6 +1,7 @@
|
|
1
|
+
import { ModelProvider } from '@lobechat/model-runtime';
|
2
|
+
|
1
3
|
import * as AiModels from '@/config/aiModels';
|
2
4
|
import { getLLMConfig } from '@/config/llm';
|
3
|
-
import { ModelProvider } from '@/libs/model-runtime';
|
4
5
|
import { AiFullModelCard } from '@/types/aiModel';
|
5
6
|
import { ProviderConfig } from '@/types/user/settings';
|
6
7
|
import { extractEnabledModels, transformToAiModelList } from '@/utils/parseModels';
|
@@ -1,7 +1,4 @@
|
|
1
1
|
// @vitest-environment node
|
2
|
-
import { describe, expect, it, vi } from 'vitest';
|
3
|
-
|
4
|
-
import { ClientSecretPayload } from '@/const/auth';
|
5
2
|
import {
|
6
3
|
LobeAnthropicAI,
|
7
4
|
LobeAzureOpenAI,
|
@@ -22,8 +19,11 @@ import {
|
|
22
19
|
LobeZeroOneAI,
|
23
20
|
LobeZhipuAI,
|
24
21
|
ModelProvider,
|
25
|
-
} from '
|
26
|
-
import { ModelRuntime } from '
|
22
|
+
} from '@lobechat/model-runtime';
|
23
|
+
import { ModelRuntime } from '@lobechat/model-runtime';
|
24
|
+
import { describe, expect, it, vi } from 'vitest';
|
25
|
+
|
26
|
+
import { ClientSecretPayload } from '@/const/auth';
|
27
27
|
import { LobeStepfunAI } from '@/libs/model-runtime/stepfun';
|
28
28
|
|
29
29
|
import { initModelRuntimeWithUserPayload } from './index';
|
@@ -60,14 +60,17 @@ vi.mock('@/config/llm', () => ({
|
|
60
60
|
|
61
61
|
/**
|
62
62
|
* Test cases for function initModelRuntimeWithUserPayload
|
63
|
-
* this method will use ModelRuntime from
|
63
|
+
* this method will use ModelRuntime from `@lobechat/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
|
*/
|
67
67
|
describe('initModelRuntimeWithUserPayload method', () => {
|
68
68
|
describe('should initialize with options correctly', () => {
|
69
69
|
it('OpenAI provider: with apikey and endpoint', async () => {
|
70
|
-
const jwtPayload: ClientSecretPayload = {
|
70
|
+
const jwtPayload: ClientSecretPayload = {
|
71
|
+
apiKey: 'user-openai-key',
|
72
|
+
baseURL: 'user-endpoint',
|
73
|
+
};
|
71
74
|
const runtime = await initModelRuntimeWithUserPayload(ModelProvider.OpenAI, jwtPayload);
|
72
75
|
expect(runtime).toBeInstanceOf(ModelRuntime);
|
73
76
|
expect(runtime['_runtime']).toBeInstanceOf(LobeOpenAI);
|
@@ -1,6 +1,7 @@
|
|
1
|
+
import { ModelProvider, ModelRuntime } from '@lobechat/model-runtime';
|
2
|
+
|
1
3
|
import { getLLMConfig } from '@/config/llm';
|
2
4
|
import { ClientSecretPayload } from '@/const/auth';
|
3
|
-
import { ModelProvider, ModelRuntime } from '@/libs/model-runtime';
|
4
5
|
|
5
6
|
import apiKeyManager from './apiKeyManager';
|
6
7
|
|
@@ -1,9 +1,9 @@
|
|
1
|
+
import { ChatStreamCallbacks, ChatStreamPayload } from '@lobechat/model-runtime';
|
1
2
|
import { TracePayload, TraceTagMap } from '@lobechat/types';
|
2
3
|
import { after } from 'next/server';
|
3
4
|
|
4
5
|
import { INBOX_SESSION_ID } from '@/const/session';
|
5
6
|
import { LOBE_CHAT_OBSERVATION_ID, LOBE_CHAT_TRACE_ID } from '@/const/trace';
|
6
|
-
import { ChatStreamCallbacks, ChatStreamPayload } from '@/libs/model-runtime';
|
7
7
|
import { TraceClient } from '@/libs/traces';
|
8
8
|
|
9
9
|
export interface AgentChatOptions {
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { ModelProvider } from '@lobechat/model-runtime';
|
1
2
|
import { TRPCError } from '@trpc/server';
|
2
3
|
import OpenAI from 'openai';
|
3
4
|
import { z } from 'zod';
|
@@ -12,7 +13,6 @@ import {
|
|
12
13
|
EvalEvaluationModel,
|
13
14
|
EvaluationRecordModel,
|
14
15
|
} from '@/database/server/models/ragEval';
|
15
|
-
import { ModelProvider } from '@/libs/model-runtime';
|
16
16
|
import { asyncAuthedProcedure, asyncRouter as router } from '@/libs/trpc/async';
|
17
17
|
import { initModelRuntimeWithUserPayload } from '@/server/modules/ModelRuntime';
|
18
18
|
import { ChunkService } from '@/server/services/chunk';
|
@@ -1,7 +1,7 @@
|
|
1
|
+
import { ModelProvider } from '@lobechat/model-runtime';
|
1
2
|
import { act } from '@testing-library/react';
|
2
3
|
import { describe, expect, it, vi } from 'vitest';
|
3
4
|
|
4
|
-
import { ModelProvider } from '@/libs/model-runtime';
|
5
5
|
import { useUserStore } from '@/store/user';
|
6
6
|
import {
|
7
7
|
GlobalLLMProviderKey,
|