@lobehub/chat 1.43.6 → 1.44.0
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/changelog/v1.json +9 -0
- package/docs/self-hosting/server-database/docker-compose.mdx +2 -2
- package/locales/ar/common.json +1 -0
- package/locales/ar/modelProvider.json +176 -0
- package/locales/ar/setting.json +1 -0
- package/locales/bg-BG/common.json +1 -0
- package/locales/bg-BG/modelProvider.json +176 -0
- package/locales/bg-BG/setting.json +1 -0
- package/locales/de-DE/common.json +1 -0
- package/locales/de-DE/modelProvider.json +176 -0
- package/locales/de-DE/setting.json +1 -0
- package/locales/en-US/common.json +1 -0
- package/locales/en-US/modelProvider.json +176 -0
- package/locales/en-US/setting.json +1 -0
- package/locales/es-ES/common.json +1 -0
- package/locales/es-ES/modelProvider.json +176 -0
- package/locales/es-ES/setting.json +1 -0
- package/locales/fa-IR/common.json +1 -0
- package/locales/fa-IR/modelProvider.json +176 -0
- package/locales/fa-IR/setting.json +1 -0
- package/locales/fr-FR/common.json +1 -0
- package/locales/fr-FR/modelProvider.json +176 -0
- package/locales/fr-FR/setting.json +1 -0
- package/locales/it-IT/common.json +1 -0
- package/locales/it-IT/modelProvider.json +176 -0
- package/locales/it-IT/setting.json +1 -0
- package/locales/ja-JP/common.json +1 -0
- package/locales/ja-JP/modelProvider.json +176 -0
- package/locales/ja-JP/setting.json +1 -0
- package/locales/ko-KR/common.json +1 -0
- package/locales/ko-KR/modelProvider.json +176 -0
- package/locales/ko-KR/setting.json +1 -0
- package/locales/nl-NL/common.json +1 -0
- package/locales/nl-NL/modelProvider.json +176 -0
- package/locales/nl-NL/setting.json +1 -0
- package/locales/pl-PL/common.json +1 -0
- package/locales/pl-PL/modelProvider.json +176 -0
- package/locales/pl-PL/setting.json +1 -0
- package/locales/pt-BR/common.json +1 -0
- package/locales/pt-BR/modelProvider.json +176 -0
- package/locales/pt-BR/setting.json +1 -0
- package/locales/ru-RU/common.json +1 -0
- package/locales/ru-RU/modelProvider.json +176 -0
- package/locales/ru-RU/setting.json +1 -0
- package/locales/tr-TR/common.json +1 -0
- package/locales/tr-TR/modelProvider.json +176 -0
- package/locales/tr-TR/setting.json +1 -0
- package/locales/vi-VN/common.json +1 -0
- package/locales/vi-VN/modelProvider.json +176 -0
- package/locales/vi-VN/setting.json +1 -0
- package/locales/zh-CN/common.json +1 -0
- package/locales/zh-CN/modelProvider.json +176 -0
- package/locales/zh-CN/setting.json +1 -0
- package/locales/zh-TW/common.json +1 -0
- package/locales/zh-TW/modelProvider.json +176 -0
- package/locales/zh-TW/setting.json +1 -0
- package/package.json +4 -4
- package/src/app/(main)/(mobile)/me/settings/features/Category.tsx +1 -1
- package/src/app/(main)/(mobile)/me/settings/features/useCategory.tsx +12 -5
- package/src/app/(main)/changelog/features/VersionTag.tsx +1 -2
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatList/ChatItem/Thread.tsx +1 -1
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatList/ChatItem/ThreadItem.tsx +1 -2
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatList/ChatItem/index.tsx +0 -1
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/InboxWelcome/AgentsSuggest.tsx +1 -1
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/InboxWelcome/QuestionSuggest.tsx +1 -1
- package/src/app/(main)/chat/(workspace)/@conversation/features/ZenModeToast/Toast.tsx +1 -1
- package/src/app/(main)/chat/(workspace)/@topic/features/TopicListContent/ThreadItem/index.tsx +0 -2
- package/src/app/(main)/chat/(workspace)/@topic/features/TopicListContent/TopicItem/index.tsx +0 -1
- package/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Tags.tsx +2 -3
- package/src/app/(main)/chat/@session/features/SessionListContent/CollapseGroup/index.tsx +1 -1
- package/src/app/(main)/chat/features/Migration/Start.tsx +1 -1
- package/src/app/(main)/discover/(detail)/assistant/[slug]/features/ConversationExample/TopicList.tsx +4 -3
- package/src/app/(main)/discover/(detail)/assistant/[slug]/features/Header.tsx +1 -1
- package/src/app/(main)/discover/(detail)/features/ShareButton.tsx +2 -1
- package/src/app/(main)/discover/(detail)/model/[...slugs]/features/Header.tsx +1 -1
- package/src/app/(main)/discover/(detail)/plugin/[slug]/features/Header.tsx +1 -1
- package/src/app/(main)/discover/(detail)/provider/[slug]/features/Header.tsx +1 -1
- package/src/app/(main)/discover/(list)/_layout/Desktop/Nav.tsx +0 -1
- package/src/app/(main)/discover/(list)/assistants/features/Card.tsx +1 -1
- package/src/app/(main)/discover/(list)/models/features/Card.tsx +1 -1
- package/src/app/(main)/discover/(list)/plugins/features/Card.tsx +1 -1
- package/src/app/(main)/discover/(list)/providers/features/Card.tsx +1 -1
- package/src/app/(main)/discover/components/GridLoadingCard.tsx +2 -1
- package/src/app/(main)/discover/components/Title.tsx +1 -1
- package/src/app/(main)/files/(content)/@menu/features/KnowledgeBase/EmptyStatus.tsx +1 -1
- package/src/app/(main)/files/(content)/@menu/features/KnowledgeBase/Item/index.tsx +0 -1
- package/src/app/(main)/files/(content)/@modal/(.)[id]/FullscreenModal.tsx +2 -2
- package/src/app/(main)/files/(content)/NotSupportClient.tsx +2 -2
- package/src/app/(main)/profile/_layout/Desktop/SideBar.tsx +1 -1
- package/src/app/(main)/profile/stats/features/ShareButton/Preview.tsx +5 -5
- package/src/app/(main)/repos/[id]/evals/components/Container.tsx +1 -1
- package/src/app/(main)/repos/[id]/evals/dataset/DatasetList/Item.tsx +0 -1
- package/src/app/(main)/settings/_layout/Desktop/SideBar.tsx +1 -1
- package/src/app/(main)/settings/about/features/ItemCard.tsx +3 -3
- package/src/app/(main)/settings/about/features/Version.tsx +1 -1
- package/src/app/(main)/settings/hooks/useCategory.tsx +22 -9
- package/src/app/(main)/settings/llm/components/ProviderConfig/index.tsx +2 -1
- package/src/app/(main)/settings/llm/components/ProviderModelList/ModelFetcher.tsx +0 -1
- package/src/app/(main)/settings/provider/(detail)/[id]/index.tsx +19 -0
- package/src/app/(main)/settings/provider/(detail)/[id]/page.tsx +95 -0
- package/src/app/(main)/settings/provider/(detail)/azure/page.tsx +119 -0
- package/src/app/(main)/settings/provider/(detail)/bedrock/page.tsx +91 -0
- package/src/app/(main)/settings/provider/(detail)/cloudflare/page.tsx +58 -0
- package/src/app/(main)/settings/provider/(detail)/github/page.tsx +67 -0
- package/src/app/(main)/settings/provider/(detail)/huggingface/page.tsx +67 -0
- package/src/app/(main)/settings/provider/(detail)/ollama/Checker.tsx +73 -0
- package/src/app/(main)/settings/provider/(detail)/ollama/page.tsx +34 -0
- package/src/app/(main)/settings/provider/(detail)/openai/page.tsx +23 -0
- package/src/app/(main)/settings/provider/(detail)/wenxin/page.tsx +61 -0
- package/src/app/(main)/settings/provider/(list)/Footer.tsx +36 -0
- package/src/app/(main)/settings/provider/(list)/ProviderGrid/Card.tsx +134 -0
- package/src/app/(main)/settings/provider/(list)/ProviderGrid/index.tsx +91 -0
- package/src/app/(main)/settings/provider/(list)/index.tsx +19 -0
- package/src/app/(main)/settings/provider/ProviderMenu/AddNew.tsx +28 -0
- package/src/app/(main)/settings/provider/ProviderMenu/All.tsx +29 -0
- package/src/app/(main)/settings/provider/ProviderMenu/Item.tsx +69 -0
- package/src/app/(main)/settings/provider/ProviderMenu/List.tsx +76 -0
- package/src/app/(main)/settings/provider/ProviderMenu/SearchResult.tsx +43 -0
- package/src/app/(main)/settings/provider/ProviderMenu/SkeletonList.tsx +60 -0
- package/src/app/(main)/settings/provider/ProviderMenu/SortProviderModal/GroupItem.tsx +30 -0
- package/src/app/(main)/settings/provider/ProviderMenu/SortProviderModal/index.tsx +91 -0
- package/src/app/(main)/settings/provider/ProviderMenu/index.tsx +80 -0
- package/src/app/(main)/settings/provider/_layout/Desktop.tsx +37 -0
- package/src/app/(main)/settings/provider/_layout/Mobile.tsx +14 -0
- package/src/app/(main)/settings/provider/const.ts +20 -0
- package/src/app/(main)/settings/provider/features/CreateNewProvider/index.tsx +146 -0
- package/src/app/(main)/settings/provider/features/ModelList/CreateNewModelModal/Form.tsx +105 -0
- package/src/app/(main)/settings/provider/features/ModelList/CreateNewModelModal/index.tsx +69 -0
- package/src/app/(main)/settings/provider/features/ModelList/DisabledModels.tsx +29 -0
- package/src/app/(main)/settings/provider/features/ModelList/EmptyModels.tsx +101 -0
- package/src/app/(main)/settings/provider/features/ModelList/EnabledModelList/index.tsx +85 -0
- package/src/app/(main)/settings/provider/features/ModelList/ModelConfigModal/Form.tsx +109 -0
- package/src/app/(main)/settings/provider/features/ModelList/ModelConfigModal/index.tsx +76 -0
- package/src/app/(main)/settings/provider/features/ModelList/ModelItem.tsx +346 -0
- package/src/app/(main)/settings/provider/features/ModelList/ModelTitle/Search.tsx +37 -0
- package/src/app/(main)/settings/provider/features/ModelList/ModelTitle/index.tsx +145 -0
- package/src/app/(main)/settings/provider/features/ModelList/SearchResult.tsx +67 -0
- package/src/app/(main)/settings/provider/features/ModelList/SkeletonList.tsx +63 -0
- package/src/app/(main)/settings/provider/features/ModelList/SortModelModal/ListItem.tsx +20 -0
- package/src/app/(main)/settings/provider/features/ModelList/SortModelModal/index.tsx +96 -0
- package/src/app/(main)/settings/provider/features/ModelList/index.tsx +59 -0
- package/src/app/(main)/settings/provider/features/ProviderConfig/Checker.tsx +120 -0
- package/src/app/(main)/settings/provider/features/ProviderConfig/SkeletonInput.tsx +5 -0
- package/src/app/(main)/settings/provider/features/ProviderConfig/UpdateProviderInfo/SettingModal.tsx +137 -0
- package/src/app/(main)/settings/provider/features/ProviderConfig/UpdateProviderInfo/index.tsx +49 -0
- package/src/app/(main)/settings/provider/features/ProviderConfig/index.tsx +343 -0
- package/src/app/(main)/settings/provider/layout.tsx +21 -0
- package/src/app/(main)/settings/provider/page.tsx +17 -0
- package/src/app/(main)/settings/provider/type.ts +5 -0
- package/src/app/(main)/settings/sync/features/DeviceInfo/Card.tsx +1 -1
- package/src/app/(main)/settings/sync/features/DeviceInfo/index.tsx +1 -1
- package/src/app/@modal/(.)changelog/modal/features/ReadDetail.tsx +1 -1
- package/src/app/@modal/(.)changelog/modal/features/VersionTag.tsx +1 -2
- package/src/app/@modal/(.)changelog/modal/layout.tsx +1 -1
- package/src/components/Cell/index.tsx +1 -1
- package/src/components/DragUpload/index.tsx +2 -3
- package/src/components/FeatureList/index.tsx +1 -1
- package/src/components/FileParsingStatus/EmbeddingStatus.tsx +1 -1
- package/src/components/FileParsingStatus/index.tsx +1 -1
- package/src/components/FunctionModal/style.tsx +2 -2
- package/src/components/GoBack/index.tsx +1 -2
- package/src/components/HotKeys/index.tsx +1 -1
- package/src/components/InstantSwitch/index.tsx +28 -0
- package/src/components/Menu/index.tsx +1 -1
- package/src/components/ModelSelect/index.tsx +2 -3
- package/src/components/Notification/index.tsx +2 -1
- package/src/components/StatisticCard/index.tsx +5 -6
- package/src/config/aiModels/ai21.ts +38 -0
- package/src/config/aiModels/ai360.ts +71 -0
- package/src/config/aiModels/anthropic.ts +152 -0
- package/src/config/aiModels/azure.ts +86 -0
- package/src/config/aiModels/baichuan.ts +107 -0
- package/src/config/aiModels/bedrock.ts +315 -0
- package/src/config/aiModels/cloudflare.ts +88 -0
- package/src/config/aiModels/deepseek.ts +27 -0
- package/src/config/aiModels/fireworksai.ts +232 -0
- package/src/config/aiModels/giteeai.ts +137 -0
- package/src/config/aiModels/github.ts +273 -0
- package/src/config/aiModels/google.ts +317 -0
- package/src/config/aiModels/groq.ts +202 -0
- package/src/config/aiModels/higress.ts +2828 -0
- package/src/config/aiModels/huggingface.ts +56 -0
- package/src/config/aiModels/hunyuan.ts +151 -0
- package/src/config/aiModels/index.ts +98 -0
- package/src/config/aiModels/internlm.ts +40 -0
- package/src/config/aiModels/minimax.ts +55 -0
- package/src/config/aiModels/mistral.ts +172 -0
- package/src/config/aiModels/moonshot.ts +44 -0
- package/src/config/aiModels/novita.ts +124 -0
- package/src/config/aiModels/ollama.ts +412 -0
- package/src/config/aiModels/openai.ts +537 -0
- package/src/config/aiModels/openrouter.ts +252 -0
- package/src/config/aiModels/perplexity.ts +67 -0
- package/src/config/aiModels/qwen.ts +302 -0
- package/src/config/aiModels/sensenova.ts +114 -0
- package/src/config/aiModels/siliconcloud.ts +679 -0
- package/src/config/aiModels/spark.ts +68 -0
- package/src/config/aiModels/stepfun.ts +153 -0
- package/src/config/aiModels/taichu.ts +19 -0
- package/src/config/aiModels/togetherai.ts +334 -0
- package/src/config/aiModels/upstage.ts +37 -0
- package/src/config/aiModels/wenxin.ts +171 -0
- package/src/config/aiModels/xai.ts +72 -0
- package/src/config/aiModels/zeroone.ts +156 -0
- package/src/config/aiModels/zhipu.ts +235 -0
- package/src/config/featureFlags/schema.ts +3 -0
- package/src/config/modelProviders/anthropic.ts +1 -0
- package/src/config/modelProviders/github.ts +0 -1
- package/src/config/modelProviders/google.ts +1 -0
- package/src/config/modelProviders/stepfun.ts +2 -0
- package/src/database/migrations/0013_add_ai_infra.sql +44 -0
- package/src/database/migrations/meta/0013_snapshot.json +3598 -0
- package/src/database/migrations/meta/_journal.json +7 -0
- package/src/database/repositories/aiInfra/index.ts +115 -0
- package/src/database/schemas/aiInfra.ts +69 -0
- package/src/database/schemas/index.ts +1 -0
- package/src/database/server/models/__tests__/aiModel.test.ts +318 -0
- package/src/database/server/models/__tests__/aiProvider.test.ts +373 -0
- package/src/database/server/models/aiModel.ts +250 -0
- package/src/database/server/models/aiProvider.ts +234 -0
- package/src/features/AgentSetting/AgentPrompt/index.tsx +2 -2
- package/src/features/ChatInput/ActionBar/Token/TokenTag.tsx +2 -1
- package/src/features/ChatInput/ActionBar/Tools/index.tsx +2 -3
- package/src/features/ChatInput/ActionBar/Upload/ServerMode.tsx +2 -3
- package/src/features/ChatInput/Desktop/FilePreview/FileItem/index.tsx +3 -2
- package/src/features/ChatInput/Desktop/FilePreview/FileList.tsx +2 -2
- package/src/features/ChatInput/Mobile/Files/FileItem/File.tsx +2 -2
- package/src/features/ChatInput/Mobile/InputArea/index.tsx +1 -1
- package/src/features/ChatInput/STT/common.tsx +1 -1
- package/src/features/Conversation/Error/style.tsx +2 -2
- package/src/features/Conversation/Messages/Assistant/FileChunks/Item/style.ts +2 -2
- package/src/features/Conversation/Messages/Assistant/FileChunks/index.tsx +1 -1
- package/src/features/Conversation/Messages/Assistant/ToolCallItem/Inspector/style.ts +2 -3
- package/src/features/Conversation/Messages/Assistant/ToolCallItem/style.ts +2 -3
- package/src/features/Conversation/Messages/User/FileListViewer/Item.tsx +0 -1
- package/src/features/Conversation/components/BackBottom/style.ts +2 -2
- package/src/features/Conversation/components/MarkdownElements/LobeArtifact/Render/Icon.tsx +2 -3
- package/src/features/Conversation/components/MarkdownElements/LobeArtifact/Render/index.tsx +3 -3
- package/src/features/Conversation/components/MarkdownElements/LobeThinking/Render.tsx +1 -1
- package/src/features/Conversation/components/OTPInput.tsx +2 -2
- package/src/features/DataImporter/Loading.tsx +1 -1
- package/src/features/FileManager/FileList/EmptyStatus.tsx +1 -1
- package/src/features/FileManager/FileList/index.tsx +1 -1
- package/src/features/FileManager/UploadDock/Item.tsx +1 -1
- package/src/features/FileManager/UploadDock/index.tsx +4 -4
- package/src/features/FileViewer/NotSupport/index.tsx +1 -1
- package/src/features/FileViewer/Renderer/MSDoc/index.tsx +0 -1
- package/src/features/FileViewer/Renderer/TXT/index.tsx +1 -1
- package/src/features/InitClientDB/EnableModal.tsx +1 -1
- package/src/features/InitClientDB/ErrorResult.tsx +1 -1
- package/src/features/InitClientDB/InitIndicator.tsx +1 -1
- package/src/features/KnowledgeBaseModal/AddFilesToKnowledgeBase/SelectForm.tsx +0 -1
- package/src/features/ModelSwitchPanel/index.tsx +2 -2
- package/src/features/PluginsUI/Render/Loading.tsx +0 -1
- package/src/features/Portal/Home/Body/Files/FileList/Item.tsx +1 -1
- package/src/features/Portal/Home/Body/Plugins/ArtifactList/Item/style.ts +1 -2
- package/src/features/Setting/SettingContainer.tsx +8 -1
- package/src/features/ShareModal/ShareImage/style.ts +2 -2
- package/src/features/ShareModal/style.ts +2 -2
- package/src/features/User/DataStatistics.tsx +1 -1
- package/src/hooks/useEnabledChatModels.ts +10 -1
- package/src/hooks/useModelSupportToolUse.ts +15 -0
- package/src/hooks/useModelSupportVision.ts +15 -0
- package/src/layout/AuthProvider/Clerk/useAppearance.ts +3 -3
- package/src/layout/GlobalProvider/AppTheme.tsx +1 -1
- package/src/layout/GlobalProvider/StoreInitialization.tsx +5 -0
- package/src/locales/default/common.ts +1 -0
- package/src/locales/default/modelProvider.ts +178 -0
- package/src/locales/default/setting.ts +1 -0
- package/src/server/modules/KeyVaultsEncrypt/index.ts +1 -1
- package/src/server/routers/lambda/aiModel.ts +128 -0
- package/src/server/routers/lambda/aiProvider.ts +127 -0
- package/src/server/routers/lambda/index.ts +4 -0
- package/src/services/__tests__/_auth.test.ts +16 -49
- package/src/services/__tests__/chat.test.ts +2 -0
- package/src/services/_auth.ts +42 -25
- package/src/services/aiModel.ts +52 -0
- package/src/services/aiProvider.ts +47 -0
- package/src/services/chat.ts +62 -18
- package/src/store/aiInfra/index.ts +2 -0
- package/src/store/aiInfra/initialState.ts +11 -0
- package/src/store/aiInfra/selectors.ts +2 -0
- package/src/store/aiInfra/slices/aiModel/action.ts +146 -0
- package/src/store/aiInfra/slices/aiModel/index.ts +3 -0
- package/src/store/aiInfra/slices/aiModel/initialState.ts +14 -0
- package/src/store/aiInfra/slices/aiModel/selectors.ts +63 -0
- package/src/store/aiInfra/slices/aiProvider/action.ts +208 -0
- package/src/store/aiInfra/slices/aiProvider/index.ts +3 -0
- package/src/store/aiInfra/slices/aiProvider/initialState.ts +32 -0
- package/src/store/aiInfra/slices/aiProvider/selectors.ts +99 -0
- package/src/store/aiInfra/store.ts +25 -0
- package/src/store/global/initialState.ts +1 -0
- package/src/store/serverConfig/selectors.test.ts +1 -0
- package/src/styles/global.ts +1 -1
- package/src/types/aiModel.ts +32 -6
- package/src/types/aiProvider.ts +11 -4
- package/src/utils/fetch/fetchSSE.ts +3 -1
@@ -30,12 +30,12 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
30
30
|
|
31
31
|
width: 200px;
|
32
32
|
height: 140px;
|
33
|
+
border-radius: ${token.borderRadiusLG}px;
|
33
34
|
|
34
35
|
font-weight: 500;
|
35
36
|
text-align: center;
|
36
37
|
|
37
38
|
background: ${token.colorFillTertiary};
|
38
|
-
border-radius: ${token.borderRadiusLG}px;
|
39
39
|
box-shadow: 0 0 0 1px ${token.colorFillTertiary} inset;
|
40
40
|
|
41
41
|
transition: background 0.3s ease-in-out;
|
@@ -57,8 +57,8 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
57
57
|
`,
|
58
58
|
|
59
59
|
icon: css`
|
60
|
-
color: ${token.colorTextLightSolid};
|
61
60
|
border-radius: ${token.borderRadiusLG}px;
|
61
|
+
color: ${token.colorTextLightSolid};
|
62
62
|
`,
|
63
63
|
iconGroup: css`
|
64
64
|
margin-block-start: -44px;
|
@@ -13,8 +13,8 @@ const useStyles = createStyles(({ token, css }) => ({
|
|
13
13
|
container: css`
|
14
14
|
padding-block: 0 16px;
|
15
15
|
padding-inline: 12px;
|
16
|
-
background: ${token.colorBgContainer};
|
17
16
|
border-inline-end: 1px solid ${token.colorBorder};
|
17
|
+
background: ${token.colorBgContainer};
|
18
18
|
`,
|
19
19
|
}));
|
20
20
|
|
@@ -17,8 +17,8 @@ import AiHeatmaps from '../AiHeatmaps';
|
|
17
17
|
const useStyles = createStyles(({ css, token, stylish, cx, responsive }) => ({
|
18
18
|
avatar: css`
|
19
19
|
box-sizing: content-box;
|
20
|
-
background: ${token.colorText};
|
21
20
|
border: 4px solid ${token.colorBgLayout};
|
21
|
+
background: ${token.colorText};
|
22
22
|
`,
|
23
23
|
background: css`
|
24
24
|
position: relative;
|
@@ -38,10 +38,10 @@ const useStyles = createStyles(({ css, token, stylish, cx, responsive }) => ({
|
|
38
38
|
overflow: hidden;
|
39
39
|
|
40
40
|
width: 100%;
|
41
|
-
|
42
|
-
background: ${token.colorBgLayout};
|
43
41
|
border: 1px solid ${token.colorBorder};
|
44
42
|
border-radius: ${token.borderRadiusLG * 2}px;
|
43
|
+
|
44
|
+
background: ${token.colorBgLayout};
|
45
45
|
box-shadow: ${token.boxShadow};
|
46
46
|
`,
|
47
47
|
decs: css`
|
@@ -65,11 +65,11 @@ const useStyles = createStyles(({ css, token, stylish, cx, responsive }) => ({
|
|
65
65
|
|
66
66
|
width: 100%;
|
67
67
|
max-height: 70dvh;
|
68
|
-
|
69
|
-
background: ${token.colorBgLayout};
|
70
68
|
border: 1px solid ${token.colorBorder};
|
71
69
|
border-radius: ${token.borderRadiusLG}px;
|
72
70
|
|
71
|
+
background: ${token.colorBgLayout};
|
72
|
+
|
73
73
|
* {
|
74
74
|
pointer-events: none;
|
75
75
|
|
@@ -13,8 +13,8 @@ const useStyles = createStyles(({ token, css }) => ({
|
|
13
13
|
container: css`
|
14
14
|
padding-block: 0 16px;
|
15
15
|
padding-inline: 12px;
|
16
|
-
background: ${token.colorBgContainer};
|
17
16
|
border-inline-end: 1px solid ${token.colorBorder};
|
17
|
+
background: ${token.colorBgContainer};
|
18
18
|
`,
|
19
19
|
}));
|
20
20
|
|
@@ -11,14 +11,14 @@ const useStyles = createStyles(({ css, token, isDarkMode }) => ({
|
|
11
11
|
|
12
12
|
padding-block: 12px;
|
13
13
|
padding-inline: 16px;
|
14
|
-
|
15
|
-
background: ${isDarkMode ? token.colorFillTertiary : token.colorBgContainer};
|
16
14
|
border: 1px solid ${token.colorFillSecondary};
|
17
15
|
border-radius: ${token.borderRadiusLG}px;
|
18
16
|
|
17
|
+
background: ${isDarkMode ? token.colorFillTertiary : token.colorBgContainer};
|
18
|
+
|
19
19
|
&:hover {
|
20
|
-
background: ${isDarkMode ? token.colorFillSecondary : token.colorBgContainer};
|
21
20
|
border: 1px solid ${token.colorFill};
|
21
|
+
background: ${isDarkMode ? token.colorFillSecondary : token.colorBgContainer};
|
22
22
|
}
|
23
23
|
`,
|
24
24
|
}));
|
@@ -15,8 +15,8 @@ import { useGlobalStore } from '@/store/global';
|
|
15
15
|
const useStyles = createStyles(({ css, token }) => ({
|
16
16
|
logo: css`
|
17
17
|
overflow: hidden;
|
18
|
-
background: ${token.colorBgContainer};
|
19
18
|
border-radius: ${token.borderRadiusLG * 2}px;
|
19
|
+
background: ${token.colorBgContainer};
|
20
20
|
box-shadow: 0 0 0 1px ${token.colorFillSecondary} inset;
|
21
21
|
`,
|
22
22
|
}));
|
@@ -7,6 +7,7 @@ import { useTranslation } from 'react-i18next';
|
|
7
7
|
import { Flexbox } from 'react-layout-kit';
|
8
8
|
|
9
9
|
import type { MenuProps } from '@/components/Menu';
|
10
|
+
import { isServerMode } from '@/const/version';
|
10
11
|
import { SettingsTabs } from '@/store/global/initialState';
|
11
12
|
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
12
13
|
|
@@ -50,15 +51,27 @@ export const useCategory = () => {
|
|
50
51
|
</Link>
|
51
52
|
),
|
52
53
|
},
|
53
|
-
showLLM &&
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
54
|
+
showLLM &&
|
55
|
+
// TODO: Remove /llm when v2.0
|
56
|
+
!isServerMode
|
57
|
+
? {
|
58
|
+
icon: <Icon icon={Brain} />,
|
59
|
+
key: SettingsTabs.LLM,
|
60
|
+
label: (
|
61
|
+
<Link href={'/settings/llm'} onClick={(e) => e.preventDefault()}>
|
62
|
+
{t('tab.llm')}
|
63
|
+
</Link>
|
64
|
+
),
|
65
|
+
}
|
66
|
+
: {
|
67
|
+
icon: <Icon icon={Brain} />,
|
68
|
+
key: SettingsTabs.Provider,
|
69
|
+
label: (
|
70
|
+
<Link href={'/settings/provider'} onClick={(e) => e.preventDefault()}>
|
71
|
+
{t('tab.provider')}
|
72
|
+
</Link>
|
73
|
+
),
|
74
|
+
},
|
62
75
|
|
63
76
|
enableSTT && {
|
64
77
|
icon: <Icon icon={Mic2} />,
|
@@ -68,12 +68,13 @@ const useStyles = createStyles(({ css, prefixCls, responsive, token }) => ({
|
|
68
68
|
}
|
69
69
|
`,
|
70
70
|
help: css`
|
71
|
+
border-radius: 50%;
|
72
|
+
|
71
73
|
font-size: 12px;
|
72
74
|
font-weight: 500;
|
73
75
|
color: ${token.colorTextDescription};
|
74
76
|
|
75
77
|
background: ${token.colorFillTertiary};
|
76
|
-
border-radius: 50%;
|
77
78
|
|
78
79
|
&:hover {
|
79
80
|
color: ${token.colorText};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
'use client';
|
2
|
+
|
3
|
+
import { memo } from 'react';
|
4
|
+
import { Flexbox } from 'react-layout-kit';
|
5
|
+
|
6
|
+
|
7
|
+
import ModelList from '../../features/ModelList';
|
8
|
+
import ProviderConfig, { ProviderConfigProps } from '../../features/ProviderConfig';
|
9
|
+
|
10
|
+
const ProviderDetail = memo<ProviderConfigProps>((card) => {
|
11
|
+
return (
|
12
|
+
<Flexbox gap={24} paddingBlock={8}>
|
13
|
+
<ProviderConfig {...card} />
|
14
|
+
<ModelList id={card.id} />
|
15
|
+
</Flexbox>
|
16
|
+
);
|
17
|
+
});
|
18
|
+
|
19
|
+
export default ProviderDetail;
|
@@ -0,0 +1,95 @@
|
|
1
|
+
import { redirect } from 'next/navigation';
|
2
|
+
|
3
|
+
import Ai21Provider from '@/config/modelProviders/ai21';
|
4
|
+
import Ai360Provider from '@/config/modelProviders/ai360';
|
5
|
+
import AnthropicProvider from '@/config/modelProviders/anthropic';
|
6
|
+
import BaichuanProvider from '@/config/modelProviders/baichuan';
|
7
|
+
import DeepSeekProvider from '@/config/modelProviders/deepseek';
|
8
|
+
import FireworksAIProvider from '@/config/modelProviders/fireworksai';
|
9
|
+
import GiteeAIProvider from '@/config/modelProviders/giteeai';
|
10
|
+
import GoogleProvider from '@/config/modelProviders/google';
|
11
|
+
import GroqProvider from '@/config/modelProviders/groq';
|
12
|
+
import HigressProvider from '@/config/modelProviders/higress';
|
13
|
+
import HunyuanProvider from '@/config/modelProviders/hunyuan';
|
14
|
+
import InternLMProvider from '@/config/modelProviders/internlm';
|
15
|
+
import MinimaxProvider from '@/config/modelProviders/minimax';
|
16
|
+
import MistralProvider from '@/config/modelProviders/mistral';
|
17
|
+
import MoonshotProvider from '@/config/modelProviders/moonshot';
|
18
|
+
import NovitaProvider from '@/config/modelProviders/novita';
|
19
|
+
import OpenRouterProvider from '@/config/modelProviders/openrouter';
|
20
|
+
import PerplexityProvider from '@/config/modelProviders/perplexity';
|
21
|
+
import QwenProvider from '@/config/modelProviders/qwen';
|
22
|
+
import SiliconCloudProvider from '@/config/modelProviders/siliconcloud';
|
23
|
+
import SparkProvider from '@/config/modelProviders/spark';
|
24
|
+
import StepfunProvider from '@/config/modelProviders/stepfun';
|
25
|
+
import TaichuProvider from '@/config/modelProviders/taichu';
|
26
|
+
import TogetherAIProvider from '@/config/modelProviders/togetherai';
|
27
|
+
import UpstageProvider from '@/config/modelProviders/upstage';
|
28
|
+
import XAIProvider from '@/config/modelProviders/xai';
|
29
|
+
import ZeroOneProvider from '@/config/modelProviders/zeroone';
|
30
|
+
import ZhiPuProvider from '@/config/modelProviders/zhipu';
|
31
|
+
import { isServerMode } from '@/const/version';
|
32
|
+
import { serverDB } from '@/database/server';
|
33
|
+
import { AiProviderModel } from '@/database/server/models/aiProvider';
|
34
|
+
import { KeyVaultsGateKeeper } from '@/server/modules/KeyVaultsEncrypt';
|
35
|
+
import { PagePropsWithId } from '@/types/next';
|
36
|
+
import { getUserAuth } from '@/utils/server/auth';
|
37
|
+
|
38
|
+
import ProviderDetail from './index';
|
39
|
+
|
40
|
+
const DEFAULT_MODEL_PROVIDER_LIST = [
|
41
|
+
AnthropicProvider,
|
42
|
+
GoogleProvider,
|
43
|
+
DeepSeekProvider,
|
44
|
+
OpenRouterProvider,
|
45
|
+
NovitaProvider,
|
46
|
+
TogetherAIProvider,
|
47
|
+
FireworksAIProvider,
|
48
|
+
GroqProvider,
|
49
|
+
PerplexityProvider,
|
50
|
+
MistralProvider,
|
51
|
+
Ai21Provider,
|
52
|
+
UpstageProvider,
|
53
|
+
XAIProvider,
|
54
|
+
QwenProvider,
|
55
|
+
HunyuanProvider,
|
56
|
+
SparkProvider,
|
57
|
+
ZhiPuProvider,
|
58
|
+
ZeroOneProvider,
|
59
|
+
StepfunProvider,
|
60
|
+
MoonshotProvider,
|
61
|
+
BaichuanProvider,
|
62
|
+
MinimaxProvider,
|
63
|
+
Ai360Provider,
|
64
|
+
TaichuProvider,
|
65
|
+
InternLMProvider,
|
66
|
+
SiliconCloudProvider,
|
67
|
+
HigressProvider,
|
68
|
+
GiteeAIProvider,
|
69
|
+
];
|
70
|
+
|
71
|
+
const Page = async (props: PagePropsWithId) => {
|
72
|
+
const params = await props.params;
|
73
|
+
|
74
|
+
const builtinProviderCard = DEFAULT_MODEL_PROVIDER_LIST.find((v) => v.id === params.id);
|
75
|
+
if (!!builtinProviderCard) return <ProviderDetail source={'builtin'} {...builtinProviderCard} />;
|
76
|
+
|
77
|
+
if (isServerMode) {
|
78
|
+
const { userId } = await getUserAuth();
|
79
|
+
|
80
|
+
const aiProviderModel = new AiProviderModel(serverDB, userId!);
|
81
|
+
|
82
|
+
const userCard = await aiProviderModel.getAiProviderById(
|
83
|
+
params.id,
|
84
|
+
KeyVaultsGateKeeper.getUserKeyVaults,
|
85
|
+
);
|
86
|
+
|
87
|
+
if (!userCard) return redirect('/settings/provider');
|
88
|
+
|
89
|
+
return <ProviderDetail {...userCard} />;
|
90
|
+
}
|
91
|
+
|
92
|
+
return <div>not found</div>;
|
93
|
+
};
|
94
|
+
|
95
|
+
export default Page;
|
@@ -0,0 +1,119 @@
|
|
1
|
+
'use client';
|
2
|
+
|
3
|
+
import { Markdown } from '@lobehub/ui';
|
4
|
+
import { AutoComplete, Input } from 'antd';
|
5
|
+
import { createStyles } from 'antd-style';
|
6
|
+
import { useTranslation } from 'react-i18next';
|
7
|
+
|
8
|
+
import { AzureProviderCard } from '@/config/modelProviders';
|
9
|
+
import { ModelProvider } from '@/libs/agent-runtime';
|
10
|
+
import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
|
11
|
+
import { useUserStore } from '@/store/user';
|
12
|
+
import { modelProviderSelectors } from '@/store/user/selectors';
|
13
|
+
|
14
|
+
import { KeyVaultsConfigKey, LLMProviderApiTokenKey, LLMProviderBaseUrlKey } from '../../const';
|
15
|
+
import { SkeletonInput } from '../../features/ProviderConfig';
|
16
|
+
import { ProviderItem } from '../../type';
|
17
|
+
import ProviderDetail from '../[id]';
|
18
|
+
|
19
|
+
const useStyles = createStyles(({ css, token }) => ({
|
20
|
+
markdown: css`
|
21
|
+
p {
|
22
|
+
color: ${token.colorTextDescription} !important;
|
23
|
+
}
|
24
|
+
`,
|
25
|
+
tip: css`
|
26
|
+
font-size: 12px;
|
27
|
+
color: ${token.colorTextDescription};
|
28
|
+
`,
|
29
|
+
}));
|
30
|
+
|
31
|
+
const providerKey = ModelProvider.Azure;
|
32
|
+
|
33
|
+
const useProviderCard = (): ProviderItem => {
|
34
|
+
const { t } = useTranslation('modelProvider');
|
35
|
+
const { styles } = useStyles();
|
36
|
+
|
37
|
+
// Get the first model card's deployment name as the check model
|
38
|
+
const checkModel = useUserStore((s) => {
|
39
|
+
const chatModelCards = modelProviderSelectors.getModelCardsById(providerKey)(s);
|
40
|
+
|
41
|
+
if (chatModelCards.length > 0) {
|
42
|
+
return chatModelCards[0].deploymentName;
|
43
|
+
}
|
44
|
+
|
45
|
+
return 'gpt-35-turbo';
|
46
|
+
});
|
47
|
+
|
48
|
+
const isLoading = useAiInfraStore(aiProviderSelectors.isAiProviderConfigLoading(providerKey));
|
49
|
+
|
50
|
+
return {
|
51
|
+
...AzureProviderCard,
|
52
|
+
apiKeyItems: [
|
53
|
+
{
|
54
|
+
children: isLoading ? (
|
55
|
+
<SkeletonInput />
|
56
|
+
) : (
|
57
|
+
<Input.Password
|
58
|
+
autoComplete={'new-password'}
|
59
|
+
placeholder={t('azure.token.placeholder')}
|
60
|
+
/>
|
61
|
+
),
|
62
|
+
desc: t('azure.token.desc'),
|
63
|
+
label: t('azure.token.title'),
|
64
|
+
name: [KeyVaultsConfigKey, LLMProviderApiTokenKey],
|
65
|
+
},
|
66
|
+
{
|
67
|
+
children: isLoading ? (
|
68
|
+
<SkeletonInput />
|
69
|
+
) : (
|
70
|
+
<Input allowClear placeholder={t('azure.endpoint.placeholder')} />
|
71
|
+
),
|
72
|
+
desc: t('azure.endpoint.desc'),
|
73
|
+
label: t('azure.endpoint.title'),
|
74
|
+
name: [KeyVaultsConfigKey, LLMProviderBaseUrlKey],
|
75
|
+
},
|
76
|
+
{
|
77
|
+
children: isLoading ? (
|
78
|
+
<SkeletonInput />
|
79
|
+
) : (
|
80
|
+
<AutoComplete
|
81
|
+
options={[
|
82
|
+
'2024-06-01',
|
83
|
+
'2024-02-01',
|
84
|
+
'2024-05-01-preview',
|
85
|
+
'2024-04-01-preview',
|
86
|
+
'2024-03-01-preview',
|
87
|
+
'2024-02-15-preview',
|
88
|
+
'2023-10-01-preview',
|
89
|
+
'2023-06-01-preview',
|
90
|
+
'2023-05-15',
|
91
|
+
].map((i) => ({ label: i, value: i }))}
|
92
|
+
placeholder={'20XX-XX-XX'}
|
93
|
+
/>
|
94
|
+
),
|
95
|
+
desc: (
|
96
|
+
<Markdown className={styles.markdown} fontSize={12} variant={'chat'}>
|
97
|
+
{t('azure.azureApiVersion.desc')}
|
98
|
+
</Markdown>
|
99
|
+
),
|
100
|
+
label: t('azure.azureApiVersion.title'),
|
101
|
+
name: [KeyVaultsConfigKey, 'apiVersion'],
|
102
|
+
},
|
103
|
+
],
|
104
|
+
checkModel,
|
105
|
+
modelList: {
|
106
|
+
azureDeployName: true,
|
107
|
+
notFoundContent: t('azure.empty'),
|
108
|
+
placeholder: t('azure.modelListPlaceholder'),
|
109
|
+
},
|
110
|
+
};
|
111
|
+
};
|
112
|
+
|
113
|
+
const Page = () => {
|
114
|
+
const card = useProviderCard();
|
115
|
+
|
116
|
+
return <ProviderDetail {...card} />;
|
117
|
+
};
|
118
|
+
|
119
|
+
export default Page;
|
@@ -0,0 +1,91 @@
|
|
1
|
+
'use client';
|
2
|
+
|
3
|
+
import { Input, Select } from 'antd';
|
4
|
+
import { useTranslation } from 'react-i18next';
|
5
|
+
|
6
|
+
import { BedrockProviderCard } from '@/config/modelProviders';
|
7
|
+
import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
|
8
|
+
import { GlobalLLMProviderKey } from '@/types/user/settings';
|
9
|
+
|
10
|
+
import { KeyVaultsConfigKey } from '../../const';
|
11
|
+
import { SkeletonInput } from '../../features/ProviderConfig';
|
12
|
+
import { ProviderItem } from '../../type';
|
13
|
+
import ProviderDetail from '../[id]';
|
14
|
+
|
15
|
+
const providerKey: GlobalLLMProviderKey = 'bedrock';
|
16
|
+
|
17
|
+
const useBedrockCard = (): ProviderItem => {
|
18
|
+
const { t } = useTranslation('modelProvider');
|
19
|
+
|
20
|
+
const isLoading = useAiInfraStore(aiProviderSelectors.isAiProviderConfigLoading(providerKey));
|
21
|
+
|
22
|
+
return {
|
23
|
+
...BedrockProviderCard,
|
24
|
+
apiKeyItems: [
|
25
|
+
{
|
26
|
+
children: isLoading ? (
|
27
|
+
<SkeletonInput />
|
28
|
+
) : (
|
29
|
+
<Input.Password
|
30
|
+
autoComplete={'new-password'}
|
31
|
+
placeholder={t(`${providerKey}.accessKeyId.placeholder`)}
|
32
|
+
/>
|
33
|
+
),
|
34
|
+
desc: t(`${providerKey}.accessKeyId.desc`),
|
35
|
+
label: t(`${providerKey}.accessKeyId.title`),
|
36
|
+
name: [KeyVaultsConfigKey, 'accessKeyId'],
|
37
|
+
},
|
38
|
+
{
|
39
|
+
children: isLoading ? (
|
40
|
+
<SkeletonInput />
|
41
|
+
) : (
|
42
|
+
<Input.Password
|
43
|
+
autoComplete={'new-password'}
|
44
|
+
placeholder={t(`${providerKey}.secretAccessKey.placeholder`)}
|
45
|
+
/>
|
46
|
+
),
|
47
|
+
desc: t(`${providerKey}.secretAccessKey.desc`),
|
48
|
+
label: t(`${providerKey}.secretAccessKey.title`),
|
49
|
+
name: [KeyVaultsConfigKey, 'secretAccessKey'],
|
50
|
+
},
|
51
|
+
{
|
52
|
+
children: isLoading ? (
|
53
|
+
<SkeletonInput />
|
54
|
+
) : (
|
55
|
+
<Input.Password
|
56
|
+
autoComplete={'new-password'}
|
57
|
+
placeholder={t(`${providerKey}.sessionToken.placeholder`)}
|
58
|
+
/>
|
59
|
+
),
|
60
|
+
desc: t(`${providerKey}.sessionToken.desc`),
|
61
|
+
label: t(`${providerKey}.sessionToken.title`),
|
62
|
+
name: [KeyVaultsConfigKey, 'sessionToken'],
|
63
|
+
},
|
64
|
+
{
|
65
|
+
children: isLoading ? (
|
66
|
+
<SkeletonInput />
|
67
|
+
) : (
|
68
|
+
<Select
|
69
|
+
allowClear
|
70
|
+
options={['us-east-1', 'us-west-2', 'ap-southeast-1'].map((i) => ({
|
71
|
+
label: i,
|
72
|
+
value: i,
|
73
|
+
}))}
|
74
|
+
placeholder={'us-east-1'}
|
75
|
+
/>
|
76
|
+
),
|
77
|
+
desc: t(`${providerKey}.region.desc`),
|
78
|
+
label: t(`${providerKey}.region.title`),
|
79
|
+
name: [KeyVaultsConfigKey, 'region'],
|
80
|
+
},
|
81
|
+
],
|
82
|
+
};
|
83
|
+
};
|
84
|
+
|
85
|
+
const Page = () => {
|
86
|
+
const card = useBedrockCard();
|
87
|
+
|
88
|
+
return <ProviderDetail {...card} />;
|
89
|
+
};
|
90
|
+
|
91
|
+
export default Page;
|
@@ -0,0 +1,58 @@
|
|
1
|
+
'use client';
|
2
|
+
|
3
|
+
import { Input } from 'antd';
|
4
|
+
import { useTranslation } from 'react-i18next';
|
5
|
+
|
6
|
+
import { CloudflareProviderCard } from '@/config/modelProviders';
|
7
|
+
import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
|
8
|
+
import { GlobalLLMProviderKey } from '@/types/user/settings';
|
9
|
+
|
10
|
+
import { KeyVaultsConfigKey } from '../../const';
|
11
|
+
import { SkeletonInput } from '../../features/ProviderConfig';
|
12
|
+
import { ProviderItem } from '../../type';
|
13
|
+
import ProviderDetail from '../[id]';
|
14
|
+
|
15
|
+
const providerKey: GlobalLLMProviderKey = 'cloudflare';
|
16
|
+
|
17
|
+
const useProviderCard = (): ProviderItem => {
|
18
|
+
const { t } = useTranslation('modelProvider');
|
19
|
+
|
20
|
+
const isLoading = useAiInfraStore(aiProviderSelectors.isAiProviderConfigLoading(providerKey));
|
21
|
+
|
22
|
+
return {
|
23
|
+
...CloudflareProviderCard,
|
24
|
+
apiKeyItems: [
|
25
|
+
{
|
26
|
+
children: isLoading ? (
|
27
|
+
<SkeletonInput />
|
28
|
+
) : (
|
29
|
+
<Input.Password
|
30
|
+
autoComplete={'new-password'}
|
31
|
+
placeholder={t(`${providerKey}.apiKey.placeholder`)}
|
32
|
+
/>
|
33
|
+
),
|
34
|
+
desc: t(`${providerKey}.apiKey.desc`),
|
35
|
+
label: t(`${providerKey}.apiKey.title`),
|
36
|
+
name: [KeyVaultsConfigKey, 'apiKey'],
|
37
|
+
},
|
38
|
+
{
|
39
|
+
children: isLoading ? (
|
40
|
+
<SkeletonInput />
|
41
|
+
) : (
|
42
|
+
<Input placeholder={t(`${providerKey}.baseURLOrAccountID.placeholder`)} />
|
43
|
+
),
|
44
|
+
desc: t(`${providerKey}.baseURLOrAccountID.desc`),
|
45
|
+
label: t(`${providerKey}.baseURLOrAccountID.title`),
|
46
|
+
name: [KeyVaultsConfigKey, 'baseURLOrAccountID'],
|
47
|
+
},
|
48
|
+
],
|
49
|
+
};
|
50
|
+
};
|
51
|
+
|
52
|
+
const Page = () => {
|
53
|
+
const card = useProviderCard();
|
54
|
+
|
55
|
+
return <ProviderDetail {...card} />;
|
56
|
+
};
|
57
|
+
|
58
|
+
export default Page;
|
@@ -0,0 +1,67 @@
|
|
1
|
+
'use client';
|
2
|
+
|
3
|
+
import { Markdown } from '@lobehub/ui';
|
4
|
+
import { Input } from 'antd';
|
5
|
+
import { createStyles } from 'antd-style';
|
6
|
+
import { useTranslation } from 'react-i18next';
|
7
|
+
|
8
|
+
import { GithubProviderCard } from '@/config/modelProviders';
|
9
|
+
import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
|
10
|
+
import { GlobalLLMProviderKey } from '@/types/user/settings';
|
11
|
+
|
12
|
+
import { KeyVaultsConfigKey, LLMProviderApiTokenKey } from '../../const';
|
13
|
+
import { SkeletonInput } from '../../features/ProviderConfig';
|
14
|
+
import { ProviderItem } from '../../type';
|
15
|
+
import ProviderDetail from '../[id]';
|
16
|
+
|
17
|
+
const useStyles = createStyles(({ css, token }) => ({
|
18
|
+
markdown: css`
|
19
|
+
p {
|
20
|
+
color: ${token.colorTextDescription} !important;
|
21
|
+
}
|
22
|
+
`,
|
23
|
+
tip: css`
|
24
|
+
font-size: 12px;
|
25
|
+
color: ${token.colorTextDescription};
|
26
|
+
`,
|
27
|
+
}));
|
28
|
+
|
29
|
+
const providerKey: GlobalLLMProviderKey = 'github';
|
30
|
+
|
31
|
+
// Same as OpenAIProvider, but replace API Key with Github Personal Access Token
|
32
|
+
const useProviderCard = (): ProviderItem => {
|
33
|
+
const { t } = useTranslation('modelProvider');
|
34
|
+
const { styles } = useStyles();
|
35
|
+
const isLoading = useAiInfraStore(aiProviderSelectors.isAiProviderConfigLoading(providerKey));
|
36
|
+
|
37
|
+
return {
|
38
|
+
...GithubProviderCard,
|
39
|
+
apiKeyItems: [
|
40
|
+
{
|
41
|
+
children: isLoading ? (
|
42
|
+
<SkeletonInput />
|
43
|
+
) : (
|
44
|
+
<Input.Password
|
45
|
+
autoComplete={'new-password'}
|
46
|
+
placeholder={t(`${providerKey}.personalAccessToken.placeholder`)}
|
47
|
+
/>
|
48
|
+
),
|
49
|
+
desc: (
|
50
|
+
<Markdown className={styles.markdown} fontSize={12} variant={'chat'}>
|
51
|
+
{t(`${providerKey}.personalAccessToken.desc`)}
|
52
|
+
</Markdown>
|
53
|
+
),
|
54
|
+
label: t(`${providerKey}.personalAccessToken.title`),
|
55
|
+
name: [KeyVaultsConfigKey, providerKey, LLMProviderApiTokenKey],
|
56
|
+
},
|
57
|
+
],
|
58
|
+
};
|
59
|
+
};
|
60
|
+
|
61
|
+
const Page = () => {
|
62
|
+
const card = useProviderCard();
|
63
|
+
|
64
|
+
return <ProviderDetail {...card} />;
|
65
|
+
};
|
66
|
+
|
67
|
+
export default Page;
|