@lobehub/chat 1.136.5 → 1.136.7
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/.github/workflows/desktop-pr-build.yml +3 -3
- package/.github/workflows/release-desktop-beta.yml +3 -3
- package/.github/workflows/release.yml +1 -1
- package/.github/workflows/test.yml +3 -3
- package/CHANGELOG.md +50 -0
- package/changelog/v1.json +14 -0
- package/package.json +62 -62
- package/packages/const/src/user.ts +2 -0
- package/packages/model-runtime/src/{utils/anthropicHelpers.test.ts → core/contextBuilders/anthropic.test.ts} +6 -6
- package/packages/model-runtime/src/{utils/anthropicHelpers.ts → core/contextBuilders/anthropic.ts} +3 -3
- package/packages/model-runtime/src/{utils/openaiHelpers.test.ts → core/contextBuilders/openai.test.ts} +5 -5
- package/packages/model-runtime/src/{utils/openaiHelpers.ts → core/contextBuilders/openai.ts} +4 -4
- package/packages/model-runtime/src/{utils/sensenovaHelpers.test.ts → core/contextBuilders/sensenova.test.ts} +1 -1
- package/packages/model-runtime/src/core/openaiCompatibleFactory/createImage.ts +1 -1
- package/packages/model-runtime/src/core/openaiCompatibleFactory/index.test.ts +1 -1
- package/packages/model-runtime/src/core/openaiCompatibleFactory/index.ts +1 -1
- package/packages/model-runtime/src/core/parameterResolver.test.ts +300 -0
- package/packages/model-runtime/src/core/parameterResolver.ts +275 -0
- package/packages/model-runtime/src/{utils/cloudflareHelpers.test.ts → core/streams/cloudflare.test.ts} +2 -6
- package/packages/model-runtime/src/{utils/cloudflareHelpers.ts → core/streams/cloudflare.ts} +1 -1
- package/packages/model-runtime/src/index.ts +1 -1
- package/packages/model-runtime/src/providers/anthropic/generateObject.ts +1 -1
- package/packages/model-runtime/src/providers/anthropic/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/anthropic/index.ts +10 -21
- package/packages/model-runtime/src/providers/azureOpenai/index.test.ts +2 -2
- package/packages/model-runtime/src/providers/azureOpenai/index.ts +1 -1
- package/packages/model-runtime/src/providers/baichuan/index.ts +5 -3
- package/packages/model-runtime/src/providers/bedrock/index.test.ts +167 -0
- package/packages/model-runtime/src/providers/bedrock/index.ts +11 -3
- package/packages/model-runtime/src/providers/cloudflare/index.ts +3 -3
- package/packages/model-runtime/src/providers/cohere/index.ts +13 -9
- package/packages/model-runtime/src/providers/github/index.ts +1 -1
- package/packages/model-runtime/src/providers/groq/index.ts +9 -2
- package/packages/model-runtime/src/providers/minimax/index.ts +24 -6
- package/packages/model-runtime/src/providers/mistral/index.ts +16 -9
- package/packages/model-runtime/src/providers/moonshot/index.ts +5 -1
- package/packages/model-runtime/src/providers/openai/index.ts +10 -10
- package/packages/model-runtime/src/providers/perplexity/index.ts +20 -12
- package/packages/model-runtime/src/providers/qwen/index.ts +27 -29
- package/packages/model-runtime/src/providers/search1api/index.ts +1 -1
- package/packages/model-runtime/src/providers/sensenova/index.ts +1 -1
- package/packages/model-runtime/src/providers/zhipu/index.ts +21 -18
- package/packages/model-runtime/src/types/chat.ts +1 -1
- package/packages/types/src/user/index.ts +8 -0
- package/packages/web-crawler/package.json +1 -1
- package/src/app/[variants]/(main)/_layout/Desktop/SideBar/BottomActions.tsx +12 -15
- package/src/app/[variants]/(main)/labs/components/Hero.tsx +43 -0
- package/src/app/[variants]/(main)/labs/components/LabCard.tsx +85 -0
- package/src/app/[variants]/(main)/labs/page.tsx +59 -0
- package/src/features/ChatInput/InputEditor/index.tsx +38 -16
- package/src/locales/default/common.ts +1 -0
- package/src/locales/default/index.ts +2 -0
- package/src/locales/default/labs.ts +14 -0
- package/src/middleware.ts +1 -0
- package/src/store/chat/slices/topic/action.ts +0 -2
- package/src/store/user/slices/preference/selectors.ts +3 -0
- package/packages/types/src/sync.ts +0 -41
- /package/{.changelogrc.js → .changelogrc.cjs} +0 -0
- /package/{.commitlintrc.js → .commitlintrc.cjs} +0 -0
- /package/{.prettierrc.js → .prettierrc.cjs} +0 -0
- /package/{.releaserc.js → .releaserc.cjs} +0 -0
- /package/{.remarkrc.js → .remarkrc.cjs} +0 -0
- /package/{.stylelintrc.js → .stylelintrc.cjs} +0 -0
- /package/packages/model-runtime/src/{utils/sensenovaHelpers.ts → core/contextBuilders/sensenova.ts} +0 -0
|
@@ -29,7 +29,7 @@ export const LobeSearch1API = createOpenAICompatibleRuntime({
|
|
|
29
29
|
...res,
|
|
30
30
|
...param,
|
|
31
31
|
stream,
|
|
32
|
-
temperature: temperature >= 2 ? undefined : temperature,
|
|
32
|
+
temperature: temperature !== undefined && temperature >= 2 ? undefined : temperature,
|
|
33
33
|
} as OpenAI.ChatCompletionCreateParamsStreaming;
|
|
34
34
|
},
|
|
35
35
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ChatModelCard } from '@lobechat/types';
|
|
2
2
|
import { ModelProvider } from 'model-bank';
|
|
3
3
|
|
|
4
|
+
import { convertSenseNovaMessage } from '../../core/contextBuilders/sensenova';
|
|
4
5
|
import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
|
|
5
|
-
import { convertSenseNovaMessage } from '../../utils/sensenovaHelpers';
|
|
6
6
|
|
|
7
7
|
export interface SenseNovaModelCard {
|
|
8
8
|
id: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ModelProvider } from 'model-bank';
|
|
2
2
|
|
|
3
3
|
import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
|
|
4
|
+
import { resolveParameters } from '../../core/parameterResolver';
|
|
4
5
|
import { OpenAIStream } from '../../core/streams/openai';
|
|
5
6
|
import { convertIterableToStream } from '../../core/streams/protocol';
|
|
6
7
|
import { MODEL_LIST_CONFIGS, processModelList } from '../../utils/modelParse';
|
|
@@ -33,30 +34,32 @@ export const LobeZhipuAI = createOpenAICompatibleRuntime({
|
|
|
33
34
|
]
|
|
34
35
|
: tools;
|
|
35
36
|
|
|
37
|
+
// Resolve parameters based on model-specific constraints
|
|
38
|
+
const resolvedParams = resolveParameters(
|
|
39
|
+
{ max_tokens, temperature, top_p },
|
|
40
|
+
{
|
|
41
|
+
// max_tokens constraints
|
|
42
|
+
maxTokensRange: model.includes('glm-4v')
|
|
43
|
+
? { max: 1024 }
|
|
44
|
+
: model === 'glm-zero-preview'
|
|
45
|
+
? { max: 15_300 }
|
|
46
|
+
: undefined,
|
|
47
|
+
normalizeTemperature: true,
|
|
48
|
+
// glm-4-alltools has stricter temperature and top_p constraints
|
|
49
|
+
...(model === 'glm-4-alltools' && {
|
|
50
|
+
temperatureRange: { max: 0.99, min: 0.01 },
|
|
51
|
+
topPRange: { max: 0.99, min: 0.01 },
|
|
52
|
+
}),
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
|
|
36
56
|
return {
|
|
37
57
|
...rest,
|
|
38
|
-
|
|
39
|
-
max_tokens === undefined
|
|
40
|
-
? undefined
|
|
41
|
-
: (model.includes('glm-4v') && Math.min(max_tokens, 1024)) ||
|
|
42
|
-
(model === 'glm-zero-preview' && Math.min(max_tokens, 15_300)) ||
|
|
43
|
-
max_tokens,
|
|
58
|
+
...resolvedParams,
|
|
44
59
|
model,
|
|
45
60
|
stream: true,
|
|
46
61
|
thinking: model.includes('-4.5') ? { type: thinking?.type } : undefined,
|
|
47
62
|
tools: zhipuTools,
|
|
48
|
-
...(model === 'glm-4-alltools'
|
|
49
|
-
? {
|
|
50
|
-
temperature:
|
|
51
|
-
temperature !== undefined
|
|
52
|
-
? Math.max(0.01, Math.min(0.99, temperature / 2))
|
|
53
|
-
: undefined,
|
|
54
|
-
top_p: top_p !== undefined ? Math.max(0.01, Math.min(0.99, top_p)) : undefined,
|
|
55
|
-
}
|
|
56
|
-
: {
|
|
57
|
-
temperature: temperature !== undefined ? temperature / 2 : undefined,
|
|
58
|
-
top_p,
|
|
59
|
-
}),
|
|
60
63
|
} as any;
|
|
61
64
|
},
|
|
62
65
|
handleStream: (stream, { callbacks, inputStartAt }) => {
|
|
@@ -35,6 +35,14 @@ export const UserGuideSchema = z.object({
|
|
|
35
35
|
export type UserGuide = z.infer<typeof UserGuideSchema>;
|
|
36
36
|
|
|
37
37
|
export interface UserPreference {
|
|
38
|
+
/**
|
|
39
|
+
* disable markdown rendering in chat input editor
|
|
40
|
+
*/
|
|
41
|
+
disableInputMarkdownRender?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* enable multi-agent group chat mode
|
|
44
|
+
*/
|
|
45
|
+
enableGroupChat?: boolean;
|
|
38
46
|
guide?: UserGuide;
|
|
39
47
|
hideSyncAlert?: boolean;
|
|
40
48
|
telemetry: boolean | null;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ActionIcon, ActionIconProps } from '@lobehub/ui';
|
|
2
|
-
import {
|
|
2
|
+
import { Github } from 'lucide-react';
|
|
3
3
|
import Link from 'next/link';
|
|
4
4
|
import { memo } from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
5
|
import { Flexbox } from 'react-layout-kit';
|
|
7
6
|
|
|
8
|
-
import {
|
|
7
|
+
import { GITHUB } from '@/const/url';
|
|
9
8
|
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
10
9
|
|
|
11
10
|
const ICON_SIZE: ActionIconProps['size'] = {
|
|
@@ -15,8 +14,8 @@ const ICON_SIZE: ActionIconProps['size'] = {
|
|
|
15
14
|
};
|
|
16
15
|
|
|
17
16
|
const BottomActions = memo(() => {
|
|
18
|
-
const { t } = useTranslation('common');
|
|
19
|
-
const { hideGitHub
|
|
17
|
+
// const { t } = useTranslation('common');
|
|
18
|
+
const { hideGitHub } = useServerConfigStore(featureFlagsSelectors);
|
|
20
19
|
|
|
21
20
|
return (
|
|
22
21
|
<Flexbox gap={8}>
|
|
@@ -30,16 +29,14 @@ const BottomActions = memo(() => {
|
|
|
30
29
|
/>
|
|
31
30
|
</Link>
|
|
32
31
|
)}
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</Link>
|
|
42
|
-
)}
|
|
32
|
+
{/*<Link aria-label={t('labs')} href={'/labs'}>*/}
|
|
33
|
+
{/* <ActionIcon*/}
|
|
34
|
+
{/* icon={FlaskConical}*/}
|
|
35
|
+
{/* size={ICON_SIZE}*/}
|
|
36
|
+
{/* title={t('labs')}*/}
|
|
37
|
+
{/* tooltipProps={{ placement: 'right' }}*/}
|
|
38
|
+
{/* />*/}
|
|
39
|
+
{/*</Link>*/}
|
|
43
40
|
</Flexbox>
|
|
44
41
|
);
|
|
45
42
|
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { Flexbox } from 'react-layout-kit';
|
|
7
|
+
|
|
8
|
+
const useStyles = createStyles(({ css, token }) => ({
|
|
9
|
+
container: css`
|
|
10
|
+
width: 100%;
|
|
11
|
+
max-width: 800px;
|
|
12
|
+
margin-block: 0;
|
|
13
|
+
margin-inline: auto;
|
|
14
|
+
padding-block: 24px 8px;
|
|
15
|
+
padding-inline: 16px;
|
|
16
|
+
`,
|
|
17
|
+
desc: css`
|
|
18
|
+
color: ${token.colorTextSecondary};
|
|
19
|
+
`,
|
|
20
|
+
title: css`
|
|
21
|
+
font-size: 22px;
|
|
22
|
+
font-weight: 600;
|
|
23
|
+
color: ${token.colorText};
|
|
24
|
+
`,
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
const Hero = memo(() => {
|
|
28
|
+
const { styles } = useStyles();
|
|
29
|
+
const { t } = useTranslation('labs');
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div className={styles.container}>
|
|
33
|
+
<Flexbox gap={8}>
|
|
34
|
+
<div className={styles.title}>🪄 {t('title')}</div>
|
|
35
|
+
<div className={styles.desc}>{t('desc')}</div>
|
|
36
|
+
</Flexbox>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
Hero.displayName = 'LabsHero';
|
|
42
|
+
|
|
43
|
+
export default Hero;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Switch } from 'antd';
|
|
4
|
+
import { createStyles } from 'antd-style';
|
|
5
|
+
import { PropsWithChildren, memo } from 'react';
|
|
6
|
+
import { Flexbox } from 'react-layout-kit';
|
|
7
|
+
|
|
8
|
+
interface LabCardProps {
|
|
9
|
+
checked: boolean;
|
|
10
|
+
desc: string;
|
|
11
|
+
loading: boolean;
|
|
12
|
+
meta?: string;
|
|
13
|
+
onChange: (v: boolean) => void;
|
|
14
|
+
title: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const useStyles = createStyles(({ css, token }) => ({
|
|
18
|
+
card: css`
|
|
19
|
+
width: 100%;
|
|
20
|
+
max-width: 800px;
|
|
21
|
+
margin-block: 0;
|
|
22
|
+
margin-inline: auto;
|
|
23
|
+
padding: 16px;
|
|
24
|
+
border: 1px solid ${token.colorBorderSecondary};
|
|
25
|
+
border-radius: 12px;
|
|
26
|
+
|
|
27
|
+
background: ${token.colorBgContainer};
|
|
28
|
+
`,
|
|
29
|
+
desc: css`
|
|
30
|
+
color: ${token.colorTextSecondary};
|
|
31
|
+
`,
|
|
32
|
+
meta: css`
|
|
33
|
+
font-size: 12px;
|
|
34
|
+
color: ${token.colorTextTertiary};
|
|
35
|
+
`,
|
|
36
|
+
row: css`
|
|
37
|
+
display: grid;
|
|
38
|
+
grid-template-columns: 240px 1fr 80px;
|
|
39
|
+
gap: 16px;
|
|
40
|
+
align-items: center;
|
|
41
|
+
`,
|
|
42
|
+
thumb: css`
|
|
43
|
+
height: 128px;
|
|
44
|
+
border-radius: ${token.borderRadiusLG}px;
|
|
45
|
+
background: linear-gradient(135deg, ${token.colorFillTertiary}, ${token.colorFillQuaternary});
|
|
46
|
+
`,
|
|
47
|
+
title: css`
|
|
48
|
+
font-size: 16px;
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
color: ${token.colorText};
|
|
51
|
+
`,
|
|
52
|
+
wrap: css`
|
|
53
|
+
width: 100%;
|
|
54
|
+
`,
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
const LabCard = memo<PropsWithChildren<LabCardProps>>(
|
|
58
|
+
({ title, desc, checked, onChange, meta, loading }) => {
|
|
59
|
+
const { styles } = useStyles();
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div className={styles.wrap}>
|
|
63
|
+
<div className={styles.card}>
|
|
64
|
+
<div className={styles.row}>
|
|
65
|
+
<div className={styles.thumb} />
|
|
66
|
+
<Flexbox gap={6}>
|
|
67
|
+
<div className={styles.title}>{title}</div>
|
|
68
|
+
<div className={styles.desc}>{desc}</div>
|
|
69
|
+
{meta ? <div className={styles.meta}>{meta}</div> : null}
|
|
70
|
+
</Flexbox>
|
|
71
|
+
{!loading && (
|
|
72
|
+
<Flexbox align={'flex-end'} height={'100%'} justify={'center'} paddingInline={8}>
|
|
73
|
+
<Switch checked={checked} onChange={onChange} />
|
|
74
|
+
</Flexbox>
|
|
75
|
+
)}
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
LabCard.displayName = 'LabCard';
|
|
84
|
+
|
|
85
|
+
export default LabCard;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { memo, useCallback } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Flexbox } from 'react-layout-kit';
|
|
6
|
+
|
|
7
|
+
import { useUserStore } from '@/store/user';
|
|
8
|
+
import { preferenceSelectors } from '@/store/user/selectors';
|
|
9
|
+
|
|
10
|
+
import Hero from './components/Hero';
|
|
11
|
+
import LabCard from './components/LabCard';
|
|
12
|
+
|
|
13
|
+
const LabsPage = memo(() => {
|
|
14
|
+
const { t } = useTranslation('labs');
|
|
15
|
+
|
|
16
|
+
const [isPreferenceInit, inputMarkdownRender, enableGroupChat, updatePreference] = useUserStore(
|
|
17
|
+
(s) => [
|
|
18
|
+
preferenceSelectors.isPreferenceInit(s),
|
|
19
|
+
preferenceSelectors.inputMarkdownRender(s),
|
|
20
|
+
preferenceSelectors.enableGroupChat(s),
|
|
21
|
+
s.updatePreference,
|
|
22
|
+
],
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const onToggleMarkdown = useCallback(
|
|
26
|
+
(checked: boolean) => updatePreference({ disableInputMarkdownRender: !checked }),
|
|
27
|
+
[updatePreference],
|
|
28
|
+
);
|
|
29
|
+
const onToggleGroupChat = useCallback(
|
|
30
|
+
(checked: boolean) => updatePreference({ enableGroupChat: checked }),
|
|
31
|
+
[updatePreference],
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<Flexbox gap={16} padding={8} style={{ alignItems: 'center', width: '100%' }}>
|
|
36
|
+
<Hero />
|
|
37
|
+
|
|
38
|
+
<LabCard
|
|
39
|
+
checked={inputMarkdownRender}
|
|
40
|
+
desc={t('features.inputMarkdown.desc')}
|
|
41
|
+
loading={!isPreferenceInit}
|
|
42
|
+
onChange={onToggleMarkdown}
|
|
43
|
+
title={t('features.inputMarkdown.title')}
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
<LabCard
|
|
47
|
+
checked={enableGroupChat}
|
|
48
|
+
desc={t('features.groupChat.desc')}
|
|
49
|
+
loading={!isPreferenceInit}
|
|
50
|
+
onChange={onToggleGroupChat}
|
|
51
|
+
title={t('features.groupChat.title')}
|
|
52
|
+
/>
|
|
53
|
+
</Flexbox>
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
LabsPage.displayName = 'LabsPage';
|
|
58
|
+
|
|
59
|
+
export default LabsPage;
|
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
} from '@lobehub/editor';
|
|
13
13
|
import { Editor, FloatMenu, SlashMenu, useEditorState } from '@lobehub/editor/react';
|
|
14
14
|
import { combineKeys } from '@lobehub/ui';
|
|
15
|
-
import {
|
|
15
|
+
import { css, cx } from 'antd-style';
|
|
16
|
+
import { memo, useEffect, useMemo, useRef } from 'react';
|
|
16
17
|
import { useHotkeysContext } from 'react-hotkeys-hook';
|
|
17
18
|
|
|
18
19
|
import { useUserStore } from '@/store/user';
|
|
@@ -22,6 +23,12 @@ import { useChatInputStore, useStoreApi } from '../store';
|
|
|
22
23
|
import Placeholder from './Placeholder';
|
|
23
24
|
import { useSlashItems } from './useSlashItems';
|
|
24
25
|
|
|
26
|
+
const className = cx(css`
|
|
27
|
+
p {
|
|
28
|
+
margin-block-end: 0;
|
|
29
|
+
}
|
|
30
|
+
`);
|
|
31
|
+
|
|
25
32
|
const InputEditor = memo<{ defaultRows?: number }>(() => {
|
|
26
33
|
const [editor, slashMenuRef, send, updateMarkdownContent, expand] = useChatInputStore((s) => [
|
|
27
34
|
s.editor,
|
|
@@ -55,11 +62,40 @@ const InputEditor = memo<{ defaultRows?: number }>(() => {
|
|
|
55
62
|
};
|
|
56
63
|
}, [state.isEmpty]);
|
|
57
64
|
|
|
65
|
+
const enableMarkdown = useUserStore(preferenceSelectors.inputMarkdownRender);
|
|
66
|
+
const plugins = useMemo(
|
|
67
|
+
() =>
|
|
68
|
+
!enableMarkdown
|
|
69
|
+
? undefined
|
|
70
|
+
: [
|
|
71
|
+
ReactListPlugin,
|
|
72
|
+
ReactLinkPlugin,
|
|
73
|
+
ReactCodePlugin,
|
|
74
|
+
ReactCodeblockPlugin,
|
|
75
|
+
ReactHRPlugin,
|
|
76
|
+
ReactTablePlugin,
|
|
77
|
+
Editor.withProps(ReactMathPlugin, {
|
|
78
|
+
renderComp: expand
|
|
79
|
+
? undefined
|
|
80
|
+
: (props) => (
|
|
81
|
+
<FloatMenu
|
|
82
|
+
{...props}
|
|
83
|
+
getPopupContainer={() => (slashMenuRef as any)?.current}
|
|
84
|
+
/>
|
|
85
|
+
),
|
|
86
|
+
}),
|
|
87
|
+
],
|
|
88
|
+
[enableMarkdown],
|
|
89
|
+
);
|
|
90
|
+
|
|
58
91
|
return (
|
|
59
92
|
<Editor
|
|
60
93
|
autoFocus
|
|
94
|
+
className={className}
|
|
61
95
|
content={''}
|
|
62
96
|
editor={editor}
|
|
97
|
+
enablePasteMarkdown={enableMarkdown}
|
|
98
|
+
markdownOption={enableMarkdown}
|
|
63
99
|
onBlur={() => {
|
|
64
100
|
disableScope(HotkeyEnum.AddUserMessage);
|
|
65
101
|
}}
|
|
@@ -109,21 +145,7 @@ const InputEditor = memo<{ defaultRows?: number }>(() => {
|
|
|
109
145
|
}
|
|
110
146
|
}}
|
|
111
147
|
placeholder={<Placeholder />}
|
|
112
|
-
plugins={
|
|
113
|
-
ReactListPlugin,
|
|
114
|
-
ReactLinkPlugin,
|
|
115
|
-
ReactCodePlugin,
|
|
116
|
-
ReactCodeblockPlugin,
|
|
117
|
-
ReactHRPlugin,
|
|
118
|
-
ReactTablePlugin,
|
|
119
|
-
Editor.withProps(ReactMathPlugin, {
|
|
120
|
-
renderComp: expand
|
|
121
|
-
? undefined
|
|
122
|
-
: (props) => (
|
|
123
|
-
<FloatMenu {...props} getPopupContainer={() => (slashMenuRef as any)?.current} />
|
|
124
|
-
),
|
|
125
|
-
}),
|
|
126
|
-
]}
|
|
148
|
+
plugins={plugins}
|
|
127
149
|
slashOption={{
|
|
128
150
|
items: slashItems,
|
|
129
151
|
renderComp: expand
|
|
@@ -13,6 +13,7 @@ import file from './file';
|
|
|
13
13
|
import hotkey from './hotkey';
|
|
14
14
|
import image from './image';
|
|
15
15
|
import knowledgeBase from './knowledgeBase';
|
|
16
|
+
import labs from './labs';
|
|
16
17
|
import metadata from './metadata';
|
|
17
18
|
import migration from './migration';
|
|
18
19
|
import modelProvider from './modelProvider';
|
|
@@ -45,6 +46,7 @@ const resources = {
|
|
|
45
46
|
hotkey,
|
|
46
47
|
image,
|
|
47
48
|
knowledgeBase,
|
|
49
|
+
labs,
|
|
48
50
|
metadata,
|
|
49
51
|
migration,
|
|
50
52
|
modelProvider,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
desc: '这里会不定期更新我们正在探索的新功能,欢迎试用!',
|
|
3
|
+
features: {
|
|
4
|
+
groupChat: {
|
|
5
|
+
desc: '启用多智能体群聊编排能力。',
|
|
6
|
+
title: '群聊(多智能体)',
|
|
7
|
+
},
|
|
8
|
+
inputMarkdown: {
|
|
9
|
+
desc: '在输入区域实时渲染 Markdown(粗体、代码块、表格等)。',
|
|
10
|
+
title: '输入框 Markdown 渲染',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
title: '实验室',
|
|
14
|
+
};
|
package/src/middleware.ts
CHANGED
|
@@ -196,8 +196,6 @@ export const chatTopic: StateCreator<
|
|
|
196
196
|
enable ? [SWR_USE_FETCH_TOPIC, sessionId] : null,
|
|
197
197
|
async ([, sessionId]: [string, string]) => topicService.getTopics({ sessionId }),
|
|
198
198
|
{
|
|
199
|
-
suspense: true,
|
|
200
|
-
fallbackData: [],
|
|
201
199
|
onSuccess: (topics) => {
|
|
202
200
|
const nextMap = { ...get().topicMaps, [sessionId]: topics };
|
|
203
201
|
|
|
@@ -21,8 +21,11 @@ const shouldTriggerFileInKnowledgeBaseTip = (s: UserStore) =>
|
|
|
21
21
|
const isPreferenceInit = (s: UserStore) => s.isUserStateInit;
|
|
22
22
|
|
|
23
23
|
export const preferenceSelectors = {
|
|
24
|
+
enableGroupChat: (s: UserStore) => s.preference.enableGroupChat || false,
|
|
24
25
|
hideSettingsMoveGuide,
|
|
25
26
|
hideSyncAlert,
|
|
27
|
+
// TODO: 等到 lab 样式搞完再开启
|
|
28
|
+
inputMarkdownRender: (s: UserStore) => false && !s.preference.disableInputMarkdownRender,
|
|
26
29
|
isPreferenceInit,
|
|
27
30
|
shouldTriggerFileInKnowledgeBaseTip,
|
|
28
31
|
showUploadFileInKnowledgeBaseTip,
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { LobeDBSchemaMap } from '@/database/_deprecated/core/db';
|
|
2
|
-
|
|
3
|
-
export type OnSyncEvent = (tableKey: keyof LobeDBSchemaMap) => void;
|
|
4
|
-
export type OnSyncStatusChange = (status: PeerSyncStatus) => void;
|
|
5
|
-
export type OnAwarenessChange = (state: SyncAwarenessState[]) => void;
|
|
6
|
-
|
|
7
|
-
// export type PeerSyncStatus = 'syncing' | 'synced' | 'ready' | 'unconnected';
|
|
8
|
-
|
|
9
|
-
export enum PeerSyncStatus {
|
|
10
|
-
Connecting = 'connecting',
|
|
11
|
-
Disabled = 'disabled',
|
|
12
|
-
Ready = 'ready',
|
|
13
|
-
Synced = 'synced',
|
|
14
|
-
Syncing = 'syncing',
|
|
15
|
-
Unconnected = 'unconnected',
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface StartDataSyncParams {
|
|
19
|
-
channel: {
|
|
20
|
-
name: string;
|
|
21
|
-
password?: string;
|
|
22
|
-
};
|
|
23
|
-
onAwarenessChange: OnAwarenessChange;
|
|
24
|
-
onSyncEvent: OnSyncEvent;
|
|
25
|
-
onSyncStatusChange: OnSyncStatusChange;
|
|
26
|
-
signaling: string;
|
|
27
|
-
user: SyncUserInfo;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface SyncUserInfo {
|
|
31
|
-
browser?: string;
|
|
32
|
-
id: string;
|
|
33
|
-
isMobile: boolean;
|
|
34
|
-
name?: string;
|
|
35
|
-
os?: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface SyncAwarenessState extends SyncUserInfo {
|
|
39
|
-
clientID: number;
|
|
40
|
-
current: boolean;
|
|
41
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/packages/model-runtime/src/{utils/sensenovaHelpers.ts → core/contextBuilders/sensenova.ts}
RENAMED
|
File without changes
|