@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,42 +0,0 @@
|
|
1
|
-
import { createStyles } from 'antd-style';
|
2
|
-
import { ReactNode, memo } from 'react';
|
3
|
-
import { Center, Flexbox } from 'react-layout-kit';
|
4
|
-
|
5
|
-
const useStyles = createStyles(({ css, token, responsive }) => ({
|
6
|
-
container: css`
|
7
|
-
border-radius: ${token.borderRadius}px;
|
8
|
-
background: ${token.colorFillTertiary};
|
9
|
-
|
10
|
-
.${responsive.mobile} {
|
11
|
-
width: 100%;
|
12
|
-
}
|
13
|
-
`,
|
14
|
-
icon: css`
|
15
|
-
width: 24px;
|
16
|
-
height: 24px;
|
17
|
-
`,
|
18
|
-
title: css`
|
19
|
-
font-size: 16px;
|
20
|
-
`,
|
21
|
-
}));
|
22
|
-
|
23
|
-
const Card = memo<{ icon: ReactNode; title: string }>(({ title, icon }) => {
|
24
|
-
const { styles } = useStyles();
|
25
|
-
|
26
|
-
return (
|
27
|
-
<Flexbox
|
28
|
-
align={'center'}
|
29
|
-
className={styles.container}
|
30
|
-
flex={1}
|
31
|
-
gap={12}
|
32
|
-
horizontal
|
33
|
-
paddingBlock={12}
|
34
|
-
paddingInline={20}
|
35
|
-
>
|
36
|
-
<Center className={styles.icon}>{icon}</Center>
|
37
|
-
<div className={styles.title}>{title}</div>
|
38
|
-
</Flexbox>
|
39
|
-
);
|
40
|
-
});
|
41
|
-
|
42
|
-
export default Card;
|
@@ -1,62 +0,0 @@
|
|
1
|
-
'use client';
|
2
|
-
|
3
|
-
import { EditableText, Text } from '@lobehub/ui';
|
4
|
-
import { memo, useState } from 'react';
|
5
|
-
import { useTranslation } from 'react-i18next';
|
6
|
-
import { Flexbox } from 'react-layout-kit';
|
7
|
-
|
8
|
-
import { useUserStore } from '@/store/user';
|
9
|
-
import { syncSettingsSelectors } from '@/store/user/selectors';
|
10
|
-
|
11
|
-
const DeviceName = memo(() => {
|
12
|
-
const { t } = useTranslation('setting');
|
13
|
-
|
14
|
-
const [deviceName, setSettings] = useUserStore((s) => [
|
15
|
-
syncSettingsSelectors.deviceName(s),
|
16
|
-
s.setSettings,
|
17
|
-
]);
|
18
|
-
|
19
|
-
const [editing, setEditing] = useState(false);
|
20
|
-
|
21
|
-
const updateDeviceName = (deviceName: string) => {
|
22
|
-
setSettings({ sync: { deviceName } });
|
23
|
-
setEditing(false);
|
24
|
-
};
|
25
|
-
|
26
|
-
return (
|
27
|
-
<Flexbox
|
28
|
-
align={'center'}
|
29
|
-
flex={1}
|
30
|
-
height={40}
|
31
|
-
horizontal
|
32
|
-
style={{ fontSize: 20, fontWeight: 'bold', lineHeight: 1, minWidth: 240, paddingLeft: 8 }}
|
33
|
-
>
|
34
|
-
{!deviceName && !editing && (
|
35
|
-
<Flexbox
|
36
|
-
onClick={() => {
|
37
|
-
setEditing(true);
|
38
|
-
}}
|
39
|
-
style={{ cursor: 'pointer' }}
|
40
|
-
>
|
41
|
-
<Text type={'secondary'}>{t('sync.device.deviceName.hint')}</Text>
|
42
|
-
</Flexbox>
|
43
|
-
)}
|
44
|
-
<EditableText
|
45
|
-
editing={editing}
|
46
|
-
inputProps={{
|
47
|
-
placeholder: t('sync.device.deviceName.placeholder'),
|
48
|
-
}}
|
49
|
-
onBlur={(e) => updateDeviceName(e.target.value)}
|
50
|
-
onChange={(e) => {
|
51
|
-
updateDeviceName(e);
|
52
|
-
}}
|
53
|
-
onEditingChange={setEditing}
|
54
|
-
size={'large'}
|
55
|
-
value={deviceName}
|
56
|
-
variant={'filled'}
|
57
|
-
/>
|
58
|
-
</Flexbox>
|
59
|
-
);
|
60
|
-
});
|
61
|
-
|
62
|
-
export default DeviceName;
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
SiAndroid,
|
3
|
-
SiApple,
|
4
|
-
SiBlackberry,
|
5
|
-
SiGooglechrome,
|
6
|
-
SiLinux,
|
7
|
-
SiWindows11,
|
8
|
-
} from '@icons-pack/react-simple-icons';
|
9
|
-
import { memo } from 'react';
|
10
|
-
|
11
|
-
const SystemIcon = memo<{ title?: string }>(({ title }) => {
|
12
|
-
if (!title) return;
|
13
|
-
|
14
|
-
if (['Mac OS', 'iOS', 'iPadOS'].includes(title)) return <SiApple size={24} />;
|
15
|
-
|
16
|
-
// Remove Microsoft brands in @icons-pack/react-simple-icons v10
|
17
|
-
// https://github.com/simple-icons/simple-icons/pull/10019
|
18
|
-
if (['Windows'].includes(title)) return <SiWindows11 size={24} />;
|
19
|
-
|
20
|
-
if (title === 'Android') return <SiAndroid size={24} />;
|
21
|
-
|
22
|
-
if (['BlackBerry'].includes(title)) return <SiBlackberry size={24} />;
|
23
|
-
|
24
|
-
if (title === 'Linux') return <SiLinux size={24} />;
|
25
|
-
|
26
|
-
if (title === 'Chrome OS') return <SiGooglechrome size={24} />;
|
27
|
-
|
28
|
-
return null;
|
29
|
-
});
|
30
|
-
|
31
|
-
export default SystemIcon;
|
@@ -1,103 +0,0 @@
|
|
1
|
-
'use client';
|
2
|
-
|
3
|
-
import { Text } from '@lobehub/ui';
|
4
|
-
import { createStyles } from 'antd-style';
|
5
|
-
import { rgba } from 'polished';
|
6
|
-
import { memo } from 'react';
|
7
|
-
import { useTranslation } from 'react-i18next';
|
8
|
-
import { Flexbox } from 'react-layout-kit';
|
9
|
-
|
10
|
-
import { BrowserIcon } from '@/components/BrowserIcon';
|
11
|
-
import { MAX_WIDTH } from '@/const/layoutTokens';
|
12
|
-
|
13
|
-
import Card from './Card';
|
14
|
-
import DeviceName from './DeviceName';
|
15
|
-
import SystemIcon from './SystemIcon';
|
16
|
-
|
17
|
-
const useStyles = createStyles(({ css, cx, responsive, isDarkMode, token, stylish }) => ({
|
18
|
-
container: css`
|
19
|
-
position: relative;
|
20
|
-
width: 100%;
|
21
|
-
border-radius: ${token.borderRadiusLG}px;
|
22
|
-
`,
|
23
|
-
content: css`
|
24
|
-
z-index: 2;
|
25
|
-
padding: 8px;
|
26
|
-
border-radius: ${token.borderRadiusLG - 1}px;
|
27
|
-
background: ${rgba(token.colorBgContainer, isDarkMode ? 0.7 : 1)};
|
28
|
-
`,
|
29
|
-
glow: cx(
|
30
|
-
stylish.gradientAnimation,
|
31
|
-
css`
|
32
|
-
pointer-events: none;
|
33
|
-
opacity: 0.5;
|
34
|
-
background-image: linear-gradient(
|
35
|
-
-45deg,
|
36
|
-
${isDarkMode ? token.geekblue4 : token.geekblue},
|
37
|
-
${isDarkMode ? token.cyan4 : token.cyan}
|
38
|
-
);
|
39
|
-
animation-duration: 10s;
|
40
|
-
`,
|
41
|
-
),
|
42
|
-
wrapper: css`
|
43
|
-
${responsive.mobile} {
|
44
|
-
padding-block: 8px;
|
45
|
-
padding-inline: 4px;
|
46
|
-
}
|
47
|
-
`,
|
48
|
-
}));
|
49
|
-
|
50
|
-
interface DeviceCardProps {
|
51
|
-
browser?: string;
|
52
|
-
os?: string;
|
53
|
-
}
|
54
|
-
|
55
|
-
const DeviceCard = memo<DeviceCardProps>(({ browser, os }) => {
|
56
|
-
const { styles } = useStyles();
|
57
|
-
const { t } = useTranslation('setting');
|
58
|
-
|
59
|
-
return (
|
60
|
-
<Flexbox
|
61
|
-
className={styles.wrapper}
|
62
|
-
style={{ maxWidth: MAX_WIDTH, position: 'relative' }}
|
63
|
-
width={'100%'}
|
64
|
-
>
|
65
|
-
<Flexbox className={styles.container} padding={4}>
|
66
|
-
<Flexbox horizontal paddingBlock={8} paddingInline={12}>
|
67
|
-
<div>
|
68
|
-
<Text strong style={{ fontSize: 18 }}>
|
69
|
-
{t('sync.device.title')}
|
70
|
-
</Text>
|
71
|
-
</div>
|
72
|
-
</Flexbox>
|
73
|
-
<Flexbox
|
74
|
-
align={'center'}
|
75
|
-
className={styles.content}
|
76
|
-
flex={1}
|
77
|
-
gap={16}
|
78
|
-
horizontal
|
79
|
-
justify={'space-between'}
|
80
|
-
padding={12}
|
81
|
-
wrap={'wrap'}
|
82
|
-
>
|
83
|
-
<DeviceName />
|
84
|
-
<Flexbox flex={1} gap={12} horizontal>
|
85
|
-
<Card icon={<SystemIcon title={os} />} title={os || t('sync.device.unknownOS')} />
|
86
|
-
<Card
|
87
|
-
icon={browser && <BrowserIcon browser={browser} size={24} />}
|
88
|
-
title={browser || t('sync.device.unknownBrowser')}
|
89
|
-
/>
|
90
|
-
</Flexbox>
|
91
|
-
</Flexbox>
|
92
|
-
<Flexbox
|
93
|
-
className={styles.glow}
|
94
|
-
height={'100%'}
|
95
|
-
style={{ left: 0, position: 'absolute', top: 0 }}
|
96
|
-
width={'100%'}
|
97
|
-
/>
|
98
|
-
</Flexbox>
|
99
|
-
</Flexbox>
|
100
|
-
);
|
101
|
-
});
|
102
|
-
|
103
|
-
export default DeviceCard;
|
@@ -1,45 +0,0 @@
|
|
1
|
-
import { ActionIcon, Input, InputProps } from '@lobehub/ui';
|
2
|
-
import { FormInstance } from 'antd/es/form/hooks/useForm';
|
3
|
-
import { LucideDices } from 'lucide-react';
|
4
|
-
import { memo, useState } from 'react';
|
5
|
-
import { useTranslation } from 'react-i18next';
|
6
|
-
|
7
|
-
import { generateRandomRoomName } from './generateRandomRoomName';
|
8
|
-
|
9
|
-
interface ChannelNameInputProps extends Omit<InputProps, 'form'> {
|
10
|
-
form: FormInstance;
|
11
|
-
}
|
12
|
-
|
13
|
-
const ChannelNameInput = memo<ChannelNameInputProps>(({ form, ...rest }) => {
|
14
|
-
const { t } = useTranslation('setting');
|
15
|
-
const [loading, setLoading] = useState(false);
|
16
|
-
|
17
|
-
return (
|
18
|
-
<Input
|
19
|
-
placeholder={t('sync.webrtc.channelName.placeholder')}
|
20
|
-
suffix={
|
21
|
-
<ActionIcon
|
22
|
-
active
|
23
|
-
icon={LucideDices}
|
24
|
-
loading={loading}
|
25
|
-
onClick={async () => {
|
26
|
-
setLoading(true);
|
27
|
-
const name = await generateRandomRoomName();
|
28
|
-
setLoading(false);
|
29
|
-
form.setFieldValue(['sync', 'webrtc', 'channelName'], name);
|
30
|
-
form.setFieldValue(['sync', 'webrtc', 'enabled'], false);
|
31
|
-
form.submit();
|
32
|
-
}}
|
33
|
-
size={'small'}
|
34
|
-
style={{
|
35
|
-
marginRight: -4,
|
36
|
-
}}
|
37
|
-
title={t('sync.webrtc.channelName.shuffle')}
|
38
|
-
/>
|
39
|
-
}
|
40
|
-
{...rest}
|
41
|
-
/>
|
42
|
-
);
|
43
|
-
});
|
44
|
-
|
45
|
-
export default ChannelNameInput;
|
@@ -1,238 +0,0 @@
|
|
1
|
-
/* stylelint-disable */
|
2
|
-
.wrapper {
|
3
|
-
--hue: 223;
|
4
|
-
--off-hue: 3;
|
5
|
-
--on-hue1: 123;
|
6
|
-
--on-hue2: 168;
|
7
|
-
--fg: hsl(var(--hue), 10%, 90%);
|
8
|
-
--primary: hsl(var(--hue), 90%, 50%);
|
9
|
-
--trans-dur: 0.6s;
|
10
|
-
--trans-timing: cubic-bezier(0.65, 0, 0.35, 1);
|
11
|
-
|
12
|
-
font-size: 14px;
|
13
|
-
}
|
14
|
-
|
15
|
-
.switch,
|
16
|
-
.switch__input {
|
17
|
-
-webkit-tap-highlight-color: #0000;
|
18
|
-
}
|
19
|
-
|
20
|
-
.switch {
|
21
|
-
position: relative;
|
22
|
-
|
23
|
-
display: block;
|
24
|
-
|
25
|
-
width: 5em;
|
26
|
-
height: 3em;
|
27
|
-
margin: auto;
|
28
|
-
}
|
29
|
-
|
30
|
-
.switch__base-outer,
|
31
|
-
.switch__base-inner {
|
32
|
-
position: absolute;
|
33
|
-
display: block;
|
34
|
-
}
|
35
|
-
|
36
|
-
.switch__base-outer {
|
37
|
-
top: 0.125em;
|
38
|
-
left: 0.125em;
|
39
|
-
|
40
|
-
width: 4.75em;
|
41
|
-
height: 2.75em;
|
42
|
-
|
43
|
-
border-radius: 1.25em;
|
44
|
-
box-shadow:
|
45
|
-
-0.125em -0.125em 0.25em hsl(var(--hue), 10%, 30%),
|
46
|
-
0.125em 0.125em 0.125em hsl(var(--hue), 10%, 30%) inset,
|
47
|
-
0.125em 0.125em 0.25em hsl(0deg, 0%, 0%),
|
48
|
-
-0.125em -0.125em 0.125em hsl(var(--hue), 10%, 5%) inset;
|
49
|
-
}
|
50
|
-
|
51
|
-
.switch__base-inner {
|
52
|
-
top: 0.375em;
|
53
|
-
left: 0.375em;
|
54
|
-
|
55
|
-
width: 4.25em;
|
56
|
-
height: 2.25em;
|
57
|
-
|
58
|
-
border-radius: 1.125em;
|
59
|
-
box-shadow:
|
60
|
-
-0.25em -0.25em 0.25em hsl(var(--hue), 10%, 30%) inset,
|
61
|
-
0.0625em 0.0625em 0.125em hsla(var(--hue), 10%, 30%),
|
62
|
-
0.125em 0.25em 0.25em hsl(var(--hue), 10%, 5%) inset,
|
63
|
-
-0.0625em -0.0625em 0.125em hsla(var(--hue), 10%, 5%);
|
64
|
-
}
|
65
|
-
|
66
|
-
.switch__base-neon {
|
67
|
-
position: absolute;
|
68
|
-
top: 0;
|
69
|
-
left: 0;
|
70
|
-
|
71
|
-
overflow: visible;
|
72
|
-
display: block;
|
73
|
-
|
74
|
-
width: 100%;
|
75
|
-
height: auto;
|
76
|
-
}
|
77
|
-
|
78
|
-
.switch__base-neon path {
|
79
|
-
stroke-dasharray: 0 104.26 0;
|
80
|
-
transition: stroke-dasharray var(--trans-dur) var(--trans-timing);
|
81
|
-
}
|
82
|
-
|
83
|
-
.switch__input {
|
84
|
-
position: relative;
|
85
|
-
|
86
|
-
width: 100%;
|
87
|
-
height: 100%;
|
88
|
-
appearance: none;
|
89
|
-
outline: transparent;
|
90
|
-
}
|
91
|
-
|
92
|
-
.switch__input::before {
|
93
|
-
content: '';
|
94
|
-
|
95
|
-
position: absolute;
|
96
|
-
inset: -0.125em;
|
97
|
-
|
98
|
-
display: block;
|
99
|
-
|
100
|
-
border-radius: 0.125em;
|
101
|
-
box-shadow: 0 0 0 0.125em hsla(var(--hue), 90%, 50%, 0%);
|
102
|
-
|
103
|
-
transition: box-shadow 0.15s linear;
|
104
|
-
}
|
105
|
-
|
106
|
-
.switch__input:focus-visible::before {
|
107
|
-
box-shadow: 0 0 0 0.125em var(--primary);
|
108
|
-
}
|
109
|
-
|
110
|
-
.switch__knob,
|
111
|
-
.switch__knob-container {
|
112
|
-
position: absolute;
|
113
|
-
display: block;
|
114
|
-
border-radius: 1em;
|
115
|
-
}
|
116
|
-
|
117
|
-
.switch__knob {
|
118
|
-
width: 2em;
|
119
|
-
height: 2em;
|
120
|
-
|
121
|
-
background-color: hsl(var(--hue), 10%, 15%);
|
122
|
-
background-image:
|
123
|
-
radial-gradient(
|
124
|
-
88% 88% at 50% 50%,
|
125
|
-
hsl(var(--hue), 10%, 20%) 47%,
|
126
|
-
hsla(var(--hue), 10%, 20%, 0%) 50%
|
127
|
-
),
|
128
|
-
radial-gradient(
|
129
|
-
88% 88% at 47% 47%,
|
130
|
-
hsl(var(--hue), 10%, 85%) 45%,
|
131
|
-
hsla(var(--hue), 10%, 85%, 0%) 50%
|
132
|
-
),
|
133
|
-
radial-gradient(
|
134
|
-
65% 70% at 40% 60%,
|
135
|
-
hsl(var(--hue), 10%, 20%) 46%,
|
136
|
-
hsla(var(--hue), 10%, 20%, 0%) 50%
|
137
|
-
);
|
138
|
-
box-shadow:
|
139
|
-
-0.0625em -0.0625em 0.0625em hsl(var(--hue), 10%, 15%) inset,
|
140
|
-
-0.125em -0.125em 0.0625em hsl(var(--hue), 10%, 5%) inset,
|
141
|
-
0.75em 0.25em 0.125em hsla(0deg, 0%, 0%, 80%);
|
142
|
-
|
143
|
-
transition: transform var(--trans-dur) var(--trans-timing);
|
144
|
-
}
|
145
|
-
|
146
|
-
.switch__knob-container {
|
147
|
-
top: 0.5em;
|
148
|
-
left: 0.5em;
|
149
|
-
|
150
|
-
overflow: hidden;
|
151
|
-
|
152
|
-
width: 4em;
|
153
|
-
height: 2em;
|
154
|
-
}
|
155
|
-
|
156
|
-
.switch__knob-neon {
|
157
|
-
display: block;
|
158
|
-
width: 2em;
|
159
|
-
height: auto;
|
160
|
-
}
|
161
|
-
|
162
|
-
.switch__knob-neon circle {
|
163
|
-
opacity: 0;
|
164
|
-
stroke-dasharray: 0 90.32 0 54.19;
|
165
|
-
transition:
|
166
|
-
opacity var(--trans-dur) steps(1, end),
|
167
|
-
stroke-dasharray var(--trans-dur) var(--trans-timing);
|
168
|
-
}
|
169
|
-
|
170
|
-
.switch__knob-shadow {
|
171
|
-
position: absolute;
|
172
|
-
top: 0.5em;
|
173
|
-
left: 0.5em;
|
174
|
-
|
175
|
-
display: block;
|
176
|
-
|
177
|
-
width: 2em;
|
178
|
-
height: 2em;
|
179
|
-
|
180
|
-
border-radius: 50%;
|
181
|
-
box-shadow: 0.125em 0.125em 0.125em hsla(0deg, 0%, 0%, 90%);
|
182
|
-
|
183
|
-
transition: transform var(--trans-dur) var(--trans-timing);
|
184
|
-
}
|
185
|
-
|
186
|
-
.switch__led {
|
187
|
-
position: absolute;
|
188
|
-
top: 0;
|
189
|
-
left: 0;
|
190
|
-
|
191
|
-
display: block;
|
192
|
-
|
193
|
-
width: 0.25em;
|
194
|
-
height: 0.25em;
|
195
|
-
|
196
|
-
background-color: hsl(var(--off-hue), 90%, 70%);
|
197
|
-
border-radius: 50%;
|
198
|
-
box-shadow:
|
199
|
-
0 -0.0625em 0.0625em hsl(var(--off-hue), 90%, 40%) inset,
|
200
|
-
0 0 0.125em hsla(var(--off-hue), 90%, 70%, 30%),
|
201
|
-
0 0 0.125em hsla(var(--off-hue), 90%, 70%, 30%),
|
202
|
-
0.125em 0.125em 0.125em hsla(0deg, 0%, 0%, 50%);
|
203
|
-
|
204
|
-
transition:
|
205
|
-
background-color var(--trans-dur) var(--trans-timing),
|
206
|
-
box-shadow var(--trans-dur) var(--trans-timing);
|
207
|
-
}
|
208
|
-
|
209
|
-
.switch__text {
|
210
|
-
position: absolute;
|
211
|
-
overflow: hidden;
|
212
|
-
width: 1px;
|
213
|
-
height: 1px;
|
214
|
-
}
|
215
|
-
|
216
|
-
.switch__input:checked ~ .switch__led {
|
217
|
-
background-color: hsl(var(--on-hue1), 90%, 70%);
|
218
|
-
box-shadow:
|
219
|
-
0 -0.0625em 0.0625em hsl(var(--on-hue1), 90%, 40%) inset,
|
220
|
-
0 -0.125em 0.125em hsla(var(--on-hue1), 90%, 70%, 30%),
|
221
|
-
0 0.125em 0.125em hsla(var(--on-hue1), 90%, 70%, 30%),
|
222
|
-
0.125em 0.125em 0.125em hsla(0deg, 0%, 0%, 50%);
|
223
|
-
}
|
224
|
-
|
225
|
-
.switch__input:checked ~ .switch__base-neon path {
|
226
|
-
stroke-dasharray: 52.13 0 52.13;
|
227
|
-
}
|
228
|
-
|
229
|
-
.switch__input:checked ~ .switch__knob-shadow,
|
230
|
-
.switch__input:checked ~ .switch__knob-container .switch__knob {
|
231
|
-
transform: translateX(100%);
|
232
|
-
}
|
233
|
-
|
234
|
-
.switch__input:checked ~ .switch__knob-container .switch__knob-neon circle {
|
235
|
-
opacity: 1;
|
236
|
-
stroke-dasharray: 45.16 0 45.16 54.19;
|
237
|
-
transition-timing-function: steps(1, start), var(--trans-timing);
|
238
|
-
}
|
@@ -1,79 +0,0 @@
|
|
1
|
-
import { memo } from 'react';
|
2
|
-
|
3
|
-
import './index.css';
|
4
|
-
|
5
|
-
interface SyncSwitchProps {
|
6
|
-
onChange?: (checked: boolean) => void;
|
7
|
-
value?: boolean;
|
8
|
-
}
|
9
|
-
const SyncSwitch = memo<SyncSwitchProps>(({ value, onChange }) => {
|
10
|
-
return (
|
11
|
-
<div className={'wrapper'}>
|
12
|
-
<label className="switch">
|
13
|
-
<input
|
14
|
-
checked={value}
|
15
|
-
className="switch__input"
|
16
|
-
onChange={(e) => {
|
17
|
-
onChange?.(e.target.checked);
|
18
|
-
}}
|
19
|
-
role="switch"
|
20
|
-
type="checkbox"
|
21
|
-
/>
|
22
|
-
<span className="switch__base-outer" />
|
23
|
-
<span className="switch__base-inner" />
|
24
|
-
<svg className="switch__base-neon" height="24px" viewBox="0 0 40 24" width="40px">
|
25
|
-
<defs>
|
26
|
-
<filter id="switch-glow">
|
27
|
-
<feGaussianBlur result="coloredBlur" stdDeviation="1" />
|
28
|
-
<feMerge>
|
29
|
-
<feMergeNode in="coloredBlur" />
|
30
|
-
<feMergeNode in="SourceGraphic" />
|
31
|
-
</feMerge>
|
32
|
-
</filter>
|
33
|
-
<linearGradient id="switch-gradient1" x1="0" x2="1" y1="0" y2="0">
|
34
|
-
<stop offset="0%" stopColor="hsl(var(--on-hue1),90%,70%)" />
|
35
|
-
<stop offset="100%" stopColor="hsl(var(--on-hue2),90%,70%)" />
|
36
|
-
</linearGradient>
|
37
|
-
<linearGradient id="switch-gradient2" x1="0.7" x2="0.3" y1="0" y2="1">
|
38
|
-
<stop offset="25%" stopColor="hsla(var(--on-hue1),90%,70%,0)" />
|
39
|
-
<stop offset="50%" stopColor="hsla(var(--on-hue1),90%,70%,0.3)" />
|
40
|
-
<stop offset="100%" stopColor="hsla(var(--on-hue2),90%,70%,0.3)" />
|
41
|
-
</linearGradient>
|
42
|
-
</defs>
|
43
|
-
<path
|
44
|
-
d="m.5,12C.5,5.649,5.649.5,12,.5h16c6.351,0,11.5,5.149,11.5,11.5s-5.149,11.5-11.5,11.5H12C5.649,23.5.5,18.351.5,12Z"
|
45
|
-
fill="none"
|
46
|
-
filter="url(#switch-glow)"
|
47
|
-
stroke="url(#switch-gradient1)"
|
48
|
-
strokeDasharray="0 104.26 0"
|
49
|
-
strokeDashoffset="0.01"
|
50
|
-
strokeLinecap="round"
|
51
|
-
strokeWidth="1"
|
52
|
-
/>
|
53
|
-
</svg>
|
54
|
-
<span className="switch__knob-shadow" />
|
55
|
-
<span className="switch__knob-container">
|
56
|
-
<span className="switch__knob">
|
57
|
-
<svg className="switch__knob-neon" height="48px" viewBox="0 0 48 48" width="48px">
|
58
|
-
<circle
|
59
|
-
cx="24"
|
60
|
-
cy="24"
|
61
|
-
fill="none"
|
62
|
-
r="23"
|
63
|
-
stroke="url(#switch-gradient2)"
|
64
|
-
strokeDasharray="0 90.32 0 54.19"
|
65
|
-
strokeLinecap="round"
|
66
|
-
strokeWidth="1"
|
67
|
-
transform="rotate(-112.5,24,24)"
|
68
|
-
/>
|
69
|
-
</svg>
|
70
|
-
</span>
|
71
|
-
</span>
|
72
|
-
<span className="switch__led" />
|
73
|
-
<span className="switch__text">Power</span>
|
74
|
-
</label>
|
75
|
-
</div>
|
76
|
-
);
|
77
|
-
});
|
78
|
-
|
79
|
-
export default SyncSwitch;
|