@lobehub/chat 1.99.6 → 1.100.1
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/.cursor/rules/testing-guide/testing-guide.mdc +173 -0
- package/.github/workflows/desktop-pr-build.yml +3 -3
- package/.github/workflows/release-desktop-beta.yml +3 -3
- package/CHANGELOG.md +50 -0
- package/apps/desktop/package.json +5 -2
- package/apps/desktop/src/main/controllers/AuthCtr.ts +310 -111
- package/apps/desktop/src/main/controllers/NetworkProxyCtr.ts +1 -1
- package/apps/desktop/src/main/controllers/RemoteServerConfigCtr.ts +50 -3
- package/apps/desktop/src/main/controllers/RemoteServerSyncCtr.ts +188 -23
- package/apps/desktop/src/main/controllers/__tests__/NetworkProxyCtr.test.ts +37 -18
- package/apps/desktop/src/main/types/store.ts +1 -0
- package/apps/desktop/src/preload/electronApi.ts +2 -1
- package/apps/desktop/src/preload/streamer.ts +58 -0
- package/changelog/v1.json +18 -0
- package/docs/development/database-schema.dbml +9 -0
- package/docs/self-hosting/environment-variables/model-provider.mdx +25 -0
- package/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx +25 -0
- package/docs/self-hosting/faq/vercel-ai-image-timeout.mdx +65 -0
- package/docs/self-hosting/faq/vercel-ai-image-timeout.zh-CN.mdx +63 -0
- package/docs/usage/providers/fal.mdx +6 -6
- package/docs/usage/providers/fal.zh-CN.mdx +6 -6
- package/locales/ar/electron.json +3 -0
- package/locales/ar/oauth.json +8 -4
- package/locales/bg-BG/electron.json +3 -0
- package/locales/bg-BG/oauth.json +8 -4
- package/locales/de-DE/electron.json +3 -0
- package/locales/de-DE/oauth.json +9 -5
- package/locales/en-US/electron.json +3 -0
- package/locales/en-US/oauth.json +8 -4
- package/locales/es-ES/electron.json +3 -0
- package/locales/es-ES/oauth.json +9 -5
- package/locales/fa-IR/electron.json +3 -0
- package/locales/fa-IR/oauth.json +8 -4
- package/locales/fr-FR/electron.json +3 -0
- package/locales/fr-FR/oauth.json +8 -4
- package/locales/it-IT/electron.json +3 -0
- package/locales/it-IT/oauth.json +9 -5
- package/locales/ja-JP/electron.json +3 -0
- package/locales/ja-JP/oauth.json +8 -4
- package/locales/ko-KR/electron.json +3 -0
- package/locales/ko-KR/oauth.json +8 -4
- package/locales/nl-NL/electron.json +3 -0
- package/locales/nl-NL/oauth.json +9 -5
- package/locales/pl-PL/electron.json +3 -0
- package/locales/pl-PL/oauth.json +8 -4
- package/locales/pt-BR/electron.json +3 -0
- package/locales/pt-BR/oauth.json +8 -4
- package/locales/ru-RU/electron.json +3 -0
- package/locales/ru-RU/oauth.json +8 -4
- package/locales/tr-TR/electron.json +3 -0
- package/locales/tr-TR/oauth.json +8 -4
- package/locales/vi-VN/electron.json +3 -0
- package/locales/vi-VN/oauth.json +9 -5
- package/locales/zh-CN/electron.json +3 -0
- package/locales/zh-CN/oauth.json +8 -4
- package/locales/zh-TW/electron.json +3 -0
- package/locales/zh-TW/oauth.json +8 -4
- package/package.json +3 -3
- package/packages/electron-client-ipc/src/dispatch.ts +14 -2
- package/packages/electron-client-ipc/src/index.ts +1 -0
- package/packages/electron-client-ipc/src/streamInvoke.ts +62 -0
- package/packages/electron-client-ipc/src/types/proxyTRPCRequest.ts +5 -0
- package/packages/electron-client-ipc/src/utils/headers.ts +27 -0
- package/packages/electron-client-ipc/src/utils/request.ts +28 -0
- package/src/app/(backend)/oidc/callback/desktop/route.ts +58 -0
- package/src/app/(backend)/oidc/handoff/route.ts +46 -0
- package/src/app/[variants]/oauth/callback/error/page.tsx +55 -0
- package/src/app/[variants]/oauth/callback/layout.tsx +12 -0
- package/src/app/[variants]/oauth/callback/loading.tsx +3 -0
- package/src/app/[variants]/oauth/{consent/[uid] → callback}/success/page.tsx +10 -1
- package/src/app/[variants]/oauth/consent/[uid]/Consent.tsx +7 -1
- package/src/database/client/migrations.json +8 -0
- package/src/database/migrations/0028_oauth_handoffs.sql +8 -0
- package/src/database/migrations/meta/0028_snapshot.json +6055 -0
- package/src/database/migrations/meta/_journal.json +7 -0
- package/src/database/models/oauthHandoff.ts +94 -0
- package/src/database/repositories/tableViewer/index.test.ts +1 -1
- package/src/database/schemas/oidc.ts +46 -0
- package/src/features/ElectronTitlebar/Connection/Waiting.tsx +59 -115
- package/src/features/ElectronTitlebar/Connection/WaitingAnim.tsx +114 -0
- package/src/libs/model-runtime/utils/openaiCompatibleFactory/index.test.ts +1 -1
- package/src/libs/model-runtime/utils/openaiCompatibleFactory/index.ts +2 -1
- package/src/libs/oidc-provider/config.ts +16 -17
- package/src/libs/oidc-provider/jwt.ts +135 -0
- package/src/libs/oidc-provider/provider.ts +22 -38
- package/src/libs/trpc/client/async.ts +1 -2
- package/src/libs/trpc/client/edge.ts +1 -2
- package/src/libs/trpc/client/lambda.ts +1 -1
- package/src/libs/trpc/client/tools.ts +1 -2
- package/src/libs/trpc/lambda/context.ts +9 -16
- package/src/locales/default/electron.ts +3 -0
- package/src/locales/default/oauth.ts +8 -4
- package/src/middleware.ts +10 -4
- package/src/server/globalConfig/genServerAiProviderConfig.test.ts +235 -0
- package/src/server/globalConfig/genServerAiProviderConfig.ts +9 -10
- package/src/server/services/oidc/index.ts +0 -71
- package/src/services/chat.ts +5 -1
- package/src/services/electron/remoteServer.ts +0 -7
- package/src/store/aiInfra/slices/aiProvider/action.ts +2 -1
- package/src/{libs/trpc/client/helpers → utils/electron}/desktopRemoteRPCFetch.ts +22 -7
- package/src/utils/getFallbackModelProperty.test.ts +193 -0
- package/src/utils/getFallbackModelProperty.ts +36 -0
- package/src/utils/parseModels.test.ts +150 -48
- package/src/utils/parseModels.ts +26 -11
- package/src/utils/server/auth.ts +22 -0
- package/src/app/[variants]/oauth/consent/[uid]/failed/page.tsx +0 -36
- package/src/app/[variants]/oauth/handoff/Client.tsx +0 -98
- package/src/app/[variants]/oauth/handoff/page.tsx +0 -13
@@ -1,98 +0,0 @@
|
|
1
|
-
'use client';
|
2
|
-
|
3
|
-
import { Text } from '@lobehub/ui';
|
4
|
-
import { Spin } from 'antd';
|
5
|
-
import { createStyles } from 'antd-style';
|
6
|
-
import { useSearchParams } from 'next/navigation';
|
7
|
-
import React, { useEffect, useState } from 'react';
|
8
|
-
import { useTranslation } from 'react-i18next';
|
9
|
-
import { Center, Flexbox } from 'react-layout-kit';
|
10
|
-
|
11
|
-
const useStyles = createStyles(({ css, token }) => ({
|
12
|
-
container: css`
|
13
|
-
width: 100%;
|
14
|
-
min-height: 100vh;
|
15
|
-
padding-block: 40px;
|
16
|
-
padding-inline: 24px;
|
17
|
-
|
18
|
-
color: ${token.colorTextBase};
|
19
|
-
|
20
|
-
background-color: ${token.colorBgLayout};
|
21
|
-
`,
|
22
|
-
content: css`
|
23
|
-
max-width: 600px;
|
24
|
-
text-align: center;
|
25
|
-
`,
|
26
|
-
message: css`
|
27
|
-
margin-block-end: ${token.marginXL}px;
|
28
|
-
color: ${token.colorTextSecondary};
|
29
|
-
`,
|
30
|
-
title: css`
|
31
|
-
margin-block-end: ${token.marginLG}px;
|
32
|
-
font-size: 24px;
|
33
|
-
`,
|
34
|
-
}));
|
35
|
-
|
36
|
-
interface Status {
|
37
|
-
desc: string;
|
38
|
-
status: 'processing' | 'success';
|
39
|
-
title: string;
|
40
|
-
}
|
41
|
-
const AuthHandoffPage = () => {
|
42
|
-
const { styles } = useStyles();
|
43
|
-
const { t } = useTranslation('oauth'); // Assuming 'oauth' namespace exists
|
44
|
-
const searchParams = useSearchParams();
|
45
|
-
|
46
|
-
const [status, setStatus] = useState<Status>({
|
47
|
-
desc: t('handoff.desc.processing'),
|
48
|
-
status: 'processing',
|
49
|
-
title: t('handoff.title.processing'),
|
50
|
-
});
|
51
|
-
|
52
|
-
const [isError, setIsError] = useState<boolean>(false);
|
53
|
-
|
54
|
-
useEffect(() => {
|
55
|
-
const targetUrl = searchParams.get('target');
|
56
|
-
|
57
|
-
if (targetUrl) {
|
58
|
-
try {
|
59
|
-
const decodedTargetUrl = decodeURIComponent(targetUrl);
|
60
|
-
console.log(`Attempting redirect to: ${decodedTargetUrl}`);
|
61
|
-
|
62
|
-
window.location.href = decodedTargetUrl;
|
63
|
-
|
64
|
-
const url = new URL(decodedTargetUrl);
|
65
|
-
if (!url.pathname.startsWith('/oidc/auth')) {
|
66
|
-
setStatus({
|
67
|
-
desc: t('handoff.desc.success'),
|
68
|
-
status: 'success',
|
69
|
-
title: t('handoff.title.success'),
|
70
|
-
});
|
71
|
-
}
|
72
|
-
} catch (error) {
|
73
|
-
console.error('Error decoding or redirecting:', error);
|
74
|
-
// setMessage(
|
75
|
-
// t('handoff.error', '无法自动打开桌面应用。请检查链接是否有效或尝试手动打开应用。'),
|
76
|
-
// );
|
77
|
-
setIsError(true);
|
78
|
-
}
|
79
|
-
} else {
|
80
|
-
console.error('Missing target URL for handoff.');
|
81
|
-
setIsError(true);
|
82
|
-
}
|
83
|
-
}, [searchParams]);
|
84
|
-
|
85
|
-
return (
|
86
|
-
<Center className={styles.container} gap={12}>
|
87
|
-
{!isError && <Spin size="large" />}
|
88
|
-
<Flexbox align="center" className={styles.content} gap={16}>
|
89
|
-
<Text as={'h3'} className={styles.title}>
|
90
|
-
{status.title}
|
91
|
-
</Text>
|
92
|
-
<Text className={styles.message}>{status.desc}</Text>
|
93
|
-
</Flexbox>
|
94
|
-
</Center>
|
95
|
-
);
|
96
|
-
};
|
97
|
-
|
98
|
-
export default AuthHandoffPage;
|