@lobehub/chat 0.114.8 → 0.115.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/.i18nrc.js +3 -0
- package/CHANGELOG.md +50 -0
- package/locales/de-DE/common.json +20 -0
- package/locales/de-DE/tool.json +8 -0
- package/locales/en-US/common.json +20 -0
- package/locales/en-US/tool.json +8 -0
- package/locales/es-ES/common.json +20 -0
- package/locales/es-ES/tool.json +8 -0
- package/locales/fr-FR/common.json +20 -0
- package/locales/fr-FR/tool.json +8 -0
- package/locales/it-IT/chat.json +77 -0
- package/locales/it-IT/common.json +113 -0
- package/locales/it-IT/empty.json +6 -0
- package/locales/it-IT/error.json +53 -0
- package/locales/it-IT/market.json +30 -0
- package/locales/it-IT/migration.json +45 -0
- package/locales/it-IT/plugin.json +166 -0
- package/locales/it-IT/setting.json +306 -0
- package/locales/it-IT/tool.json +8 -0
- package/locales/it-IT/welcome.json +14 -0
- package/locales/ja-JP/common.json +20 -0
- package/locales/ja-JP/tool.json +8 -0
- package/locales/ko-KR/common.json +20 -0
- package/locales/ko-KR/tool.json +8 -0
- package/locales/nl-NL/chat.json +77 -0
- package/locales/nl-NL/common.json +113 -0
- package/locales/nl-NL/empty.json +6 -0
- package/locales/nl-NL/error.json +53 -0
- package/locales/nl-NL/market.json +30 -0
- package/locales/nl-NL/migration.json +45 -0
- package/locales/nl-NL/plugin.json +166 -0
- package/locales/nl-NL/setting.json +306 -0
- package/locales/nl-NL/tool.json +8 -0
- package/locales/nl-NL/welcome.json +14 -0
- package/locales/pl-PL/chat.json +77 -0
- package/locales/pl-PL/common.json +113 -0
- package/locales/pl-PL/empty.json +6 -0
- package/locales/pl-PL/error.json +53 -0
- package/locales/pl-PL/market.json +30 -0
- package/locales/pl-PL/migration.json +45 -0
- package/locales/pl-PL/plugin.json +166 -0
- package/locales/pl-PL/setting.json +306 -0
- package/locales/pl-PL/tool.json +8 -0
- package/locales/pl-PL/welcome.json +14 -0
- package/locales/pt-BR/common.json +20 -0
- package/locales/pt-BR/tool.json +8 -0
- package/locales/ru-RU/common.json +20 -0
- package/locales/ru-RU/tool.json +8 -0
- package/locales/tr-TR/common.json +20 -0
- package/locales/tr-TR/tool.json +8 -0
- package/locales/zh-CN/common.json +20 -0
- package/locales/zh-CN/plugin.json +2 -2
- package/locales/zh-CN/setting.json +1 -1
- package/locales/zh-CN/tool.json +8 -0
- package/locales/zh-TW/common.json +20 -0
- package/locales/zh-TW/tool.json +8 -0
- package/package.json +1 -1
- package/src/app/api/openai/images/createImageGeneration.ts +26 -0
- package/src/app/api/openai/images/route.ts +16 -0
- package/src/app/api/proxy/route.ts +3 -1
- package/src/app/chat/(desktop)/features/ChatHeader.tsx +56 -56
- package/src/app/chat/features/ChatHeader/PluginTag/PluginStatus.tsx +7 -4
- package/src/app/chat/features/ChatHeader/PluginTag/index.tsx +3 -3
- package/src/app/chat/features/SystemRole/index.tsx +0 -1
- package/src/components/GalleyGrid/Grid.tsx +36 -0
- package/src/components/GalleyGrid/index.tsx +58 -0
- package/src/components/GalleyGrid/style.ts +24 -0
- package/src/const/settings.ts +7 -0
- package/src/database/schemas/files.ts +1 -0
- package/src/database/schemas/message.ts +1 -1
- package/src/features/AgentSetting/AgentPlugin/index.tsx +2 -2
- package/src/features/ChatInput/ActionBar/ModelSwitch.tsx +2 -1
- package/src/features/ChatInput/ActionBar/Token/TokenTag.tsx +3 -3
- package/src/features/ChatInput/ActionBar/Tools/index.tsx +26 -14
- package/src/features/Conversation/ChatList/Messages/Function.tsx +1 -1
- package/src/features/Conversation/ChatList/Plugins/Inspector/index.tsx +4 -2
- package/src/features/Conversation/ChatList/Plugins/Render/BuiltinType/index.tsx +36 -0
- package/src/features/Conversation/ChatList/Plugins/Render/DefaultType/index.tsx +6 -66
- package/src/features/Conversation/ChatList/Plugins/Render/Loading.tsx +61 -0
- package/src/features/Conversation/ChatList/Plugins/Render/index.tsx +21 -12
- package/src/features/Conversation/ChatList/Plugins/Render/useParseContent.ts +15 -0
- package/src/locales/default/common.ts +20 -0
- package/src/locales/default/index.ts +2 -0
- package/src/locales/default/plugin.ts +2 -2
- package/src/locales/default/setting.ts +1 -1
- package/src/locales/default/tool.ts +9 -0
- package/src/locales/options.ts +14 -2
- package/src/services/__tests__/chat.test.ts +132 -2
- package/src/services/_url.ts +1 -0
- package/src/services/chat.ts +3 -5
- package/src/services/file.ts +20 -5
- package/src/services/imageGeneration.ts +26 -0
- package/src/store/chat/actions/enhance.ts +65 -1
- package/src/store/chat/actions/plugin.test.ts +9 -9
- package/src/store/chat/actions/plugin.ts +38 -6
- package/src/store/chat/initialState.ts +3 -0
- package/src/store/chat/selectors/enchance.ts +11 -0
- package/src/store/chat/selectors/index.ts +1 -0
- package/src/store/global/selectors/__snapshots__/settings.test.ts.snap +5 -0
- package/src/store/global/selectors/settings.ts +5 -0
- package/src/store/tool/helpers.ts +6 -5
- package/src/store/tool/initialState.ts +3 -1
- package/src/store/tool/selectors/index.ts +5 -0
- package/src/store/tool/selectors/tool.test.ts +128 -0
- package/src/store/tool/selectors/tool.ts +125 -0
- package/src/store/tool/slices/builtin/action.ts +54 -0
- package/src/store/tool/slices/builtin/index.ts +2 -0
- package/src/store/tool/slices/builtin/initialState.ts +13 -0
- package/src/store/tool/slices/builtin/selectors.test.ts +70 -0
- package/src/store/tool/slices/builtin/selectors.ts +20 -0
- package/src/store/tool/slices/customPlugin/action.ts +0 -3
- package/src/store/tool/slices/plugin/selectors.test.ts +0 -69
- package/src/store/tool/slices/plugin/selectors.ts +1 -84
- package/src/store/tool/store.ts +8 -2
- package/src/tools/dalle/Render/EditMode.tsx +66 -0
- package/src/tools/dalle/Render/Item.tsx +97 -0
- package/src/tools/dalle/Render/ToolBar.tsx +54 -0
- package/src/tools/dalle/Render/index.tsx +21 -0
- package/src/tools/dalle/index.ts +81 -0
- package/src/tools/index.ts +11 -0
- package/src/tools/renders.ts +8 -0
- package/src/types/chatMessage.ts +1 -1
- package/src/types/openai/image.ts +34 -0
- package/src/types/settings.ts +6 -0
- package/src/types/tool/builtin.ts +36 -0
- package/src/types/tool/dalle.ts +12 -0
- package/src/types/tool/index.ts +5 -1
- package/src/types/tool/tool.ts +9 -0
- package/src/store/tool/selectors.ts +0 -3
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BuiltinRender } from '@/types/tool';
|
|
2
|
+
|
|
3
|
+
import { DalleManifest } from './dalle';
|
|
4
|
+
import DalleRender from './dalle/Render';
|
|
5
|
+
|
|
6
|
+
export const BuiltinToolsRenders: Record<string, BuiltinRender> = {
|
|
7
|
+
[DalleManifest.identifier]: DalleRender as BuiltinRender,
|
|
8
|
+
};
|
package/src/types/chatMessage.ts
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DallEImageQuality, DallEImageSize, DallEImageStyle } from '@/types/tool/dalle';
|
|
2
|
+
|
|
3
|
+
export interface OpenAIImagePayload {
|
|
4
|
+
model: 'dall-e-2' | 'dall-e-3';
|
|
5
|
+
/**
|
|
6
|
+
* The number of images to generate. Must be between 1 and 10.
|
|
7
|
+
*/
|
|
8
|
+
n?: number;
|
|
9
|
+
/**
|
|
10
|
+
* A text description of the desired image(s).
|
|
11
|
+
* The maximum length is 1000 characters.
|
|
12
|
+
*/
|
|
13
|
+
prompt: string;
|
|
14
|
+
/**
|
|
15
|
+
* The quality of the image that will be generated.
|
|
16
|
+
* hd creates images with finer details and greater consistency across the image.
|
|
17
|
+
* This param is only supported for dall-e-3.
|
|
18
|
+
*/
|
|
19
|
+
quality?: DallEImageQuality;
|
|
20
|
+
/**
|
|
21
|
+
* The size of the generated images.
|
|
22
|
+
* Must be one of '1792x1024' , '1024x1024' , '1024x1792'
|
|
23
|
+
*/
|
|
24
|
+
size?: DallEImageSize;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The style of the generated images. Must be one of vivid or natural.
|
|
28
|
+
* Vivid causes the model to lean towards generating hyper-real and dramatic images.
|
|
29
|
+
* Natural causes the model to produce more natural, less hyper-real looking images.
|
|
30
|
+
* This param is only supported for dall-e-3.
|
|
31
|
+
* @default vivid
|
|
32
|
+
*/
|
|
33
|
+
style?: DallEImageStyle;
|
|
34
|
+
}
|
package/src/types/settings.ts
CHANGED
|
@@ -75,12 +75,18 @@ export interface GlobalTTSConfig {
|
|
|
75
75
|
|
|
76
76
|
export type LLMBrand = keyof GlobalLLMConfig;
|
|
77
77
|
|
|
78
|
+
export interface GlobalTool {
|
|
79
|
+
dalle: {
|
|
80
|
+
autoGenerate: boolean;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
78
83
|
/**
|
|
79
84
|
* 配置设置
|
|
80
85
|
*/
|
|
81
86
|
export interface GlobalSettings extends GlobalBaseSettings {
|
|
82
87
|
defaultAgent: GlobalDefaultAgent;
|
|
83
88
|
languageModel: GlobalLLMConfig;
|
|
89
|
+
tool: GlobalTool;
|
|
84
90
|
tts: GlobalTTSConfig;
|
|
85
91
|
}
|
|
86
92
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { LobeChatPluginApi, Meta } from '@lobehub/chat-plugin-sdk';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface BuiltinToolManifest {
|
|
5
|
+
api: LobeChatPluginApi[];
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Plugin name
|
|
9
|
+
*/
|
|
10
|
+
identifier: string;
|
|
11
|
+
/**
|
|
12
|
+
* metadata
|
|
13
|
+
* @desc Meta data of the plugin
|
|
14
|
+
*/
|
|
15
|
+
meta: Meta;
|
|
16
|
+
systemRole: string;
|
|
17
|
+
/**
|
|
18
|
+
* plugin runtime type
|
|
19
|
+
* @default default
|
|
20
|
+
*/
|
|
21
|
+
type?: 'builtin';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface LobeBuiltinTool {
|
|
25
|
+
identifier: string;
|
|
26
|
+
manifest: BuiltinToolManifest;
|
|
27
|
+
type: 'builtin';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface BuiltinRenderProps<Result = any> {
|
|
31
|
+
content: Result;
|
|
32
|
+
identifier?: string;
|
|
33
|
+
messageId: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type BuiltinRender = <T = any>(props: BuiltinRenderProps<T>) => ReactNode;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type DallEImageQuality = 'standard' | 'hd';
|
|
2
|
+
export type DallEImageStyle = 'vivid' | 'natural';
|
|
3
|
+
export type DallEImageSize = '1792x1024' | '1024x1024' | '1024x1792';
|
|
4
|
+
|
|
5
|
+
export interface DallEImageItem {
|
|
6
|
+
imageId?: string;
|
|
7
|
+
previewUrl?: string;
|
|
8
|
+
prompt: string;
|
|
9
|
+
quality: DallEImageQuality;
|
|
10
|
+
size: DallEImageSize;
|
|
11
|
+
style: DallEImageStyle;
|
|
12
|
+
}
|
package/src/types/tool/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LobeChatPluginManifest } from '@lobehub/chat-plugin-sdk';
|
|
1
|
+
import { LobeChatPluginManifest, LobePluginType } from '@lobehub/chat-plugin-sdk';
|
|
2
2
|
|
|
3
3
|
import { CustomPluginParams } from './plugin';
|
|
4
4
|
import { LobeToolType } from './tool';
|
|
@@ -10,3 +10,7 @@ export interface LobeTool {
|
|
|
10
10
|
settings?: any;
|
|
11
11
|
type: LobeToolType;
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
export type LobeToolRenderType = LobePluginType | 'builtin';
|
|
15
|
+
|
|
16
|
+
export * from './builtin';
|
package/src/types/tool/tool.ts
CHANGED