@lobehub/chat 0.160.6 → 0.160.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/package.json +1 -1
- package/src/app/(main)/settings/llm/components/ProviderModelList/ModelFetcher.tsx +1 -0
- package/src/app/(main)/settings/llm/components/ProviderModelList/index.tsx +8 -1
- package/src/components/ModelSelect/index.tsx +13 -5
- package/src/features/AgentSetting/AgentMeta/index.tsx +1 -1
- package/src/features/ModelSwitchPanel/index.tsx +6 -3
- package/src/features/PluginStore/index.tsx +1 -1
- package/src/store/agent/slices/chat/selectors.test.ts +2 -2
- package/src/store/agent/slices/chat/selectors.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.160.8](https://github.com/lobehub/lobe-chat/compare/v0.160.7...v0.160.8)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2024-05-21**</sup>
|
|
8
|
+
|
|
9
|
+
#### 💄 Styles
|
|
10
|
+
|
|
11
|
+
- **misc**: `Tooltip` should not be selected & Model selector overlaps with reset button.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### Styles
|
|
19
|
+
|
|
20
|
+
- **misc**: `Tooltip` should not be selected & Model selector overlaps with reset button, closes [#2500](https://github.com/lobehub/lobe-chat/issues/2500) [#2511](https://github.com/lobehub/lobe-chat/issues/2511) [#2581](https://github.com/lobehub/lobe-chat/issues/2581) ([0c62fb7](https://github.com/lobehub/lobe-chat/commit/0c62fb7))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
### [Version 0.160.7](https://github.com/lobehub/lobe-chat/compare/v0.160.6...v0.160.7)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2024-05-21**</sup>
|
|
33
|
+
|
|
34
|
+
#### 🐛 Bug Fixes
|
|
35
|
+
|
|
36
|
+
- **misc**: Fix duplicate model panel key.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### What's fixed
|
|
44
|
+
|
|
45
|
+
- **misc**: Fix duplicate model panel key, closes [#2591](https://github.com/lobehub/lobe-chat/issues/2591) ([c733fcf](https://github.com/lobehub/lobe-chat/commit/c733fcf))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
### [Version 0.160.6](https://github.com/lobehub/lobe-chat/compare/v0.160.5...v0.160.6)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2024-05-21**</sup>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.160.
|
|
3
|
+
"version": "0.160.8",
|
|
4
4
|
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -55,6 +55,7 @@ const ModelFetcher = memo<ModelFetcherProps>(({ provider }) => {
|
|
|
55
55
|
<Flexbox align={'center'} gap={0} horizontal justify={'space-between'}>
|
|
56
56
|
<div>{t('llm.modelList.total', { count: totalModels })}</div>
|
|
57
57
|
<Tooltip
|
|
58
|
+
overlayStyle={{ pointerEvents: 'none' }}
|
|
58
59
|
title={
|
|
59
60
|
latestFetchTime
|
|
60
61
|
? t('llm.fetcher.latestTime', {
|
|
@@ -16,6 +16,13 @@ import ModelFetcher from './ModelFetcher';
|
|
|
16
16
|
import OptionRender from './Option';
|
|
17
17
|
|
|
18
18
|
const styles = {
|
|
19
|
+
divStyle: css`
|
|
20
|
+
position: relative;
|
|
21
|
+
|
|
22
|
+
.ant-select-selector {
|
|
23
|
+
padding-inline-end: 50px !important;
|
|
24
|
+
}
|
|
25
|
+
`,
|
|
19
26
|
popup: css`
|
|
20
27
|
&.ant-select-dropdown {
|
|
21
28
|
.ant-select-item-option-selected {
|
|
@@ -69,7 +76,7 @@ const ProviderModelListSelect = memo<CustomModelSelectProps>(
|
|
|
69
76
|
return (
|
|
70
77
|
<>
|
|
71
78
|
<Flexbox gap={8}>
|
|
72
|
-
<div
|
|
79
|
+
<div className={cx(styles.divStyle)}>
|
|
73
80
|
<div className={cx(styles.reset)}>
|
|
74
81
|
{showReset && (
|
|
75
82
|
<ActionIcon
|
|
@@ -79,14 +79,22 @@ export const ModelInfoTags = memo<ModelInfoTagsProps>(
|
|
|
79
79
|
return (
|
|
80
80
|
<Flexbox direction={directionReverse ? 'horizontal-reverse' : 'horizontal'} gap={4}>
|
|
81
81
|
{model.files && (
|
|
82
|
-
<Tooltip
|
|
83
|
-
|
|
82
|
+
<Tooltip
|
|
83
|
+
overlayStyle={{ pointerEvents: 'none' }}
|
|
84
|
+
placement={placement}
|
|
85
|
+
title={t('ModelSelect.featureTag.file')}
|
|
86
|
+
>
|
|
87
|
+
<div className={cx(styles.tag, styles.tagGreen)} style={{ cursor: 'pointer' }} title="">
|
|
84
88
|
<Icon icon={LucidePaperclip} />
|
|
85
89
|
</div>
|
|
86
90
|
</Tooltip>
|
|
87
91
|
)}
|
|
88
92
|
{model.vision && (
|
|
89
|
-
<Tooltip
|
|
93
|
+
<Tooltip
|
|
94
|
+
overlayStyle={{ pointerEvents: 'none' }}
|
|
95
|
+
placement={placement}
|
|
96
|
+
title={t('ModelSelect.featureTag.vision')}
|
|
97
|
+
>
|
|
90
98
|
<div className={cx(styles.tag, styles.tagGreen)} style={{ cursor: 'pointer' }} title="">
|
|
91
99
|
<Icon icon={LucideEye} />
|
|
92
100
|
</div>
|
|
@@ -94,7 +102,7 @@ export const ModelInfoTags = memo<ModelInfoTagsProps>(
|
|
|
94
102
|
)}
|
|
95
103
|
{model.functionCall && (
|
|
96
104
|
<Tooltip
|
|
97
|
-
overlayStyle={{ maxWidth: 'unset' }}
|
|
105
|
+
overlayStyle={{ maxWidth: 'unset', pointerEvents: 'none' }}
|
|
98
106
|
placement={placement}
|
|
99
107
|
title={t('ModelSelect.featureTag.functionCall')}
|
|
100
108
|
>
|
|
@@ -105,7 +113,7 @@ export const ModelInfoTags = memo<ModelInfoTagsProps>(
|
|
|
105
113
|
)}
|
|
106
114
|
{model.tokens !== undefined && (
|
|
107
115
|
<Tooltip
|
|
108
|
-
overlayStyle={{ maxWidth: 'unset' }}
|
|
116
|
+
overlayStyle={{ maxWidth: 'unset', pointerEvents: 'none' }}
|
|
109
117
|
placement={placement}
|
|
110
118
|
title={t('ModelSelect.featureTag.tokens', {
|
|
111
119
|
tokens: model.tokens === 0 ? '∞' : numeral(model.tokens).format('0,0'),
|
|
@@ -38,11 +38,14 @@ const useStyles = createStyles(({ css, prefixCls }) => ({
|
|
|
38
38
|
`,
|
|
39
39
|
}));
|
|
40
40
|
|
|
41
|
+
const menuKey = (provider: string, model: string) => `${provider}-${model}`;
|
|
42
|
+
|
|
41
43
|
const ModelSwitchPanel = memo<PropsWithChildren>(({ children }) => {
|
|
42
44
|
const { t } = useTranslation('components');
|
|
43
45
|
const { styles, theme } = useStyles();
|
|
44
|
-
const [model, updateAgentConfig] = useAgentStore((s) => [
|
|
46
|
+
const [model, provider, updateAgentConfig] = useAgentStore((s) => [
|
|
45
47
|
agentSelectors.currentAgentModel(s),
|
|
48
|
+
agentSelectors.currentAgentModelProvider(s),
|
|
46
49
|
s.updateAgentConfig,
|
|
47
50
|
]);
|
|
48
51
|
|
|
@@ -52,7 +55,7 @@ const ModelSwitchPanel = memo<PropsWithChildren>(({ children }) => {
|
|
|
52
55
|
const items = useMemo<ItemType[]>(() => {
|
|
53
56
|
const getModelItems = (provider: ModelProviderCard) => {
|
|
54
57
|
const items = provider.chatModels.map((model) => ({
|
|
55
|
-
key: model.id,
|
|
58
|
+
key: menuKey(provider.id, model.id),
|
|
56
59
|
label: <ModelItemRender {...model} />,
|
|
57
60
|
onClick: () => {
|
|
58
61
|
updateAgentConfig({ model: model.id, provider: provider.id });
|
|
@@ -91,7 +94,7 @@ const ModelSwitchPanel = memo<PropsWithChildren>(({ children }) => {
|
|
|
91
94
|
return (
|
|
92
95
|
<Dropdown
|
|
93
96
|
menu={{
|
|
94
|
-
activeKey: model,
|
|
97
|
+
activeKey: menuKey(provider, model),
|
|
95
98
|
className: styles.menu,
|
|
96
99
|
items,
|
|
97
100
|
style: {
|
|
@@ -157,7 +157,7 @@ describe('agentSelectors', () => {
|
|
|
157
157
|
expect(provider).toBe(mockSessionStore.agentConfig.provider);
|
|
158
158
|
});
|
|
159
159
|
|
|
160
|
-
it('should
|
|
160
|
+
it('should fallback to openai if provider is not defined in the agent config', () => {
|
|
161
161
|
const modifiedStore = {
|
|
162
162
|
...mockSessionStore,
|
|
163
163
|
agentConfig: {
|
|
@@ -166,7 +166,7 @@ describe('agentSelectors', () => {
|
|
|
166
166
|
},
|
|
167
167
|
};
|
|
168
168
|
const provider = agentSelectors.currentAgentModelProvider(modifiedStore);
|
|
169
|
-
expect(provider).
|
|
169
|
+
expect(provider).toEqual('openai');
|
|
170
170
|
});
|
|
171
171
|
});
|
|
172
172
|
|
|
@@ -28,7 +28,7 @@ const currentAgentModel = (s: AgentStore): string => {
|
|
|
28
28
|
const currentAgentModelProvider = (s: AgentStore) => {
|
|
29
29
|
const config = currentAgentConfig(s);
|
|
30
30
|
|
|
31
|
-
return config?.provider;
|
|
31
|
+
return config?.provider || 'openai';
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const currentAgentPlugins = (s: AgentStore) => {
|