@lobehub/chat 1.119.1 → 1.120.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/.vscode/settings.json +2 -3
- package/CHANGELOG.md +58 -0
- package/changelog/v1.json +17 -0
- package/package.json +5 -6
- package/packages/const/src/auth.ts +0 -36
- package/packages/const/src/index.ts +3 -1
- package/packages/database/src/models/__tests__/aiModel.test.ts +1 -2
- package/packages/database/src/models/__tests__/generationBatch.test.ts +47 -1
- package/packages/database/src/models/aiModel.ts +2 -3
- package/packages/database/src/models/generationBatch.ts +8 -1
- package/packages/database/src/repositories/aiInfra/index.test.ts +1 -1
- package/packages/database/src/repositories/aiInfra/index.ts +4 -4
- package/packages/model-bank/src/aiModels/ai21.ts +1 -1
- package/packages/model-bank/src/aiModels/ai302.ts +1 -1
- package/packages/model-bank/src/aiModels/ai360.ts +1 -1
- package/packages/model-bank/src/aiModels/aihubmix.ts +3 -3
- package/packages/model-bank/src/aiModels/akashchat.ts +1 -1
- package/packages/model-bank/src/aiModels/anthropic.ts +1 -1
- package/packages/model-bank/src/aiModels/azure.ts +1 -1
- package/packages/model-bank/src/aiModels/azureai.ts +1 -1
- package/packages/model-bank/src/aiModels/baichuan.ts +1 -1
- package/packages/model-bank/src/aiModels/bedrock.ts +1 -1
- package/packages/model-bank/src/aiModels/bfl.ts +2 -3
- package/packages/model-bank/src/aiModels/cloudflare.ts +1 -1
- package/packages/model-bank/src/aiModels/cohere.ts +1 -1
- package/packages/model-bank/src/aiModels/deepseek.ts +1 -1
- package/packages/model-bank/src/aiModels/fal.ts +1 -1
- package/packages/model-bank/src/aiModels/fireworksai.ts +1 -1
- package/packages/model-bank/src/aiModels/giteeai.ts +1 -1
- package/packages/model-bank/src/aiModels/github.ts +1 -1
- package/packages/model-bank/src/aiModels/google.ts +6 -7
- package/packages/model-bank/src/aiModels/groq.ts +1 -1
- package/packages/model-bank/src/aiModels/higress.ts +1 -1
- package/packages/model-bank/src/aiModels/huggingface.ts +1 -1
- package/packages/model-bank/src/aiModels/hunyuan.ts +1 -1
- package/packages/model-bank/src/aiModels/index.ts +1 -1
- package/packages/model-bank/src/aiModels/infiniai.ts +1 -1
- package/packages/model-bank/src/aiModels/internlm.ts +1 -1
- package/packages/model-bank/src/aiModels/jina.ts +1 -1
- package/packages/model-bank/src/aiModels/lmstudio.ts +1 -1
- package/packages/model-bank/src/aiModels/lobehub.ts +1 -1
- package/packages/model-bank/src/aiModels/minimax.ts +1 -1
- package/packages/model-bank/src/aiModels/mistral.ts +1 -1
- package/packages/model-bank/src/aiModels/modelscope.ts +1 -1
- package/packages/model-bank/src/aiModels/moonshot.ts +1 -1
- package/packages/model-bank/src/aiModels/novita.ts +1 -1
- package/packages/model-bank/src/aiModels/nvidia.ts +1 -1
- package/packages/model-bank/src/aiModels/ollama.ts +1 -1
- package/packages/model-bank/src/aiModels/openai.ts +1 -1
- package/packages/model-bank/src/aiModels/openrouter.ts +3 -3
- package/packages/model-bank/src/aiModels/perplexity.ts +1 -1
- package/packages/model-bank/src/aiModels/ppio.ts +1 -1
- package/packages/model-bank/src/aiModels/qiniu.ts +1 -1
- package/packages/model-bank/src/aiModels/qwen.ts +4 -2
- package/packages/model-bank/src/aiModels/sambanova.ts +1 -1
- package/packages/model-bank/src/aiModels/search1api.ts +1 -1
- package/packages/model-bank/src/aiModels/sensenova.ts +1 -1
- package/packages/model-bank/src/aiModels/siliconcloud.ts +7 -1
- package/packages/model-bank/src/aiModels/spark.ts +1 -1
- package/packages/model-bank/src/aiModels/stepfun.ts +1 -1
- package/packages/model-bank/src/aiModels/taichu.ts +1 -1
- package/packages/model-bank/src/aiModels/tencentcloud.ts +1 -1
- package/packages/model-bank/src/aiModels/togetherai.ts +1 -1
- package/packages/model-bank/src/aiModels/upstage.ts +1 -1
- package/packages/model-bank/src/aiModels/v0.ts +1 -1
- package/packages/model-bank/src/aiModels/vertexai.ts +3 -3
- package/packages/model-bank/src/aiModels/vllm.ts +1 -1
- package/packages/model-bank/src/aiModels/volcengine.ts +1 -1
- package/packages/model-bank/src/aiModels/wenxin.ts +1 -1
- package/packages/model-bank/src/aiModels/xai.ts +1 -1
- package/packages/model-bank/src/aiModels/xinference.ts +1 -1
- package/packages/model-bank/src/aiModels/zeroone.ts +1 -1
- package/packages/model-bank/src/aiModels/zhipu.ts +1 -1
- package/packages/model-bank/src/index.ts +1 -0
- package/packages/model-bank/src/standard-parameters/index.ts +48 -0
- package/packages/{types/src → model-bank/src/types}/aiModel.ts +12 -1
- package/packages/model-bank/src/types/index.ts +1 -0
- package/packages/model-runtime/package.json +4 -1
- package/packages/model-runtime/src/BaseAI.ts +2 -2
- package/packages/model-runtime/src/ModelRuntime.test.ts +4 -4
- package/packages/model-runtime/src/RouterRuntime/createRuntime.ts +3 -7
- package/packages/model-runtime/src/ai302/index.ts +1 -1
- package/packages/model-runtime/src/aihubmix/index.ts +1 -2
- package/packages/model-runtime/src/anthropic/index.ts +1 -1
- package/packages/model-runtime/src/azureOpenai/index.ts +2 -3
- package/packages/model-runtime/src/azureai/index.ts +2 -3
- package/packages/model-runtime/src/bedrock/index.ts +1 -1
- package/packages/model-runtime/src/bfl/createImage.test.ts +4 -4
- package/packages/model-runtime/src/bfl/createImage.ts +2 -2
- package/packages/model-runtime/src/bfl/index.ts +1 -1
- package/packages/model-runtime/src/cloudflare/index.ts +1 -1
- package/packages/model-runtime/src/const/models.ts +64 -0
- package/packages/model-runtime/src/fal/index.test.ts +2 -3
- package/packages/model-runtime/src/fal/index.ts +1 -1
- package/packages/model-runtime/src/github/index.ts +1 -1
- package/packages/model-runtime/src/google/createImage.test.ts +1 -1
- package/packages/model-runtime/src/google/createImage.ts +53 -25
- package/packages/model-runtime/src/google/index.test.ts +1 -1
- package/packages/model-runtime/src/google/index.ts +4 -3
- package/packages/model-runtime/src/groq/index.ts +1 -1
- package/packages/model-runtime/src/helpers/parseToolCalls.ts +1 -2
- package/packages/model-runtime/src/huggingface/index.ts +1 -1
- package/packages/model-runtime/src/index.ts +3 -1
- package/packages/model-runtime/src/infiniai/index.ts +1 -1
- package/packages/model-runtime/src/ollama/index.test.ts +1 -1
- package/packages/model-runtime/src/ollama/index.ts +2 -3
- package/packages/model-runtime/src/openai/index.ts +16 -8
- package/packages/model-runtime/src/providerTestUtils.ts +1 -2
- package/packages/model-runtime/src/qiniu/index.test.ts +2 -3
- package/packages/model-runtime/src/qwen/index.ts +1 -1
- package/packages/model-runtime/src/siliconcloud/index.ts +2 -2
- package/packages/model-runtime/src/types/chat.ts +2 -22
- package/packages/model-runtime/src/{error.ts → types/error.ts} +29 -0
- package/packages/model-runtime/src/types/index.ts +4 -0
- package/packages/model-runtime/src/types/toolsCalling.ts +48 -0
- package/packages/model-runtime/src/types/type.ts +1 -1
- package/packages/model-runtime/src/types/usage.ts +27 -0
- package/packages/model-runtime/src/utils/anthropicHelpers.test.ts +2 -2
- package/packages/model-runtime/src/utils/anthropicHelpers.ts +1 -1
- package/packages/model-runtime/src/utils/createError.ts +1 -1
- package/packages/model-runtime/src/utils/errorResponse.test.ts +110 -0
- package/packages/model-runtime/src/utils/errorResponse.ts +64 -0
- package/packages/{utils/src → model-runtime/src/utils}/getFallbackModelProperty.ts +1 -1
- package/packages/model-runtime/src/utils/googleErrorParser.test.ts +1 -1
- package/packages/model-runtime/src/utils/googleErrorParser.ts +1 -1
- package/packages/model-runtime/src/utils/handleOpenAIError.ts +1 -1
- package/packages/model-runtime/src/utils/imageToBase64.test.ts +91 -0
- package/packages/model-runtime/src/utils/imageToBase64.ts +62 -0
- package/packages/model-runtime/src/utils/modelParse.test.ts +2 -2
- package/packages/model-runtime/src/utils/modelParse.ts +16 -10
- package/packages/model-runtime/src/utils/openaiCompatibleFactory/createImage.ts +1 -1
- package/packages/model-runtime/src/utils/openaiCompatibleFactory/index.ts +3 -3
- package/packages/model-runtime/src/utils/openaiHelpers.test.ts +2 -2
- package/packages/model-runtime/src/utils/openaiHelpers.ts +3 -4
- package/packages/model-runtime/src/utils/postProcessModelList.ts +2 -2
- package/packages/model-runtime/src/utils/safeParseJSON.test.ts +71 -0
- package/packages/model-runtime/src/utils/safeParseJSON.ts +12 -0
- package/packages/model-runtime/src/utils/streams/bedrock/claude.ts +1 -1
- package/packages/model-runtime/src/utils/streams/bedrock/llama.test.ts +1 -2
- package/packages/model-runtime/src/utils/streams/bedrock/llama.ts +1 -1
- package/packages/model-runtime/src/utils/streams/google-ai.test.ts +1 -1
- package/packages/model-runtime/src/utils/streams/google-ai.ts +1 -1
- package/packages/model-runtime/src/utils/streams/ollama.test.ts +1 -1
- package/packages/model-runtime/src/utils/streams/ollama.ts +2 -3
- package/packages/model-runtime/src/utils/streams/openai/openai.test.ts +1 -2
- package/packages/model-runtime/src/utils/streams/openai/openai.ts +1 -1
- package/packages/model-runtime/src/utils/streams/openai/responsesStream.ts +1 -1
- package/packages/model-runtime/src/utils/streams/protocol.ts +3 -3
- package/packages/model-runtime/src/utils/streams/vertex-ai.test.ts +1 -1
- package/packages/model-runtime/src/utils/streams/vertex-ai.ts +2 -2
- package/packages/model-runtime/src/utils/uuid.ts +7 -0
- package/packages/model-runtime/src/vertexai/index.ts +1 -1
- package/packages/types/src/agent/index.ts +2 -1
- package/packages/types/src/aiProvider.ts +10 -2
- package/packages/types/src/auth.ts +35 -0
- package/packages/types/src/discover/models.ts +1 -1
- package/packages/types/src/discover/providers.ts +1 -1
- package/packages/types/src/index.ts +4 -0
- package/packages/types/src/llm.ts +2 -47
- package/packages/types/src/session/agentSession.ts +3 -3
- package/packages/types/src/session/index.ts +2 -2
- package/packages/types/src/session/sessionGroup.ts +0 -2
- package/packages/types/src/user/settings/general.ts +1 -1
- package/packages/types/src/user/settings/modelProvider.ts +1 -1
- package/packages/utils/src/fetch/fetchSSE.ts +1 -1
- package/packages/utils/src/format.ts +2 -3
- package/packages/utils/src/index.ts +3 -1
- package/packages/utils/src/number.test.ts +1 -2
- package/packages/utils/src/number.ts +1 -2
- package/packages/utils/src/parseModels.test.ts +1 -2
- package/packages/utils/src/parseModels.ts +2 -3
- package/packages/utils/src/pricing.test.ts +1 -2
- package/packages/utils/src/pricing.ts +1 -1
- package/packages/utils/src/server/xor.ts +3 -1
- package/src/app/(backend)/middleware/auth/index.ts +1 -2
- package/src/app/(backend)/webapi/chat/vertexai/route.ts +1 -1
- package/src/app/(backend)/webapi/text-to-image/[provider]/route.ts +1 -2
- package/src/app/[variants]/(main)/(mobile)/me/settings/features/useCategory.tsx +2 -16
- package/src/app/[variants]/(main)/chat/@session/_layout/Desktop/SessionHeader.tsx +1 -3
- package/src/app/[variants]/(main)/chat/@session/_layout/Mobile/SessionHeader.tsx +1 -3
- package/src/app/[variants]/(main)/discover/(list)/model/features/List/ModelTypeIcon.tsx +1 -2
- package/src/app/[variants]/(main)/image/@menu/components/SeedNumberInput/index.tsx +1 -1
- package/src/app/[variants]/(main)/image/@menu/features/ConfigPanel/hooks/useAutoDimensions.ts +4 -3
- package/src/app/[variants]/(main)/settings/hooks/useCategory.tsx +3 -21
- package/src/app/[variants]/(main)/settings/provider/features/ModelList/CreateNewModelModal/Form.tsx +1 -1
- package/src/app/[variants]/(main)/settings/provider/features/ModelList/ModelItem.tsx +1 -1
- package/src/app/[variants]/(main)/settings/provider/features/ModelList/SortModelModal/ListItem.tsx +1 -1
- package/src/app/[variants]/(main)/settings/provider/features/ModelList/SortModelModal/index.tsx +1 -1
- package/src/components/ModelSelect/index.tsx +1 -1
- package/src/config/featureFlags/schema.test.ts +1 -2
- package/src/config/featureFlags/schema.ts +0 -6
- package/src/config/featureFlags/utils/parser.test.ts +7 -7
- package/src/database/_deprecated/core/index.ts +0 -1
- package/src/database/_deprecated/core/migrations/migrateSettingsToUser/type.ts +2 -5
- package/src/database/_deprecated/core/model.ts +4 -38
- package/src/database/_deprecated/models/message.ts +1 -1
- package/src/features/Conversation/Extras/Usage/UsageDetail/ModelCard.tsx +1 -1
- package/src/features/Conversation/Extras/Usage/UsageDetail/pricing.ts +3 -4
- package/src/features/Conversation/Extras/Usage/UsageDetail/tokens.test.ts +1 -1
- package/src/features/Conversation/Extras/Usage/UsageDetail/tokens.ts +3 -2
- package/src/layout/GlobalProvider/StoreInitialization.tsx +0 -3
- package/src/libs/trpc/async/context.ts +2 -1
- package/src/libs/trpc/edge/context.ts +2 -6
- package/src/libs/trpc/lambda/context.ts +1 -1
- package/src/migrations/FromV5ToV6/types/v5.ts +2 -2
- package/src/migrations/FromV5ToV6/types/v6.ts +2 -1
- package/src/server/globalConfig/genServerAiProviderConfig.ts +3 -3
- package/src/server/modules/ModelRuntime/index.test.ts +1 -1
- package/src/server/modules/ModelRuntime/index.ts +1 -1
- package/src/server/routers/async/caller.ts +2 -1
- package/src/server/routers/async/image.ts +2 -2
- package/src/server/routers/lambda/aiModel.ts +1 -1
- package/src/server/services/chunk/index.ts +2 -1
- package/src/server/services/generation/index.ts +2 -2
- package/src/services/_auth.ts +2 -1
- package/src/services/aiModel/server.test.ts +1 -1
- package/src/services/aiModel/type.ts +1 -1
- package/src/services/chat.ts +1 -1
- package/src/services/upload.ts +3 -3
- package/src/store/agent/slices/chat/action.ts +1 -1
- package/src/store/aiInfra/slices/aiModel/action.ts +6 -6
- package/src/store/aiInfra/slices/aiModel/initialState.ts +1 -1
- package/src/store/aiInfra/slices/aiModel/selectors.test.ts +1 -1
- package/src/store/aiInfra/slices/aiModel/selectors.ts +2 -1
- package/src/store/aiInfra/slices/aiProvider/__tests__/action.test.ts +7 -7
- package/src/store/aiInfra/slices/aiProvider/action.ts +8 -8
- package/src/store/aiInfra/slices/aiProvider/initialState.ts +2 -1
- package/src/store/electron/actions/app.ts +1 -1
- package/src/store/image/slices/generationConfig/action.test.ts +1 -1
- package/src/store/image/slices/generationConfig/action.ts +1 -1
- package/src/store/image/slices/generationConfig/hooks.test.ts +1 -1
- package/src/store/image/slices/generationConfig/hooks.ts +6 -3
- package/src/store/image/slices/generationConfig/selectors.test.ts +1 -1
- package/src/store/serverConfig/selectors.test.ts +0 -1
- package/src/store/user/initialState.ts +1 -4
- package/src/store/user/selectors.ts +0 -1
- package/src/store/user/slices/auth/action.ts +1 -1
- package/src/store/user/slices/auth/selectors.ts +3 -4
- package/src/store/user/slices/modelList/action.ts +8 -7
- package/src/store/user/slices/modelList/selectors/modelProvider.ts +8 -5
- package/src/store/user/slices/preference/selectors.ts +3 -2
- package/src/store/user/slices/settings/selectors/settings.ts +1 -2
- package/src/store/user/store.ts +1 -4
- package/docs/self-hosting/advanced/webrtc.mdx +0 -86
- package/docs/self-hosting/advanced/webrtc.zh-CN.mdx +0 -80
- package/packages/const/src/image.ts +0 -51
- package/src/app/[variants]/(main)/settings/sync/features/Alert.tsx +0 -53
- package/src/app/[variants]/(main)/settings/sync/features/DeviceInfo/Card.tsx +0 -42
- package/src/app/[variants]/(main)/settings/sync/features/DeviceInfo/DeviceName.tsx +0 -62
- package/src/app/[variants]/(main)/settings/sync/features/DeviceInfo/SystemIcon.tsx +0 -31
- package/src/app/[variants]/(main)/settings/sync/features/DeviceInfo/index.tsx +0 -103
- package/src/app/[variants]/(main)/settings/sync/features/WebRTC/ChannelNameInput.tsx +0 -45
- package/src/app/[variants]/(main)/settings/sync/features/WebRTC/SyncSwitch/index.css +0 -238
- package/src/app/[variants]/(main)/settings/sync/features/WebRTC/SyncSwitch/index.tsx +0 -79
- package/src/app/[variants]/(main)/settings/sync/features/WebRTC/generateRandomRoomName.ts +0 -4
- package/src/app/[variants]/(main)/settings/sync/features/WebRTC/index.tsx +0 -103
- package/src/app/[variants]/(main)/settings/sync/index.tsx +0 -17
- package/src/app/[variants]/(main)/settings/sync/page.tsx +0 -29
- package/src/database/_deprecated/core/sync.ts +0 -321
- package/src/features/SyncStatusInspector/DisableSync.tsx +0 -79
- package/src/features/SyncStatusInspector/EnableSync.tsx +0 -132
- package/src/features/SyncStatusInspector/EnableTag.tsx +0 -66
- package/src/features/SyncStatusInspector/index.tsx +0 -27
- package/src/hooks/useSyncData.ts +0 -50
- package/src/services/__tests__/sync.test.ts +0 -56
- package/src/services/sync.ts +0 -19
- package/src/store/user/slices/sync/action.test.ts +0 -164
- package/src/store/user/slices/sync/action.ts +0 -101
- package/src/store/user/slices/sync/initialState.ts +0 -13
- package/src/store/user/slices/sync/selectors.ts +0 -20
- /package/packages/{utils/src → model-runtime/src/utils}/getFallbackModelProperty.test.ts +0 -0
@@ -1,8 +1,7 @@
|
|
1
|
-
import { Icon
|
1
|
+
import { Icon } from '@lobehub/ui';
|
2
2
|
import {
|
3
3
|
Bot,
|
4
4
|
Brain,
|
5
|
-
Cloudy,
|
6
5
|
Database,
|
7
6
|
EthernetPort,
|
8
7
|
Info,
|
@@ -14,7 +13,6 @@ import {
|
|
14
13
|
import Link from 'next/link';
|
15
14
|
import { useMemo } from 'react';
|
16
15
|
import { useTranslation } from 'react-i18next';
|
17
|
-
import { Flexbox } from 'react-layout-kit';
|
18
16
|
|
19
17
|
import type { MenuProps } from '@/components/Menu';
|
20
18
|
import { isDeprecatedEdition, isDesktop } from '@/const/version';
|
@@ -24,8 +22,7 @@ import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfi
|
|
24
22
|
export const useCategory = () => {
|
25
23
|
const { t } = useTranslation('setting');
|
26
24
|
const mobile = useServerConfigStore((s) => s.isMobile);
|
27
|
-
const {
|
28
|
-
useServerConfigStore(featureFlagsSelectors);
|
25
|
+
const { showLLM, enableSTT, hideDocs } = useServerConfigStore(featureFlagsSelectors);
|
29
26
|
|
30
27
|
const cateItems: MenuProps['items'] = useMemo(
|
31
28
|
() =>
|
@@ -48,21 +45,6 @@ export const useCategory = () => {
|
|
48
45
|
</Link>
|
49
46
|
),
|
50
47
|
},
|
51
|
-
// TODO: remove in V2
|
52
|
-
enableWebrtc && {
|
53
|
-
icon: <Icon icon={Cloudy} />,
|
54
|
-
key: SettingsTabs.Sync,
|
55
|
-
label: (
|
56
|
-
<Link href={'/settings/sync'} onClick={(e) => e.preventDefault()}>
|
57
|
-
<Flexbox align={'center'} gap={8} horizontal>
|
58
|
-
{t('tab.sync')}
|
59
|
-
<Tag bordered={false} color={'warning'}>
|
60
|
-
{t('tab.experiment')}
|
61
|
-
</Tag>
|
62
|
-
</Flexbox>
|
63
|
-
</Link>
|
64
|
-
),
|
65
|
-
},
|
66
48
|
!mobile && {
|
67
49
|
icon: <Icon icon={KeyboardIcon} />,
|
68
50
|
key: SettingsTabs.Hotkey,
|
@@ -146,7 +128,7 @@ export const useCategory = () => {
|
|
146
128
|
),
|
147
129
|
},
|
148
130
|
].filter(Boolean) as MenuProps['items'],
|
149
|
-
[t,
|
131
|
+
[t, showLLM],
|
150
132
|
);
|
151
133
|
|
152
134
|
return cateItems;
|
package/src/app/[variants]/(main)/settings/provider/features/ModelList/CreateNewModelModal/Form.tsx
CHANGED
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next';
|
|
5
5
|
|
6
6
|
import MaxTokenSlider from '@/components/MaxTokenSlider';
|
7
7
|
import { useIsMobile } from '@/hooks/useIsMobile';
|
8
|
-
import { AiModelType } from '
|
8
|
+
import { AiModelType } from '../../../../../../../../../packages/model-bank/src/types/aiModel';
|
9
9
|
import { ChatModelCard } from '@/types/llm';
|
10
10
|
|
11
11
|
interface ModelConfigFormProps {
|
@@ -10,7 +10,7 @@ import { Flexbox } from 'react-layout-kit';
|
|
10
10
|
import { ModelInfoTags } from '@/components/ModelSelect';
|
11
11
|
import { useIsMobile } from '@/hooks/useIsMobile';
|
12
12
|
import { aiModelSelectors, useAiInfraStore } from '@/store/aiInfra';
|
13
|
-
import { AiModelSourceEnum, AiProviderModelListItem } from '
|
13
|
+
import { AiModelSourceEnum, AiProviderModelListItem } from '../../../../../../../../packages/model-bank/src/types/aiModel';
|
14
14
|
import { formatPriceByCurrency } from '@/utils/format';
|
15
15
|
import {
|
16
16
|
getAudioInputUnitRate,
|
package/src/app/[variants]/(main)/settings/provider/features/ModelList/SortModelModal/ListItem.tsx
CHANGED
@@ -3,7 +3,7 @@ import { SortableList } from '@lobehub/ui';
|
|
3
3
|
import { memo } from 'react';
|
4
4
|
import { Flexbox } from 'react-layout-kit';
|
5
5
|
|
6
|
-
import { AiProviderModelListItem } from '
|
6
|
+
import { AiProviderModelListItem } from '../../../../../../../../../packages/model-bank/src/types/aiModel';
|
7
7
|
|
8
8
|
const ListItem = memo<AiProviderModelListItem>(({ id, displayName }) => {
|
9
9
|
return (
|
package/src/app/[variants]/(main)/settings/provider/features/ModelList/SortModelModal/index.tsx
CHANGED
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { Flexbox } from 'react-layout-kit';
|
7
7
|
|
8
8
|
import { useAiInfraStore } from '@/store/aiInfra';
|
9
|
-
import { AiProviderModelListItem } from '
|
9
|
+
import { AiProviderModelListItem } from '../../../../../../../../../packages/model-bank/src/types/aiModel';
|
10
10
|
|
11
11
|
import ListItem from './ListItem';
|
12
12
|
|
@@ -15,7 +15,7 @@ import { FC, memo } from 'react';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
16
16
|
import { Flexbox } from 'react-layout-kit';
|
17
17
|
|
18
|
-
import { ModelAbilities } from '
|
18
|
+
import { ModelAbilities } from '../../../packages/model-bank/src/types/aiModel';
|
19
19
|
import { AiProviderSourceType } from '@/types/aiProvider';
|
20
20
|
import { ChatModelCard } from '@/types/llm';
|
21
21
|
import { formatTokenNumber } from '@/utils/format';
|
@@ -20,7 +20,7 @@ describe('FeatureFlagsSchema', () => {
|
|
20
20
|
|
21
21
|
it('should reject invalid feature flags', () => {
|
22
22
|
const result = FeatureFlagsSchema.safeParse({
|
23
|
-
|
23
|
+
edit_agent: 'yes', // Invalid type, should be boolean
|
24
24
|
});
|
25
25
|
|
26
26
|
expect(result.success).toBe(false);
|
@@ -43,7 +43,6 @@ describe('mapFeatureFlagsEnvToState', () => {
|
|
43
43
|
};
|
44
44
|
|
45
45
|
const expectedState = {
|
46
|
-
enableWebrtc: true,
|
47
46
|
isAgentEditable: false,
|
48
47
|
showCreateSession: true,
|
49
48
|
showLLM: false,
|
@@ -2,10 +2,6 @@
|
|
2
2
|
import { z } from 'zod';
|
3
3
|
|
4
4
|
export const FeatureFlagsSchema = z.object({
|
5
|
-
/**
|
6
|
-
* Enable WebRTC sync
|
7
|
-
*/
|
8
|
-
webrtc_sync: z.boolean().optional(),
|
9
5
|
check_updates: z.boolean().optional(),
|
10
6
|
pin_list: z.boolean().optional(),
|
11
7
|
|
@@ -51,7 +47,6 @@ export const FeatureFlagsSchema = z.object({
|
|
51
47
|
export type IFeatureFlags = z.infer<typeof FeatureFlagsSchema>;
|
52
48
|
|
53
49
|
export const DEFAULT_FEATURE_FLAGS: IFeatureFlags = {
|
54
|
-
webrtc_sync: false,
|
55
50
|
pin_list: false,
|
56
51
|
|
57
52
|
language_model_settings: true,
|
@@ -93,7 +88,6 @@ export const DEFAULT_FEATURE_FLAGS: IFeatureFlags = {
|
|
93
88
|
|
94
89
|
export const mapFeatureFlagsEnvToState = (config: IFeatureFlags) => {
|
95
90
|
return {
|
96
|
-
enableWebrtc: config.webrtc_sync,
|
97
91
|
isAgentEditable: config.edit_agent,
|
98
92
|
|
99
93
|
showCreateSession: config.create_session,
|
@@ -8,7 +8,7 @@ describe('parseFeatureFlag', () => {
|
|
8
8
|
});
|
9
9
|
|
10
10
|
it('should enable a feature when prefixed with +', () => {
|
11
|
-
expect(parseFeatureFlag('+
|
11
|
+
expect(parseFeatureFlag('+api_key_manage')).toEqual({ api_key_manage: true });
|
12
12
|
});
|
13
13
|
|
14
14
|
it('should disable a feature when prefixed with -', () => {
|
@@ -16,10 +16,10 @@ describe('parseFeatureFlag', () => {
|
|
16
16
|
});
|
17
17
|
|
18
18
|
it('should handle multiple flags separated by commas', () => {
|
19
|
-
const input = '+
|
19
|
+
const input = '+api_key_manage,-openai_api_key,+another_feature';
|
20
20
|
|
21
21
|
expect(parseFeatureFlag(input)).toEqual({
|
22
|
-
|
22
|
+
api_key_manage: true,
|
23
23
|
openai_api_key: false,
|
24
24
|
});
|
25
25
|
});
|
@@ -53,19 +53,19 @@ describe('parseFeatureFlag', () => {
|
|
53
53
|
});
|
54
54
|
|
55
55
|
it('should handle flags separated by Chinese commas', () => {
|
56
|
-
const input = '+
|
56
|
+
const input = '+api_key_manage,-openai_api_key';
|
57
57
|
|
58
58
|
expect(parseFeatureFlag(input)).toEqual({
|
59
|
-
|
59
|
+
api_key_manage: true,
|
60
60
|
openai_api_key: false,
|
61
61
|
});
|
62
62
|
});
|
63
63
|
|
64
64
|
it('should ignore whitespace around flags', () => {
|
65
|
-
const input = ' +
|
65
|
+
const input = ' +api_key_manage , -openai_api_key ';
|
66
66
|
|
67
67
|
expect(parseFeatureFlag(input)).toEqual({
|
68
|
-
|
68
|
+
api_key_manage: true,
|
69
69
|
openai_api_key: false,
|
70
70
|
});
|
71
71
|
});
|
@@ -1,9 +1,6 @@
|
|
1
|
+
import { FewShots, LobeAgentTTSConfig, MetaData, STTServer } from '@lobechat/types';
|
1
2
|
import type { ThemeMode } from 'antd-style';
|
2
|
-
|
3
|
-
import { LobeAgentTTSConfig } from '@/types/agent';
|
4
|
-
import { FewShots, LLMParams } from '@/types/llm';
|
5
|
-
import { MetaData } from '@/types/meta';
|
6
|
-
import { STTServer } from '@/types/user/settings';
|
3
|
+
import { LLMParams } from 'model-bank';
|
7
4
|
|
8
5
|
interface V4LobeAgentConfig {
|
9
6
|
autoCreateTopicThreshold: number;
|
@@ -4,7 +4,6 @@ import { ZodObject } from 'zod';
|
|
4
4
|
import { nanoid } from '@/utils/uuid';
|
5
5
|
|
6
6
|
import { BrowserDB, BrowserDBSchema, browserDB } from './db';
|
7
|
-
import { dataSync } from './sync';
|
8
7
|
import { DBBaseFieldsSchema } from './types/db';
|
9
8
|
|
10
9
|
export class BaseModel<N extends keyof BrowserDBSchema = any, T = BrowserDBSchema[N]['table']> {
|
@@ -22,10 +21,6 @@ export class BaseModel<N extends keyof BrowserDBSchema = any, T = BrowserDBSchem
|
|
22
21
|
return this.db[this._tableName] as Dexie.Table;
|
23
22
|
}
|
24
23
|
|
25
|
-
get yMap() {
|
26
|
-
return dataSync.getYMap(this._tableName);
|
27
|
-
}
|
28
|
-
|
29
24
|
// **************** Create *************** //
|
30
25
|
|
31
26
|
/**
|
@@ -79,7 +74,6 @@ export class BaseModel<N extends keyof BrowserDBSchema = any, T = BrowserDBSchem
|
|
79
74
|
*/
|
80
75
|
createWithNewId?: boolean;
|
81
76
|
idGenerator?: () => string;
|
82
|
-
withSync?: boolean;
|
83
77
|
} = {},
|
84
78
|
): Promise<{
|
85
79
|
added: number;
|
@@ -88,7 +82,7 @@ export class BaseModel<N extends keyof BrowserDBSchema = any, T = BrowserDBSchem
|
|
88
82
|
skips: string[];
|
89
83
|
success: boolean;
|
90
84
|
}> {
|
91
|
-
const { idGenerator = nanoid, createWithNewId = false
|
85
|
+
const { idGenerator = nanoid, createWithNewId = false } = options;
|
92
86
|
const validatedData: any[] = [];
|
93
87
|
const errors = [];
|
94
88
|
const skips: string[] = [];
|
@@ -141,15 +135,6 @@ export class BaseModel<N extends keyof BrowserDBSchema = any, T = BrowserDBSchem
|
|
141
135
|
try {
|
142
136
|
await this.table.bulkAdd(validatedData);
|
143
137
|
|
144
|
-
if (withSync) {
|
145
|
-
dataSync.transact(() => {
|
146
|
-
const pools = validatedData.map(async (item) => {
|
147
|
-
await this.updateYMapItem(item.id);
|
148
|
-
});
|
149
|
-
Promise.all(pools);
|
150
|
-
});
|
151
|
-
}
|
152
|
-
|
153
138
|
return {
|
154
139
|
added: validatedData.length,
|
155
140
|
ids: validatedData.map((item) => item.id),
|
@@ -174,28 +159,16 @@ export class BaseModel<N extends keyof BrowserDBSchema = any, T = BrowserDBSchem
|
|
174
159
|
// **************** Delete *************** //
|
175
160
|
|
176
161
|
protected async _deleteWithSync(id: string) {
|
177
|
-
|
178
|
-
// sync delete data to yjs data map
|
179
|
-
this.yMap?.delete(id);
|
180
|
-
return result;
|
162
|
+
return await this.table.delete(id);
|
181
163
|
}
|
182
164
|
|
183
165
|
protected async _bulkDeleteWithSync(keys: string[]) {
|
184
166
|
await this.table.bulkDelete(keys);
|
185
167
|
// sync delete data to yjs data map
|
186
|
-
|
187
|
-
dataSync.transact(() => {
|
188
|
-
keys.forEach((id) => {
|
189
|
-
this.yMap?.delete(id);
|
190
|
-
});
|
191
|
-
});
|
192
168
|
}
|
193
169
|
|
194
170
|
protected async _clearWithSync() {
|
195
|
-
|
196
|
-
// sync clear data to yjs data map
|
197
|
-
this.yMap?.clear();
|
198
|
-
return result;
|
171
|
+
return await this.table.clear();
|
199
172
|
}
|
200
173
|
|
201
174
|
// **************** Update *************** //
|
@@ -235,18 +208,11 @@ export class BaseModel<N extends keyof BrowserDBSchema = any, T = BrowserDBSchem
|
|
235
208
|
|
236
209
|
protected async _bulkPutWithSync(items: T[]) {
|
237
210
|
await this.table.bulkPut(items);
|
238
|
-
|
239
|
-
await dataSync.transact(() => {
|
240
|
-
items.forEach((items) => {
|
241
|
-
this.updateYMapItem((items as any).id);
|
242
|
-
});
|
243
|
-
});
|
244
211
|
}
|
245
212
|
|
246
213
|
// **************** Helper *************** //
|
247
214
|
|
248
215
|
private updateYMapItem = async (id: string) => {
|
249
|
-
|
250
|
-
this.yMap?.set(id, newData);
|
216
|
+
await this.table.get(id);
|
251
217
|
};
|
252
218
|
}
|
@@ -118,7 +118,7 @@ class _MessageModel extends BaseModel {
|
|
118
118
|
async batchCreate(messages: ChatMessage[]) {
|
119
119
|
const data: DB_Message[] = messages.map((m) => this.mapChatMessageToDBMessage(m));
|
120
120
|
|
121
|
-
return this._batchAdd(data
|
121
|
+
return this._batchAdd(data);
|
122
122
|
}
|
123
123
|
|
124
124
|
async duplicateMessages(messages: ChatMessage[]): Promise<ChatMessage[]> {
|
@@ -9,7 +9,7 @@ import { Flexbox } from 'react-layout-kit';
|
|
9
9
|
import { getPrice } from '@/features/Conversation/Extras/Usage/UsageDetail/pricing';
|
10
10
|
import { useGlobalStore } from '@/store/global';
|
11
11
|
import { systemStatusSelectors } from '@/store/global/selectors';
|
12
|
-
import { LobeDefaultAiModelListItem } from '
|
12
|
+
import { LobeDefaultAiModelListItem } from '../../../../../../packages/model-bank/src/types/aiModel';
|
13
13
|
import { getCachedTextInputUnitRate, getWriteCacheInputUnitRate } from '@/utils/pricing';
|
14
14
|
|
15
15
|
export const useStyles = createStyles(({ css, token }) => {
|
@@ -1,12 +1,11 @@
|
|
1
|
-
import { Pricing } from '@/types/aiModel';
|
2
|
-
import { ModelPriceCurrency } from '@/types/llm';
|
3
|
-
import { formatPriceByCurrency } from '@/utils/format';
|
4
1
|
import {
|
2
|
+
formatPriceByCurrency,
|
5
3
|
getCachedTextInputUnitRate,
|
6
4
|
getTextInputUnitRate,
|
7
5
|
getTextOutputUnitRate,
|
8
6
|
getWriteCacheInputUnitRate,
|
9
|
-
} from '
|
7
|
+
} from '@lobechat/utils';
|
8
|
+
import { ModelPriceCurrency, Pricing } from 'model-bank';
|
10
9
|
|
11
10
|
export const getPrice = (pricing: Pricing) => {
|
12
11
|
const inputRate = getTextInputUnitRate(pricing);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
2
2
|
|
3
|
-
import { LobeDefaultAiModelListItem } from '
|
3
|
+
import { LobeDefaultAiModelListItem } from '../../../../../../packages/model-bank/src/types/aiModel';
|
4
4
|
import { ModelTokensUsage } from '@/types/message';
|
5
5
|
|
6
6
|
import { getDetailsToken } from './tokens';
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import type { ModelTokensUsage } from '@lobechat/model-runtime';
|
2
|
+
import { LobeDefaultAiModelListItem } from 'model-bank';
|
3
|
+
|
3
4
|
import { getAudioInputUnitRate, getAudioOutputUnitRate } from '@/utils/pricing';
|
4
5
|
|
5
6
|
import { getPrice } from './pricing';
|
@@ -7,7 +7,6 @@ import { createStoreUpdater } from 'zustand-utils';
|
|
7
7
|
|
8
8
|
import { enableNextAuth } from '@/const/auth';
|
9
9
|
import { useIsMobile } from '@/hooks/useIsMobile';
|
10
|
-
import { useEnabledDataSync } from '@/hooks/useSyncData';
|
11
10
|
import { useAgentStore } from '@/store/agent';
|
12
11
|
import { useAiInfraStore } from '@/store/aiInfra';
|
13
12
|
import { useGlobalStore } from '@/store/global';
|
@@ -70,8 +69,6 @@ const StoreInitialization = memo(() => {
|
|
70
69
|
},
|
71
70
|
});
|
72
71
|
|
73
|
-
useEnabledDataSync();
|
74
|
-
|
75
72
|
const useStoreUpdater = createStoreUpdater(useGlobalStore);
|
76
73
|
|
77
74
|
const mobile = useIsMobile();
|
@@ -1,7 +1,8 @@
|
|
1
|
+
import { ClientSecretPayload } from '@lobechat/types';
|
1
2
|
import debug from 'debug';
|
2
3
|
import { NextRequest } from 'next/server';
|
3
4
|
|
4
|
-
import {
|
5
|
+
import { LOBE_CHAT_AUTH_HEADER } from '@/const/auth';
|
5
6
|
import { LobeChatDatabase } from '@/database/type';
|
6
7
|
import { KeyVaultsGateKeeper } from '@/server/modules/KeyVaultsEncrypt';
|
7
8
|
|
@@ -1,12 +1,8 @@
|
|
1
|
+
import { ClientSecretPayload } from '@lobechat/types';
|
1
2
|
import { User } from 'next-auth';
|
2
3
|
import { NextRequest } from 'next/server';
|
3
4
|
|
4
|
-
import {
|
5
|
-
ClientSecretPayload,
|
6
|
-
LOBE_CHAT_AUTH_HEADER,
|
7
|
-
enableClerk,
|
8
|
-
enableNextAuth,
|
9
|
-
} from '@/const/auth';
|
5
|
+
import { LOBE_CHAT_AUTH_HEADER, enableClerk, enableNextAuth } from '@/const/auth';
|
10
6
|
import { ClerkAuth, IClerkAuth } from '@/libs/clerk-auth';
|
11
7
|
|
12
8
|
export interface AuthContext {
|
@@ -1,10 +1,10 @@
|
|
1
|
+
import { ClientSecretPayload } from '@lobechat/types';
|
1
2
|
import { parse } from 'cookie';
|
2
3
|
import debug from 'debug';
|
3
4
|
import { User } from 'next-auth';
|
4
5
|
import { NextRequest } from 'next/server';
|
5
6
|
|
6
7
|
import {
|
7
|
-
ClientSecretPayload,
|
8
8
|
LOBE_CHAT_AUTH_HEADER,
|
9
9
|
LOBE_CHAT_OIDC_AUTH_HEADER,
|
10
10
|
enableClerk,
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { ModelProvider } from '@lobechat/model-runtime';
|
2
|
+
import { ProviderConfig } from '@lobechat/types';
|
3
|
+
import { extractEnabledModels, transformToAiModelList } from '@lobechat/utils';
|
2
4
|
import * as AiModels from 'model-bank';
|
5
|
+
import { AiFullModelCard } from 'model-bank';
|
3
6
|
|
4
7
|
import { getLLMConfig } from '@/config/llm';
|
5
|
-
import { AiFullModelCard } from '@/types/aiModel';
|
6
|
-
import { ProviderConfig } from '@/types/user/settings';
|
7
|
-
import { extractEnabledModels, transformToAiModelList } from '@/utils/parseModels';
|
8
8
|
|
9
9
|
interface ProviderSpecificConfig {
|
10
10
|
enabled?: boolean;
|
@@ -21,9 +21,9 @@ import {
|
|
21
21
|
ModelProvider,
|
22
22
|
} from '@lobechat/model-runtime';
|
23
23
|
import { ModelRuntime } from '@lobechat/model-runtime';
|
24
|
+
import { ClientSecretPayload } from '@lobechat/types';
|
24
25
|
import { describe, expect, it, vi } from 'vitest';
|
25
26
|
|
26
|
-
import { ClientSecretPayload } from '@/const/auth';
|
27
27
|
import { LobeStepfunAI } from '@/libs/model-runtime/stepfun';
|
28
28
|
|
29
29
|
import { initModelRuntimeWithUserPayload } from './index';
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { ModelProvider, ModelRuntime } from '@lobechat/model-runtime';
|
2
|
+
import { ClientSecretPayload } from '@lobechat/types';
|
2
3
|
|
3
4
|
import { getLLMConfig } from '@/config/llm';
|
4
|
-
import { ClientSecretPayload } from '@/const/auth';
|
5
5
|
|
6
6
|
import apiKeyManager from './apiKeyManager';
|
7
7
|
|
@@ -1,9 +1,10 @@
|
|
1
|
+
import { ClientSecretPayload } from '@lobechat/types';
|
1
2
|
import { createTRPCClient, httpLink } from '@trpc/client';
|
2
3
|
import superjson from 'superjson';
|
3
4
|
import urlJoin from 'url-join';
|
4
5
|
|
5
6
|
import { serverDBEnv } from '@/config/db';
|
6
|
-
import {
|
7
|
+
import { LOBE_CHAT_AUTH_HEADER } from '@/const/auth';
|
7
8
|
import { isDesktop } from '@/const/version';
|
8
9
|
import { appEnv } from '@/envs/app';
|
9
10
|
import { createAsyncCallerFactory } from '@/libs/trpc/async';
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { AgentRuntimeErrorType } from '@lobechat/model-runtime';
|
2
|
+
import { AsyncTaskError, AsyncTaskErrorType, AsyncTaskStatus } from '@lobechat/types';
|
1
3
|
import debug from 'debug';
|
2
4
|
import { RuntimeImageGenParams } from 'model-bank';
|
3
5
|
import { z } from 'zod';
|
@@ -5,11 +7,9 @@ import { z } from 'zod';
|
|
5
7
|
import { ASYNC_TASK_TIMEOUT, AsyncTaskModel } from '@/database/models/asyncTask';
|
6
8
|
import { FileModel } from '@/database/models/file';
|
7
9
|
import { GenerationModel } from '@/database/models/generation';
|
8
|
-
import { AgentRuntimeErrorType } from '@/libs/model-runtime/error';
|
9
10
|
import { asyncAuthedProcedure, asyncRouter as router } from '@/libs/trpc/async';
|
10
11
|
import { initModelRuntimeWithUserPayload } from '@/server/modules/ModelRuntime';
|
11
12
|
import { GenerationService } from '@/server/services/generation';
|
12
|
-
import { AsyncTaskError, AsyncTaskErrorType, AsyncTaskStatus } from '@/types/asyncTask';
|
13
13
|
|
14
14
|
const log = debug('lobe-image:async');
|
15
15
|
|
@@ -12,7 +12,7 @@ import {
|
|
12
12
|
CreateAiModelSchema,
|
13
13
|
ToggleAiModelEnableSchema,
|
14
14
|
UpdateAiModelSchema,
|
15
|
-
} from '
|
15
|
+
} from '../../../../packages/model-bank/src/types/aiModel';
|
16
16
|
import { ProviderConfig } from '@/types/user/settings';
|
17
17
|
|
18
18
|
const aiModelProcedure = authedProcedure.use(serverDatabase).use(async (opts) => {
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import { ClientSecretPayload } from '
|
1
|
+
import { ClientSecretPayload } from '@lobechat/types';
|
2
|
+
|
2
3
|
import { AsyncTaskModel } from '@/database/models/asyncTask';
|
3
4
|
import { FileModel } from '@/database/models/file';
|
4
5
|
import { LobeChatDatabase } from '@/database/type';
|
@@ -1,12 +1,12 @@
|
|
1
|
+
import { parseDataUri } from '@lobechat/model-runtime';
|
1
2
|
import debug from 'debug';
|
2
3
|
import { sha256 } from 'js-sha256';
|
3
4
|
import mime from 'mime';
|
5
|
+
import { IMAGE_GENERATION_CONFIG } from 'model-bank';
|
4
6
|
import { nanoid } from 'nanoid';
|
5
7
|
import sharp from 'sharp';
|
6
8
|
|
7
|
-
import { IMAGE_GENERATION_CONFIG } from '@/const/image';
|
8
9
|
import { LobeChatDatabase } from '@/database/type';
|
9
|
-
import { parseDataUri } from '@/libs/model-runtime/utils/uriParser';
|
10
10
|
import { FileService } from '@/server/services/file';
|
11
11
|
import { calculateThumbnailDimensions } from '@/utils/number';
|
12
12
|
import { getYYYYmmddHHMMss } from '@/utils/time';
|
package/src/services/_auth.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import { ModelProvider } from '@lobechat/model-runtime';
|
2
|
+
import { ClientSecretPayload } from '@lobechat/types';
|
2
3
|
|
3
|
-
import {
|
4
|
+
import { LOBE_CHAT_AUTH_HEADER } from '@/const/auth';
|
4
5
|
import { isDeprecatedEdition } from '@/const/version';
|
5
6
|
import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
|
6
7
|
import { useUserStore } from '@/store/user';
|
@@ -1,7 +1,7 @@
|
|
1
|
+
import { AiProviderModelListItem } from 'model-bank';
|
1
2
|
import { describe, expect, it, vi } from 'vitest';
|
2
3
|
|
3
4
|
import { lambdaClient } from '@/libs/trpc/client';
|
4
|
-
import { AiProviderModelListItem } from '@/types/aiModel';
|
5
5
|
|
6
6
|
import { ServerService } from './server';
|
7
7
|
|
package/src/services/chat.ts
CHANGED
@@ -3,6 +3,7 @@ import {
|
|
3
3
|
ChatCompletionErrorPayload,
|
4
4
|
ModelProvider,
|
5
5
|
ModelRuntime,
|
6
|
+
parseDataUri,
|
6
7
|
} from '@lobechat/model-runtime';
|
7
8
|
import { BuiltinSystemRolePrompts, filesPrompts } from '@lobechat/prompts';
|
8
9
|
import { ChatErrorType, TracePayload, TraceTagMap } from '@lobechat/types';
|
@@ -15,7 +16,6 @@ import { INBOX_GUIDE_SYSTEMROLE } from '@/const/guide';
|
|
15
16
|
import { INBOX_SESSION_ID } from '@/const/session';
|
16
17
|
import { DEFAULT_AGENT_CONFIG } from '@/const/settings';
|
17
18
|
import { isDeprecatedEdition, isDesktop, isServerMode } from '@/const/version';
|
18
|
-
import { parseDataUri } from '@/libs/model-runtime/utils/uriParser';
|
19
19
|
import { getAgentStoreState } from '@/store/agent';
|
20
20
|
import { agentChatConfigSelectors } from '@/store/agent/selectors';
|
21
21
|
import { aiModelSelectors, aiProviderSelectors, getAiInfraStoreState } from '@/store/aiInfra';
|
package/src/services/upload.ts
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
+
import { isDesktop, isServerMode } from '@lobechat/const';
|
2
|
+
import { parseDataUri } from '@lobechat/model-runtime';
|
3
|
+
import { uuid } from '@lobechat/utils';
|
1
4
|
import dayjs from 'dayjs';
|
2
5
|
import { sha256 } from 'js-sha256';
|
3
6
|
|
4
7
|
import { fileEnv } from '@/config/file';
|
5
|
-
import { isDesktop, isServerMode } from '@/const/version';
|
6
|
-
import { parseDataUri } from '@/libs/model-runtime/utils/uriParser';
|
7
8
|
import { edgeClient } from '@/libs/trpc/client';
|
8
9
|
import { API_ENDPOINTS } from '@/services/_url';
|
9
10
|
import { clientS3Storage } from '@/services/file/ClientS3';
|
10
11
|
import { FileMetadata, UploadBase64ToS3Result } from '@/types/files';
|
11
12
|
import { FileUploadState, FileUploadStatus } from '@/types/files/upload';
|
12
|
-
import { uuid } from '@/utils/uuid';
|
13
13
|
|
14
14
|
export const UPLOAD_NETWORK_ERROR = 'NetWorkError';
|
15
15
|
|
@@ -15,7 +15,7 @@ import { LobeAgentChatConfig, LobeAgentConfig } from '@/types/agent';
|
|
15
15
|
import { KnowledgeItem } from '@/types/knowledgeBase';
|
16
16
|
import { merge } from '@/utils/merge';
|
17
17
|
|
18
|
-
import { AgentStore } from '../../store';
|
18
|
+
import type { AgentStore } from '../../store';
|
19
19
|
import { agentSelectors } from './selectors';
|
20
20
|
|
21
21
|
/**
|