@lobehub/chat 1.111.6 → 1.111.8
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/.i18nrc.js +1 -1
- package/CHANGELOG.md +50 -0
- 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/locales/ar/chat.json +3 -0
- package/locales/bg-BG/chat.json +3 -0
- package/locales/de-DE/chat.json +3 -0
- package/locales/en-US/chat.json +3 -0
- package/locales/es-ES/chat.json +3 -0
- package/locales/fa-IR/chat.json +3 -0
- package/locales/fr-FR/chat.json +3 -0
- package/locales/it-IT/chat.json +3 -0
- package/locales/ja-JP/chat.json +3 -0
- package/locales/ko-KR/chat.json +3 -0
- package/locales/nl-NL/chat.json +3 -0
- package/locales/pl-PL/chat.json +3 -0
- package/locales/pt-BR/chat.json +3 -0
- package/locales/ru-RU/chat.json +3 -0
- package/locales/tr-TR/chat.json +3 -0
- package/locales/vi-VN/chat.json +3 -0
- package/locales/zh-CN/chat.json +3 -0
- package/locales/zh-TW/chat.json +3 -0
- package/package.json +3 -3
- 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}/azureOpenai/index.ts +22 -5
- 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}/openai/index.ts +4 -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}/types/chat.ts +5 -1
- 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/packages/types/src/agent/chatConfig.ts +6 -0
- package/packages/types/src/aiModel.ts +2 -0
- 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/config/aiModels/aihubmix.ts +10 -12
- package/src/config/aiModels/openai.ts +7 -4
- 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/ChatInput/ActionBar/Model/ControlsForm.tsx +24 -0
- package/src/features/ChatInput/ActionBar/Model/GPT5ReasoningEffortSlider.tsx +58 -0
- package/src/features/ChatInput/ActionBar/Model/TextVerbositySlider.tsx +57 -0
- package/src/features/Conversation/Error/index.tsx +1 -1
- package/src/libs/trpc/client/lambda.ts +1 -1
- package/src/locales/default/chat.ts +3 -0
- 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 +14 -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}/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}/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/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
package/{src/libs/model-runtime → packages/model-runtime/src}/utils/googleErrorParser.test.ts
RENAMED
@@ -1,7 +1,6 @@
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
2
2
|
|
3
3
|
import { AgentRuntimeErrorType } from '../error';
|
4
|
-
|
5
4
|
import {
|
6
5
|
cleanErrorMessage,
|
7
6
|
extractStatusCodeFromError,
|
@@ -35,8 +34,10 @@ describe('googleErrorParser', () => {
|
|
35
34
|
});
|
36
35
|
|
37
36
|
it('should handle combined formatting issues', () => {
|
38
|
-
const input =
|
39
|
-
|
37
|
+
const input =
|
38
|
+
'* API key not valid.\\nPlease check your credentials.\\n\\nContact support if needed. ';
|
39
|
+
const expected =
|
40
|
+
'API key not valid. Please check your credentials. Contact support if needed.';
|
40
41
|
expect(cleanErrorMessage(input)).toBe(expected);
|
41
42
|
});
|
42
43
|
});
|
@@ -45,7 +46,7 @@ describe('googleErrorParser', () => {
|
|
45
46
|
it('should extract status code and message correctly', () => {
|
46
47
|
const input = 'Connection failed [503 Service Unavailable] Please try again later';
|
47
48
|
const result = extractStatusCodeFromError(input);
|
48
|
-
|
49
|
+
|
49
50
|
expect(result.errorDetails).toEqual({
|
50
51
|
message: 'Please try again later',
|
51
52
|
statusCode: 503,
|
@@ -57,7 +58,7 @@ describe('googleErrorParser', () => {
|
|
57
58
|
it('should handle different status codes', () => {
|
58
59
|
const input = 'Request failed [401 Unauthorized] Invalid credentials';
|
59
60
|
const result = extractStatusCodeFromError(input);
|
60
|
-
|
61
|
+
|
61
62
|
expect(result.errorDetails).toEqual({
|
62
63
|
message: 'Invalid credentials',
|
63
64
|
statusCode: 401,
|
@@ -69,7 +70,7 @@ describe('googleErrorParser', () => {
|
|
69
70
|
it('should return null for messages without status codes', () => {
|
70
71
|
const input = 'Simple error message without status code';
|
71
72
|
const result = extractStatusCodeFromError(input);
|
72
|
-
|
73
|
+
|
73
74
|
expect(result.errorDetails).toBeNull();
|
74
75
|
expect(result.prefix).toBe('Simple error message without status code');
|
75
76
|
});
|
@@ -77,7 +78,7 @@ describe('googleErrorParser', () => {
|
|
77
78
|
it('should handle empty message after status code', () => {
|
78
79
|
const input = 'Error [404 Not Found]';
|
79
80
|
const result = extractStatusCodeFromError(input);
|
80
|
-
|
81
|
+
|
81
82
|
expect(result.errorDetails).toEqual({
|
82
83
|
message: '',
|
83
84
|
statusCode: 404,
|
@@ -91,15 +92,16 @@ describe('googleErrorParser', () => {
|
|
91
92
|
it('should handle location not supported error', () => {
|
92
93
|
const input = 'This location is not supported for Google AI services';
|
93
94
|
const result = parseGoogleErrorMessage(input);
|
94
|
-
|
95
|
+
|
95
96
|
expect(result.errorType).toBe(AgentRuntimeErrorType.LocationNotSupportError);
|
96
97
|
expect(result.error.message).toBe(input);
|
97
98
|
});
|
98
99
|
|
99
100
|
it('should handle status JSON format', () => {
|
100
|
-
const input =
|
101
|
+
const input =
|
102
|
+
'got status: UNAVAILABLE. {"error":{"code":503,"message":"Service temporarily unavailable","status":"UNAVAILABLE"}}';
|
101
103
|
const result = parseGoogleErrorMessage(input);
|
102
|
-
|
104
|
+
|
103
105
|
expect(result.errorType).toBe(AgentRuntimeErrorType.ProviderBizError);
|
104
106
|
expect(result.error).toEqual({
|
105
107
|
code: 503,
|
@@ -109,9 +111,10 @@ describe('googleErrorParser', () => {
|
|
109
111
|
});
|
110
112
|
|
111
113
|
it('should handle direct JSON parsing', () => {
|
112
|
-
const input =
|
114
|
+
const input =
|
115
|
+
'{"error":{"code":400,"message":"* API key not valid. Please pass a valid API key.","status":"INVALID_ARGUMENT"}}';
|
113
116
|
const result = parseGoogleErrorMessage(input);
|
114
|
-
|
117
|
+
|
115
118
|
expect(result.errorType).toBe(AgentRuntimeErrorType.InvalidProviderAPIKey);
|
116
119
|
expect(result.error).toEqual({
|
117
120
|
code: 400,
|
@@ -121,9 +124,10 @@ describe('googleErrorParser', () => {
|
|
121
124
|
});
|
122
125
|
|
123
126
|
it('should handle quota limit error', () => {
|
124
|
-
const input =
|
127
|
+
const input =
|
128
|
+
'{"error":{"code":429,"message":"Quota limit reached","status":"RESOURCE_EXHAUSTED"}}';
|
125
129
|
const result = parseGoogleErrorMessage(input);
|
126
|
-
|
130
|
+
|
127
131
|
expect(result.errorType).toBe(AgentRuntimeErrorType.QuotaLimitReached);
|
128
132
|
expect(result.error).toEqual({
|
129
133
|
code: 429,
|
@@ -133,9 +137,10 @@ describe('googleErrorParser', () => {
|
|
133
137
|
});
|
134
138
|
|
135
139
|
it('should handle nested JSON format', () => {
|
136
|
-
const input =
|
140
|
+
const input =
|
141
|
+
'{"error":{"message":"{\\"error\\":{\\"code\\":400,\\"message\\":\\"Invalid request\\"}}"}}';
|
137
142
|
const result = parseGoogleErrorMessage(input);
|
138
|
-
|
143
|
+
|
139
144
|
expect(result.errorType).toBe(AgentRuntimeErrorType.ProviderBizError);
|
140
145
|
expect(result.error).toEqual({
|
141
146
|
code: 400,
|
@@ -145,28 +150,32 @@ describe('googleErrorParser', () => {
|
|
145
150
|
});
|
146
151
|
|
147
152
|
it('should handle array format with API_KEY_INVALID', () => {
|
148
|
-
const input =
|
153
|
+
const input =
|
154
|
+
'Request failed [{"@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "API_KEY_INVALID", "domain": "googleapis.com"}]';
|
149
155
|
const result = parseGoogleErrorMessage(input);
|
150
|
-
|
156
|
+
|
151
157
|
expect(result.errorType).toBe(AgentRuntimeErrorType.InvalidProviderAPIKey);
|
152
158
|
});
|
153
159
|
|
154
160
|
it('should handle array format with other errors', () => {
|
155
|
-
const input =
|
161
|
+
const input =
|
162
|
+
'Request failed [{"@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "QUOTA_EXCEEDED", "domain": "googleapis.com"}]';
|
156
163
|
const result = parseGoogleErrorMessage(input);
|
157
|
-
|
164
|
+
|
158
165
|
expect(result.errorType).toBe(AgentRuntimeErrorType.ProviderBizError);
|
159
|
-
expect(result.error).toEqual([
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
166
|
+
expect(result.error).toEqual([
|
167
|
+
{
|
168
|
+
'@type': 'type.googleapis.com/google.rpc.ErrorInfo',
|
169
|
+
'reason': 'QUOTA_EXCEEDED',
|
170
|
+
'domain': 'googleapis.com',
|
171
|
+
},
|
172
|
+
]);
|
164
173
|
});
|
165
174
|
|
166
175
|
it('should handle status code extraction fallback', () => {
|
167
176
|
const input = 'Connection failed [503 Service Unavailable] Please try again later';
|
168
177
|
const result = parseGoogleErrorMessage(input);
|
169
|
-
|
178
|
+
|
170
179
|
expect(result.errorType).toBe(AgentRuntimeErrorType.ProviderBizError);
|
171
180
|
expect(result.error).toEqual({
|
172
181
|
message: 'Please try again later',
|
@@ -176,17 +185,20 @@ describe('googleErrorParser', () => {
|
|
176
185
|
});
|
177
186
|
|
178
187
|
it('should handle complex nested JSON with message cleaning', () => {
|
179
|
-
const input =
|
188
|
+
const input =
|
189
|
+
'{"error":{"code":400,"message":"* Request contains invalid parameters\\nPlease check the documentation\\n\\nContact support for help"}}';
|
180
190
|
const result = parseGoogleErrorMessage(input);
|
181
|
-
|
191
|
+
|
182
192
|
expect(result.errorType).toBe(AgentRuntimeErrorType.ProviderBizError);
|
183
|
-
expect(result.error.message).toBe(
|
193
|
+
expect(result.error.message).toBe(
|
194
|
+
'Request contains invalid parameters Please check the documentation Contact support for help',
|
195
|
+
);
|
184
196
|
});
|
185
197
|
|
186
198
|
it('should return default error for unparseable messages', () => {
|
187
199
|
const input = 'Some random error message that cannot be parsed';
|
188
200
|
const result = parseGoogleErrorMessage(input);
|
189
|
-
|
201
|
+
|
190
202
|
expect(result.errorType).toBe(AgentRuntimeErrorType.ProviderBizError);
|
191
203
|
expect(result.error.message).toBe(input);
|
192
204
|
});
|
@@ -194,7 +206,7 @@ describe('googleErrorParser', () => {
|
|
194
206
|
it('should handle malformed JSON gracefully', () => {
|
195
207
|
const input = '{"error":{"code":400,"message":"Invalid JSON{incomplete';
|
196
208
|
const result = parseGoogleErrorMessage(input);
|
197
|
-
|
209
|
+
|
198
210
|
expect(result.errorType).toBe(AgentRuntimeErrorType.ProviderBizError);
|
199
211
|
expect(result.error.message).toBe(input);
|
200
212
|
});
|
@@ -202,7 +214,7 @@ describe('googleErrorParser', () => {
|
|
202
214
|
it('should handle empty error object in JSON', () => {
|
203
215
|
const input = '{"error":{}}';
|
204
216
|
const result = parseGoogleErrorMessage(input);
|
205
|
-
|
217
|
+
|
206
218
|
expect(result.errorType).toBe(AgentRuntimeErrorType.ProviderBizError);
|
207
219
|
expect(result.error).toEqual({
|
208
220
|
code: null,
|
@@ -217,9 +229,9 @@ describe('googleErrorParser', () => {
|
|
217
229
|
for (let i = 0; i < 6; i++) {
|
218
230
|
deeplyNested = `{"error":{"message":"${deeplyNested.replaceAll('"', '\\"')}"}}`;
|
219
231
|
}
|
220
|
-
|
232
|
+
|
221
233
|
const result = parseGoogleErrorMessage(deeplyNested);
|
222
|
-
|
234
|
+
|
223
235
|
// Should still return a valid result, but might not reach the deepest level
|
224
236
|
expect(result.errorType).toBe(AgentRuntimeErrorType.ProviderBizError);
|
225
237
|
expect(result.error).toBeDefined();
|
@@ -20,17 +20,19 @@ import {
|
|
20
20
|
import { OpenAIStreamOptions } from './openai';
|
21
21
|
|
22
22
|
const transformOpenAIStream = (
|
23
|
-
chunk:
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
23
|
+
chunk:
|
24
|
+
| OpenAI.Responses.ResponseStreamEvent
|
25
|
+
| {
|
26
|
+
annotation: {
|
27
|
+
end_index: number;
|
28
|
+
start_index: number;
|
29
|
+
title: string;
|
30
|
+
type: 'url_citation';
|
31
|
+
url: string;
|
32
|
+
};
|
33
|
+
item_id: string;
|
34
|
+
type: 'response.output_text.annotation.added';
|
35
|
+
},
|
34
36
|
streamContext: StreamContext,
|
35
37
|
): StreamProtocolChunk | StreamProtocolChunk[] => {
|
36
38
|
// handle the first chunk error
|
@@ -136,7 +138,7 @@ const transformOpenAIStream = (
|
|
136
138
|
data: { citations: streamContext.returnedCitationArray },
|
137
139
|
id: chunk.item.id,
|
138
140
|
type: 'grounding',
|
139
|
-
}
|
141
|
+
};
|
140
142
|
}
|
141
143
|
|
142
144
|
return { data: null, id: chunk.item.id, type: 'text' };
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import OpenAI from 'openai';
|
2
2
|
import { describe, expect, it } from 'vitest';
|
3
3
|
|
4
|
-
import {
|
4
|
+
import { convertResponseUsage, convertUsage } from './usageConverter';
|
5
5
|
|
6
6
|
describe('convertUsage', () => {
|
7
7
|
it('should convert basic OpenAI usage data correctly', () => {
|
@@ -2,7 +2,10 @@ import OpenAI from 'openai';
|
|
2
2
|
|
3
3
|
import { ModelTokensUsage } from '@/types/message';
|
4
4
|
|
5
|
-
export const convertUsage = (
|
5
|
+
export const convertUsage = (
|
6
|
+
usage: OpenAI.Completions.CompletionUsage,
|
7
|
+
provider?: string,
|
8
|
+
): ModelTokensUsage => {
|
6
9
|
// 目前只有 pplx 才有 citation_tokens
|
7
10
|
const inputTextTokens = usage.prompt_tokens || 0;
|
8
11
|
const inputCitationTokens = (usage as any).citation_tokens || 0;
|
@@ -17,11 +20,12 @@ export const convertUsage = (usage: OpenAI.Completions.CompletionUsage, provider
|
|
17
20
|
const totalOutputTokens = usage.completion_tokens;
|
18
21
|
const outputReasoning = usage.completion_tokens_details?.reasoning_tokens || 0;
|
19
22
|
const outputAudioTokens = usage.completion_tokens_details?.audio_tokens || 0;
|
20
|
-
|
23
|
+
|
21
24
|
// XAI 的 completion_tokens 不包含 reasoning_tokens,需要特殊处理
|
22
|
-
const outputTextTokens =
|
23
|
-
|
24
|
-
|
25
|
+
const outputTextTokens =
|
26
|
+
provider === 'xai'
|
27
|
+
? totalOutputTokens - outputAudioTokens
|
28
|
+
: totalOutputTokens - outputReasoning - outputAudioTokens;
|
25
29
|
|
26
30
|
const totalTokens = inputCitationTokens + usage.total_tokens;
|
27
31
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { ModelProvider } from '../types';
|
2
|
-
import { createOpenAICompatibleRuntime } from '../utils/openaiCompatibleFactory';
|
3
2
|
import { MODEL_LIST_CONFIGS, processModelList } from '../utils/modelParse';
|
3
|
+
import { createOpenAICompatibleRuntime } from '../utils/openaiCompatibleFactory';
|
4
4
|
|
5
5
|
const THINKING_MODELS = [
|
6
6
|
'thinking-vision-pro',
|
7
|
-
'thinking-pro-m',
|
7
|
+
'thinking-pro-m',
|
8
8
|
'doubao-seed-1-6',
|
9
|
-
'doubao-1-5-ui-tars'
|
9
|
+
'doubao-1-5-ui-tars',
|
10
10
|
];
|
11
11
|
|
12
12
|
export interface VolcengineModelCard {
|
@@ -24,7 +24,7 @@ export const LobeVolcengineAI = createOpenAICompatibleRuntime({
|
|
24
24
|
model,
|
25
25
|
...(THINKING_MODELS.some((keyword) => model.toLowerCase().includes(keyword))
|
26
26
|
? {
|
27
|
-
thinking: { type: thinking?.type }
|
27
|
+
thinking: { type: thinking?.type },
|
28
28
|
}
|
29
29
|
: {}),
|
30
30
|
} as any;
|
@@ -26,6 +26,11 @@ export interface LobeAgentChatConfig {
|
|
26
26
|
enableReasoningEffort?: boolean;
|
27
27
|
reasoningBudgetToken?: number;
|
28
28
|
reasoningEffort?: 'low' | 'medium' | 'high';
|
29
|
+
gpt5ReasoningEffort?: 'minimal' | 'low' | 'medium' | 'high';
|
30
|
+
/**
|
31
|
+
* 输出文本详细程度控制
|
32
|
+
*/
|
33
|
+
textVerbosity?: 'low' | 'medium' | 'high';
|
29
34
|
thinking?: 'disabled' | 'auto' | 'enabled';
|
30
35
|
thinkingBudget?: number;
|
31
36
|
/**
|
@@ -71,4 +76,5 @@ export const AgentChatConfigSchema = z.object({
|
|
71
76
|
})
|
72
77
|
.optional(),
|
73
78
|
searchMode: z.enum(['off', 'on', 'auto']).optional(),
|
79
|
+
textVerbosity: z.enum(['low', 'medium', 'high']).optional(),
|
74
80
|
});
|
@@ -1,7 +1,7 @@
|
|
1
|
+
import { AgentRuntimeError } from '@lobechat/model-runtime';
|
1
2
|
import { ChatErrorType } from '@lobechat/types';
|
2
3
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
3
4
|
|
4
|
-
import { AgentRuntimeError } from '@/libs/model-runtime';
|
5
5
|
import { createErrorResponse } from '@/utils/errorResponse';
|
6
6
|
import { getXorPayload } from '@/utils/server/xor';
|
7
7
|
|
@@ -1,4 +1,9 @@
|
|
1
1
|
import { AuthObject } from '@clerk/backend';
|
2
|
+
import {
|
3
|
+
AgentRuntimeError,
|
4
|
+
ChatCompletionErrorPayload,
|
5
|
+
ModelRuntime,
|
6
|
+
} from '@lobechat/model-runtime';
|
2
7
|
import { ChatErrorType } from '@lobechat/types';
|
3
8
|
import { NextRequest } from 'next/server';
|
4
9
|
|
@@ -10,7 +15,6 @@ import {
|
|
10
15
|
enableClerk,
|
11
16
|
} from '@/const/auth';
|
12
17
|
import { ClerkAuth } from '@/libs/clerk-auth';
|
13
|
-
import { AgentRuntimeError, ChatCompletionErrorPayload, ModelRuntime } from '@/libs/model-runtime';
|
14
18
|
import { validateOIDCJWT } from '@/libs/oidc-provider/jwt';
|
15
19
|
import { createErrorResponse } from '@/utils/errorResponse';
|
16
20
|
import { getXorPayload } from '@/utils/server/xor';
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { type AuthObject } from '@clerk/backend';
|
2
|
+
import { AgentRuntimeError } from '@lobechat/model-runtime';
|
2
3
|
import { ChatErrorType } from '@lobechat/types';
|
3
4
|
|
4
5
|
import { enableClerk, enableNextAuth } from '@/const/auth';
|
5
6
|
import { getAppConfig } from '@/envs/app';
|
6
|
-
import { AgentRuntimeError } from '@/libs/model-runtime';
|
7
7
|
|
8
8
|
interface CheckAuthParams {
|
9
9
|
accessCode?: string;
|
@@ -1,11 +1,11 @@
|
|
1
1
|
// @vitest-environment node
|
2
2
|
import { getAuth } from '@clerk/nextjs/server';
|
3
|
+
import { LobeRuntimeAI, ModelRuntime } from '@lobechat/model-runtime';
|
3
4
|
import { ChatErrorType } from '@lobechat/types';
|
4
5
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
5
6
|
|
6
7
|
import { checkAuthMethod } from '@/app/(backend)/middleware/auth/utils';
|
7
8
|
import { LOBE_CHAT_AUTH_HEADER, OAUTH_AUTHORIZED } from '@/const/auth';
|
8
|
-
import { LobeRuntimeAI, ModelRuntime } from '@/libs/model-runtime';
|
9
9
|
import { getXorPayload } from '@/utils/server/xor';
|
10
10
|
|
11
11
|
import { POST } from './route';
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import { ChatErrorType } from '@lobechat/types';
|
2
|
-
|
3
|
-
import { checkAuth } from '@/app/(backend)/middleware/auth';
|
4
1
|
import {
|
5
2
|
AGENT_RUNTIME_ERROR_SET,
|
6
3
|
ChatCompletionErrorPayload,
|
7
4
|
ModelRuntime,
|
8
|
-
} from '
|
5
|
+
} from '@lobechat/model-runtime';
|
6
|
+
import { ChatErrorType } from '@lobechat/types';
|
7
|
+
|
8
|
+
import { checkAuth } from '@/app/(backend)/middleware/auth';
|
9
9
|
import { createTraceOptions, initModelRuntimeWithUserPayload } from '@/server/modules/ModelRuntime';
|
10
10
|
import { ChatStreamPayload } from '@/types/openai/chat';
|
11
11
|
import { createErrorResponse } from '@/utils/errorResponse';
|
@@ -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';
|