@lobehub/chat 1.5.5 → 1.6.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/.i18nrc.js +1 -1
- package/.seorc.cjs +1 -1
- package/CHANGELOG.md +50 -0
- package/README.md +8 -8
- package/README.zh-CN.md +8 -8
- package/locales/ar/chat.json +1 -5
- package/locales/ar/components.json +6 -0
- package/locales/ar/setting.json +0 -6
- package/locales/bg-BG/chat.json +1 -5
- package/locales/bg-BG/components.json +6 -0
- package/locales/bg-BG/setting.json +0 -6
- package/locales/de-DE/chat.json +1 -5
- package/locales/de-DE/components.json +6 -0
- package/locales/de-DE/setting.json +0 -6
- package/locales/en-US/chat.json +1 -5
- package/locales/en-US/components.json +6 -0
- package/locales/en-US/setting.json +0 -6
- package/locales/es-ES/chat.json +1 -5
- package/locales/es-ES/components.json +6 -0
- package/locales/es-ES/setting.json +0 -6
- package/locales/fr-FR/chat.json +1 -5
- package/locales/fr-FR/components.json +6 -0
- package/locales/fr-FR/setting.json +0 -6
- package/locales/it-IT/chat.json +1 -5
- package/locales/it-IT/components.json +6 -0
- package/locales/it-IT/setting.json +0 -6
- package/locales/ja-JP/chat.json +1 -5
- package/locales/ja-JP/components.json +6 -0
- package/locales/ja-JP/setting.json +0 -6
- package/locales/ko-KR/chat.json +1 -5
- package/locales/ko-KR/components.json +6 -0
- package/locales/ko-KR/setting.json +0 -6
- package/locales/nl-NL/chat.json +1 -5
- package/locales/nl-NL/components.json +6 -0
- package/locales/nl-NL/setting.json +0 -6
- package/locales/pl-PL/chat.json +1 -5
- package/locales/pl-PL/components.json +6 -0
- package/locales/pl-PL/setting.json +0 -6
- package/locales/pt-BR/chat.json +1 -5
- package/locales/pt-BR/components.json +6 -0
- package/locales/pt-BR/setting.json +0 -6
- package/locales/ru-RU/chat.json +1 -5
- package/locales/ru-RU/components.json +6 -0
- package/locales/ru-RU/setting.json +0 -6
- package/locales/tr-TR/chat.json +1 -5
- package/locales/tr-TR/components.json +6 -0
- package/locales/tr-TR/setting.json +0 -6
- package/locales/vi-VN/chat.json +1 -5
- package/locales/vi-VN/components.json +6 -0
- package/locales/vi-VN/setting.json +0 -6
- package/locales/zh-CN/chat.json +2 -6
- package/locales/zh-CN/components.json +6 -0
- package/locales/zh-CN/setting.json +0 -6
- package/locales/zh-TW/chat.json +1 -5
- package/locales/zh-TW/components.json +6 -0
- package/locales/zh-TW/setting.json +0 -6
- package/package.json +1 -1
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/index.tsx +18 -2
- package/src/{app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/DragUpload.tsx → components/DragUpload/index.tsx} +14 -31
- package/src/config/modelProviders/openai.ts +59 -50
- package/src/const/settings/agent.ts +2 -1
- package/src/const/settings/llm.ts +1 -1
- package/src/database/client/schemas/session.ts +2 -1
- package/src/layout/GlobalProvider/Locale.tsx +19 -2
- package/src/libs/agent-runtime/openai/__snapshots__/index.test.ts.snap +0 -1
- package/src/libs/agent-runtime/openrouter/__snapshots__/index.test.ts.snap +1 -1
- package/src/locales/default/chat.ts +0 -4
- package/src/locales/default/components.ts +6 -0
- package/src/locales/default/setting.ts +0 -6
- package/src/store/user/slices/modelList/selectors/modelProvider.test.ts +1 -1
- package/src/store/user/slices/modelList/selectors/modelProvider.ts +1 -1
- package/src/types/agent/index.ts +1 -1
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
+
"DragUpload": {
|
|
3
|
+
"dragDesc": "Arraste os arquivos para cá, suportando o upload de várias imagens.",
|
|
4
|
+
"dragFileDesc": "Arraste imagens e arquivos para cá, suportando o upload de várias imagens e arquivos.",
|
|
5
|
+
"dragFileTitle": "Enviar arquivo",
|
|
6
|
+
"dragTitle": "Enviar imagem"
|
|
7
|
+
},
|
|
2
8
|
"ModelSelect": {
|
|
3
9
|
"featureTag": {
|
|
4
10
|
"custom": "Modelo personalizado, por padrão, suporta chamadas de função e reconhecimento visual. Por favor, verifique a disponibilidade dessas capacidades de acordo com a situação real.",
|
|
@@ -210,12 +210,6 @@
|
|
|
210
210
|
},
|
|
211
211
|
"model": {
|
|
212
212
|
"desc": "{{provider}} modelo",
|
|
213
|
-
"list": {
|
|
214
|
-
"gpt-3.5-turbo": "GPT 3.5",
|
|
215
|
-
"gpt-3.5-turbo-16k": "GPT 3.5 (16K)",
|
|
216
|
-
"gpt-4": "GPT 4",
|
|
217
|
-
"gpt-4-32k": "GPT 4 (32K)"
|
|
218
|
-
},
|
|
219
213
|
"title": "Modelo"
|
|
220
214
|
},
|
|
221
215
|
"presencePenalty": {
|
package/locales/ru-RU/chat.json
CHANGED
|
@@ -130,10 +130,6 @@
|
|
|
130
130
|
"upload": {
|
|
131
131
|
"actionFiletip": "Загрузите файл",
|
|
132
132
|
"actionTooltip": "Загрузить изображение",
|
|
133
|
-
"disabled": "Текущая модель не поддерживает визуальное распознавание. Пожалуйста, выберите другую модель."
|
|
134
|
-
"dragDesc": "Перетащите файлы сюда, поддерживается загрузка нескольких изображений. Удерживайте Shift для отправки изображений",
|
|
135
|
-
"dragFileDesc": "Перетащите сюда изображения и файлы, чтобы можно было загрузить несколько изображений и файлов. Удерживайте нажатой клавишу Shift, чтобы отправить изображение или файл напрямую",
|
|
136
|
-
"dragFileTitle": "Загрузите файл",
|
|
137
|
-
"dragTitle": "Загрузить изображение"
|
|
133
|
+
"disabled": "Текущая модель не поддерживает визуальное распознавание. Пожалуйста, выберите другую модель."
|
|
138
134
|
}
|
|
139
135
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
+
"DragUpload": {
|
|
3
|
+
"dragDesc": "Перетащите файлы сюда, поддерживается загрузка нескольких изображений.",
|
|
4
|
+
"dragFileDesc": "Перетащите изображения и файлы сюда, поддерживается загрузка нескольких изображений и файлов.",
|
|
5
|
+
"dragFileTitle": "Загрузить файл",
|
|
6
|
+
"dragTitle": "Загрузить изображение"
|
|
7
|
+
},
|
|
2
8
|
"ModelSelect": {
|
|
3
9
|
"featureTag": {
|
|
4
10
|
"custom": "Пользовательская модель по умолчанию поддерживает как вызов функций, так и распознавание изображений. Пожалуйста, проверьте доступность указанных возможностей в вашем случае",
|
|
@@ -210,12 +210,6 @@
|
|
|
210
210
|
},
|
|
211
211
|
"model": {
|
|
212
212
|
"desc": "{{provider}} модель",
|
|
213
|
-
"list": {
|
|
214
|
-
"gpt-3.5-turbo": "GPT 3.5",
|
|
215
|
-
"gpt-3.5-turbo-16k": "GPT 3.5 (16K)",
|
|
216
|
-
"gpt-4": "GPT 4",
|
|
217
|
-
"gpt-4-32k": "GPT 4 (32K)"
|
|
218
|
-
},
|
|
219
213
|
"title": "Модель"
|
|
220
214
|
},
|
|
221
215
|
"presencePenalty": {
|
package/locales/tr-TR/chat.json
CHANGED
|
@@ -130,10 +130,6 @@
|
|
|
130
130
|
"upload": {
|
|
131
131
|
"actionFiletip": "Dosyayı Yükle",
|
|
132
132
|
"actionTooltip": "Resim Yükle",
|
|
133
|
-
"disabled": "Geçerli model görüntü tanıma desteğini desteklemiyor, lütfen modeli değiştirerek kullanın"
|
|
134
|
-
"dragDesc": "Dosyaları buraya sürükleyip bırakın, birden fazla resim yüklemeyi destekler. Resimleri doğrudan göndermek için Shift tuşunu basılı tutun.",
|
|
135
|
-
"dragFileDesc": "Birden fazla resim ve dosya yüklemeyi desteklemek için resimleri ve dosyaları buraya sürükleyin. Bir görüntüyü veya dosyayı doğrudan göndermek için Shift tuşunu basılı tutun.",
|
|
136
|
-
"dragFileTitle": "Dosyayı Yükle",
|
|
137
|
-
"dragTitle": "Resim Yükle"
|
|
133
|
+
"disabled": "Geçerli model görüntü tanıma desteğini desteklemiyor, lütfen modeli değiştirerek kullanın"
|
|
138
134
|
}
|
|
139
135
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
+
"DragUpload": {
|
|
3
|
+
"dragDesc": "Dosyaları buraya sürükleyin, birden fazla resim yüklemeyi destekler.",
|
|
4
|
+
"dragFileDesc": "Resimleri ve dosyaları buraya sürükleyin, birden fazla resim ve dosya yüklemeyi destekler.",
|
|
5
|
+
"dragFileTitle": "Dosya Yükle",
|
|
6
|
+
"dragTitle": "Resim Yükle"
|
|
7
|
+
},
|
|
2
8
|
"ModelSelect": {
|
|
3
9
|
"featureTag": {
|
|
4
10
|
"custom": "Özel model, varsayılan olarak hem fonksiyon çağrısını hem de görüntü tanımayı destekler, yukarıdaki yeteneklerin kullanılabilirliğini doğrulamak için lütfen gerçek durumu kontrol edin",
|
|
@@ -210,12 +210,6 @@
|
|
|
210
210
|
},
|
|
211
211
|
"model": {
|
|
212
212
|
"desc": "{{provider}} Model",
|
|
213
|
-
"list": {
|
|
214
|
-
"gpt-3.5-turbo": "GPT 3.5",
|
|
215
|
-
"gpt-3.5-turbo-16k": "GPT 3.5 (16K)",
|
|
216
|
-
"gpt-4": "GPT 4",
|
|
217
|
-
"gpt-4-32k": "GPT 4 (32K)"
|
|
218
|
-
},
|
|
219
213
|
"title": "Model"
|
|
220
214
|
},
|
|
221
215
|
"presencePenalty": {
|
package/locales/vi-VN/chat.json
CHANGED
|
@@ -130,10 +130,6 @@
|
|
|
130
130
|
"upload": {
|
|
131
131
|
"actionFiletip": "Tải lên tập tin",
|
|
132
132
|
"actionTooltip": "Tải lên hình ảnh",
|
|
133
|
-
"disabled": "Mô hình hiện tại không hỗ trợ nhận diện hình ảnh, vui lòng chuyển đổi mô hình trước khi sử dụng"
|
|
134
|
-
"dragDesc": "Kéo và thả tệp vào đây, hỗ trợ tải lên nhiều hình ảnh. Giữ phím Shift để gửi hình ảnh trực tiếp",
|
|
135
|
-
"dragFileDesc": "Kéo ảnh và tệp vào đây để hỗ trợ tải lên nhiều ảnh và tệp. Giữ phím Shift để gửi hình ảnh hoặc tập tin trực tiếp",
|
|
136
|
-
"dragFileTitle": "Tải lên tập tin",
|
|
137
|
-
"dragTitle": "Tải lên hình ảnh"
|
|
133
|
+
"disabled": "Mô hình hiện tại không hỗ trợ nhận diện hình ảnh, vui lòng chuyển đổi mô hình trước khi sử dụng"
|
|
138
134
|
}
|
|
139
135
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
+
"DragUpload": {
|
|
3
|
+
"dragDesc": "Kéo và thả tệp vào đây, hỗ trợ tải lên nhiều hình ảnh.",
|
|
4
|
+
"dragFileDesc": "Kéo và thả hình ảnh và tệp vào đây, hỗ trợ tải lên nhiều hình ảnh và tệp.",
|
|
5
|
+
"dragFileTitle": "Tải lên tệp",
|
|
6
|
+
"dragTitle": "Tải lên hình ảnh"
|
|
7
|
+
},
|
|
2
8
|
"ModelSelect": {
|
|
3
9
|
"featureTag": {
|
|
4
10
|
"custom": "Mô hình tùy chỉnh, mặc định hỗ trợ cả cuộc gọi hàm và nhận diện hình ảnh, vui lòng xác minh khả năng sử dụng của chúng theo tình hình cụ thể",
|
|
@@ -210,12 +210,6 @@
|
|
|
210
210
|
},
|
|
211
211
|
"model": {
|
|
212
212
|
"desc": "Mô hình {{provider}}",
|
|
213
|
-
"list": {
|
|
214
|
-
"gpt-3.5-turbo": "GPT 3.5",
|
|
215
|
-
"gpt-3.5-turbo-16k": "GPT 3.5 (16K)",
|
|
216
|
-
"gpt-4": "GPT 4",
|
|
217
|
-
"gpt-4-32k": "GPT 4 (32K)"
|
|
218
|
-
},
|
|
219
213
|
"title": "Mô hình"
|
|
220
214
|
},
|
|
221
215
|
"presencePenalty": {
|
package/locales/zh-CN/chat.json
CHANGED
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
"export": "导出话题"
|
|
101
101
|
},
|
|
102
102
|
"checkOpenNewTopic": "是否开启新话题?",
|
|
103
|
+
"checkSaveCurrentMessages": "是否保存当前会话为话题?",
|
|
103
104
|
"confirmRemoveAll": "即将删除全部话题,删除后将不可恢复,请谨慎操作。",
|
|
104
105
|
"confirmRemoveTopic": "即将删除该话题,删除后将不可恢复,请谨慎操作。",
|
|
105
106
|
"confirmRemoveUnstarred": "即将删除未收藏话题,删除后将不可恢复,请谨慎操作。",
|
|
@@ -113,7 +114,6 @@
|
|
|
113
114
|
"openNewTopic": "开启新话题",
|
|
114
115
|
"removeAll": "删除全部话题",
|
|
115
116
|
"removeUnstarred": "删除未收藏话题",
|
|
116
|
-
"checkSaveCurrentMessages": "是否保存当前会话为话题?",
|
|
117
117
|
"saveCurrentMessages": "将当前会话保存为话题",
|
|
118
118
|
"searchPlaceholder": "搜索话题...",
|
|
119
119
|
"title": "话题"
|
|
@@ -130,10 +130,6 @@
|
|
|
130
130
|
"upload": {
|
|
131
131
|
"actionFiletip": "上传文件",
|
|
132
132
|
"actionTooltip": "上传图片",
|
|
133
|
-
"disabled": "当前模型不支持视觉识别和文件分析,请切换模型后使用"
|
|
134
|
-
"dragDesc": "拖拽文件到这里,支持上传多个图片。按住 Shift 直接发送图片",
|
|
135
|
-
"dragFileDesc": "拖拽图片和文件到这里,支持上传多个图片和文件。按住 Shift 直接发送图片或文件",
|
|
136
|
-
"dragFileTitle": "上传文件",
|
|
137
|
-
"dragTitle": "上传图片"
|
|
133
|
+
"disabled": "当前模型不支持视觉识别和文件分析,请切换模型后使用"
|
|
138
134
|
}
|
|
139
135
|
}
|
|
@@ -210,12 +210,6 @@
|
|
|
210
210
|
},
|
|
211
211
|
"model": {
|
|
212
212
|
"desc": "{{provider}} 模型",
|
|
213
|
-
"list": {
|
|
214
|
-
"gpt-3.5-turbo": "GPT 3.5",
|
|
215
|
-
"gpt-3.5-turbo-16k": "GPT 3.5 (16K)",
|
|
216
|
-
"gpt-4": "GPT 4",
|
|
217
|
-
"gpt-4-32k": "GPT 4 (32K)"
|
|
218
|
-
},
|
|
219
213
|
"title": "模型"
|
|
220
214
|
},
|
|
221
215
|
"presencePenalty": {
|
package/locales/zh-TW/chat.json
CHANGED
|
@@ -130,10 +130,6 @@
|
|
|
130
130
|
"upload": {
|
|
131
131
|
"actionFiletip": "上傳文件",
|
|
132
132
|
"actionTooltip": "上傳圖片",
|
|
133
|
-
"disabled": "當前模型不支援視覺識別,請切換模型後使用"
|
|
134
|
-
"dragDesc": "拖拽文件到這裡,支持上傳多個圖片。按住 Shift 直接發送圖片",
|
|
135
|
-
"dragFileDesc": "拖曳圖片和文件至此,支援上傳多張圖片和文件。按住 Shift 直接傳送圖片或文件",
|
|
136
|
-
"dragFileTitle": "上傳文件",
|
|
137
|
-
"dragTitle": "上傳圖片"
|
|
133
|
+
"disabled": "當前模型不支援視覺識別,請切換模型後使用"
|
|
138
134
|
}
|
|
139
135
|
}
|
|
@@ -210,12 +210,6 @@
|
|
|
210
210
|
},
|
|
211
211
|
"model": {
|
|
212
212
|
"desc": "{{provider}} 模型",
|
|
213
|
-
"list": {
|
|
214
|
-
"gpt-3.5-turbo": "GPT 3.5",
|
|
215
|
-
"gpt-3.5-turbo-16k": "GPT 3.5 (16K)",
|
|
216
|
-
"gpt-4": "GPT 4",
|
|
217
|
-
"gpt-4-32k": "GPT 4 (32K)"
|
|
218
|
-
},
|
|
219
213
|
"title": "模型"
|
|
220
214
|
},
|
|
221
215
|
"presencePenalty": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
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",
|
package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/index.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import { memo, useEffect, useState } from 'react';
|
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
import { Center, Flexbox } from 'react-layout-kit';
|
|
9
9
|
|
|
10
|
+
import DragUpload from '@/components/DragUpload';
|
|
10
11
|
import StopLoadingIcon from '@/components/StopLoading';
|
|
11
12
|
import SaveTopic from '@/features/ChatInput/Topic';
|
|
12
13
|
import { useSendMessage } from '@/features/ChatInput/useSend';
|
|
@@ -19,7 +20,6 @@ import { useUserStore } from '@/store/user';
|
|
|
19
20
|
import { modelProviderSelectors, preferenceSelectors } from '@/store/user/selectors';
|
|
20
21
|
import { isMacOS } from '@/utils/platform';
|
|
21
22
|
|
|
22
|
-
import DragUpload from './DragUpload';
|
|
23
23
|
import { LocalFiles } from './LocalFiles';
|
|
24
24
|
import SendMore from './SendMore';
|
|
25
25
|
|
|
@@ -77,11 +77,27 @@ const Footer = memo<FooterProps>(({ setExpand }) => {
|
|
|
77
77
|
|
|
78
78
|
const model = useAgentStore(agentSelectors.currentAgentModel);
|
|
79
79
|
|
|
80
|
+
const enabledFiles = useUserStore(modelProviderSelectors.isModelEnabledFiles(model));
|
|
81
|
+
|
|
80
82
|
const [useCmdEnterToSend, canUpload] = useUserStore((s) => [
|
|
81
83
|
preferenceSelectors.useCmdEnterToSend(s),
|
|
82
84
|
modelProviderSelectors.isModelEnabledUpload(model)(s),
|
|
83
85
|
]);
|
|
84
86
|
|
|
87
|
+
const uploadFile = useFileStore((s) => s.uploadFile);
|
|
88
|
+
|
|
89
|
+
const uploadImages = async (fileList: FileList | undefined) => {
|
|
90
|
+
if (!fileList || fileList.length === 0) return;
|
|
91
|
+
|
|
92
|
+
const pools = Array.from(fileList).map(async (file) => {
|
|
93
|
+
// skip none-file items
|
|
94
|
+
if (!file.type.startsWith('image') && !enabledFiles) return;
|
|
95
|
+
await uploadFile(file);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
await Promise.all(pools);
|
|
99
|
+
};
|
|
100
|
+
|
|
85
101
|
const sendMessage = useSendMessage();
|
|
86
102
|
|
|
87
103
|
const [isMac, setIsMac] = useState<boolean>();
|
|
@@ -128,7 +144,7 @@ const Footer = memo<FooterProps>(({ setExpand }) => {
|
|
|
128
144
|
<Flexbox align={'center'} gap={8} horizontal style={{ overflow: 'hidden' }}>
|
|
129
145
|
{canUpload && (
|
|
130
146
|
<>
|
|
131
|
-
<DragUpload />
|
|
147
|
+
<DragUpload enabledFiles={enabledFiles} onUploadFiles={uploadImages} />
|
|
132
148
|
<LocalFiles />
|
|
133
149
|
</>
|
|
134
150
|
)}
|
|
@@ -7,12 +7,6 @@ import { createPortal } from 'react-dom';
|
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
import { Center, Flexbox } from 'react-layout-kit';
|
|
9
9
|
|
|
10
|
-
import { useAgentStore } from '@/store/agent';
|
|
11
|
-
import { agentSelectors } from '@/store/agent/selectors';
|
|
12
|
-
import { useFileStore } from '@/store/file';
|
|
13
|
-
import { useUserStore } from '@/store/user';
|
|
14
|
-
import { modelProviderSelectors } from '@/store/user/selectors';
|
|
15
|
-
|
|
16
10
|
const DRAGGING_ROOT_ID = 'dragging-root';
|
|
17
11
|
const getContainer = () => document.querySelector(`#${DRAGGING_ROOT_ID}`);
|
|
18
12
|
const BLOCK_SIZE = 64;
|
|
@@ -33,10 +27,12 @@ const useStyles = createStyles(({ css, token }) => {
|
|
|
33
27
|
height: 100%;
|
|
34
28
|
padding: 16px;
|
|
35
29
|
|
|
36
|
-
border: 1.5px dashed
|
|
30
|
+
border: 1.5px dashed #fff;
|
|
37
31
|
border-radius: ${token.borderRadiusLG}px;
|
|
38
32
|
`,
|
|
39
33
|
desc: css`
|
|
34
|
+
font-size: 14px;
|
|
35
|
+
line-height: 22px;
|
|
40
36
|
color: #fff;
|
|
41
37
|
`,
|
|
42
38
|
icon: css`
|
|
@@ -77,33 +73,20 @@ const handleDragOver = (e: DragEvent) => {
|
|
|
77
73
|
}
|
|
78
74
|
};
|
|
79
75
|
|
|
80
|
-
|
|
76
|
+
interface DragUploadProps {
|
|
77
|
+
enabledFiles?: boolean;
|
|
78
|
+
onUploadFiles: (files?: FileList) => Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const DragUpload = memo<DragUploadProps>(({ enabledFiles = true, onUploadFiles }) => {
|
|
81
82
|
const { styles, theme } = useStyles();
|
|
82
|
-
const { t } = useTranslation('
|
|
83
|
+
const { t } = useTranslation('components');
|
|
83
84
|
const [isDragging, setIsDragging] = useState(false);
|
|
84
85
|
// When a file is dragged to a different area, the 'dragleave' event may be triggered,
|
|
85
86
|
// causing isDragging to be mistakenly set to false.
|
|
86
87
|
// to fix this issue, use a counter to ensure the status change only when drag event left the browser window .
|
|
87
88
|
const dragCounter = useRef(0);
|
|
88
89
|
|
|
89
|
-
const uploadFile = useFileStore((s) => s.uploadFile);
|
|
90
|
-
|
|
91
|
-
const model = useAgentStore(agentSelectors.currentAgentModel);
|
|
92
|
-
|
|
93
|
-
const enabledFiles = useUserStore(modelProviderSelectors.isModelEnabledFiles(model));
|
|
94
|
-
|
|
95
|
-
const uploadImages = async (fileList: FileList | undefined) => {
|
|
96
|
-
if (!fileList || fileList.length === 0) return;
|
|
97
|
-
|
|
98
|
-
const pools = Array.from(fileList).map(async (file) => {
|
|
99
|
-
// skip none-file items
|
|
100
|
-
if (!file.type.startsWith('image') && !enabledFiles) return;
|
|
101
|
-
await uploadFile(file);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
await Promise.all(pools);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
90
|
const handleDragEnter = (e: DragEvent) => {
|
|
108
91
|
if (!e.dataTransfer?.items || e.dataTransfer.items.length === 0) return;
|
|
109
92
|
|
|
@@ -148,7 +131,7 @@ const DragUpload = memo(() => {
|
|
|
148
131
|
const files = e.dataTransfer?.files;
|
|
149
132
|
|
|
150
133
|
// upload files
|
|
151
|
-
|
|
134
|
+
onUploadFiles(files);
|
|
152
135
|
}
|
|
153
136
|
};
|
|
154
137
|
|
|
@@ -156,7 +139,7 @@ const DragUpload = memo(() => {
|
|
|
156
139
|
// get files from clipboard
|
|
157
140
|
const files = event.clipboardData?.files;
|
|
158
141
|
|
|
159
|
-
|
|
142
|
+
onUploadFiles(files);
|
|
160
143
|
};
|
|
161
144
|
|
|
162
145
|
useEffect(() => {
|
|
@@ -229,10 +212,10 @@ const DragUpload = memo(() => {
|
|
|
229
212
|
</Flexbox>
|
|
230
213
|
<Flexbox align={'center'} gap={8} style={{ textAlign: 'center' }}>
|
|
231
214
|
<Flexbox className={styles.title}>
|
|
232
|
-
{t(enabledFiles ? '
|
|
215
|
+
{t(enabledFiles ? 'DragUpload.dragFileTitle' : 'DragUpload.dragTitle')}
|
|
233
216
|
</Flexbox>
|
|
234
217
|
<Flexbox className={styles.desc}>
|
|
235
|
-
{t(enabledFiles ? '
|
|
218
|
+
{t(enabledFiles ? 'DragUpload.dragFileDesc' : 'DragUpload.dragDesc')}
|
|
236
219
|
</Flexbox>
|
|
237
220
|
</Flexbox>
|
|
238
221
|
</Center>
|
|
@@ -4,48 +4,40 @@ import { ModelProviderCard } from '@/types/llm';
|
|
|
4
4
|
const OpenAI: ModelProviderCard = {
|
|
5
5
|
chatModels: [
|
|
6
6
|
{
|
|
7
|
-
description: '
|
|
8
|
-
displayName: 'GPT-
|
|
7
|
+
description: 'Currently points to gpt-4o-mini-2024-07-18',
|
|
8
|
+
displayName: 'GPT-4o mini',
|
|
9
9
|
enabled: true,
|
|
10
10
|
functionCall: true,
|
|
11
|
-
id: 'gpt-
|
|
12
|
-
|
|
11
|
+
id: 'gpt-4o-mini',
|
|
12
|
+
maxOutput: 16_385,
|
|
13
|
+
tokens: 128_000,
|
|
14
|
+
vision: true,
|
|
13
15
|
},
|
|
14
16
|
{
|
|
15
|
-
|
|
17
|
+
description: 'Currently points to gpt-4o-2024-05-13',
|
|
18
|
+
displayName: 'GPT-4o',
|
|
19
|
+
enabled: true,
|
|
16
20
|
functionCall: true,
|
|
17
|
-
id: 'gpt-
|
|
18
|
-
tokens:
|
|
21
|
+
id: 'gpt-4o',
|
|
22
|
+
tokens: 128_000,
|
|
23
|
+
vision: true,
|
|
19
24
|
},
|
|
20
25
|
{
|
|
21
|
-
|
|
26
|
+
description: 'GPT-4 Turbo with Vision',
|
|
27
|
+
displayName: 'GPT-4 Turbo',
|
|
28
|
+
enabled: true,
|
|
22
29
|
functionCall: true,
|
|
23
|
-
id: 'gpt-
|
|
24
|
-
tokens:
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
displayName: 'GPT-3.5 Turbo Instruct',
|
|
28
|
-
id: 'gpt-3.5-turbo-instruct',
|
|
29
|
-
tokens: 4096,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
description: 'Currently points to gpt-3.5-turbo-16k-0613',
|
|
33
|
-
displayName: 'GPT-3.5 Turbo 16K',
|
|
34
|
-
id: 'gpt-3.5-turbo-16k',
|
|
35
|
-
legacy: true,
|
|
36
|
-
tokens: 16_385,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
displayName: 'GPT-3.5 Turbo (0613)',
|
|
40
|
-
id: 'gpt-3.5-turbo-0613',
|
|
41
|
-
legacy: true,
|
|
42
|
-
tokens: 4096,
|
|
30
|
+
id: 'gpt-4-turbo',
|
|
31
|
+
tokens: 128_000,
|
|
32
|
+
vision: true,
|
|
43
33
|
},
|
|
44
34
|
{
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
description: 'GPT-4 Turbo 视觉版 (240409)',
|
|
36
|
+
displayName: 'GPT-4 Turbo Vision (240409)',
|
|
37
|
+
functionCall: true,
|
|
38
|
+
id: 'gpt-4-turbo-2024-04-09',
|
|
39
|
+
tokens: 128_000,
|
|
40
|
+
vision: true,
|
|
49
41
|
},
|
|
50
42
|
{
|
|
51
43
|
description: 'Currently points to gpt-4-0125-preview',
|
|
@@ -106,33 +98,50 @@ const OpenAI: ModelProviderCard = {
|
|
|
106
98
|
tokens: 32_768,
|
|
107
99
|
},
|
|
108
100
|
{
|
|
109
|
-
description: 'GPT
|
|
110
|
-
displayName: 'GPT-
|
|
111
|
-
enabled: true,
|
|
101
|
+
description: 'GPT 3.5 Turbo,适用于各种文本生成和理解任务',
|
|
102
|
+
displayName: 'GPT-3.5 Turbo',
|
|
112
103
|
functionCall: true,
|
|
113
|
-
id: 'gpt-
|
|
114
|
-
tokens:
|
|
115
|
-
vision: true,
|
|
104
|
+
id: 'gpt-3.5-turbo',
|
|
105
|
+
tokens: 16_385,
|
|
116
106
|
},
|
|
117
107
|
{
|
|
118
|
-
|
|
119
|
-
displayName: 'GPT-4 Turbo Vision (240409)',
|
|
108
|
+
displayName: 'GPT-3.5 Turbo (0125)',
|
|
120
109
|
functionCall: true,
|
|
121
|
-
id: 'gpt-
|
|
122
|
-
tokens:
|
|
123
|
-
vision: true,
|
|
110
|
+
id: 'gpt-3.5-turbo-0125',
|
|
111
|
+
tokens: 16_385,
|
|
124
112
|
},
|
|
125
113
|
{
|
|
126
|
-
|
|
127
|
-
displayName: 'GPT-4o',
|
|
128
|
-
enabled: true,
|
|
114
|
+
displayName: 'GPT-3.5 Turbo (1106)',
|
|
129
115
|
functionCall: true,
|
|
130
|
-
id: 'gpt-
|
|
131
|
-
tokens:
|
|
132
|
-
|
|
116
|
+
id: 'gpt-3.5-turbo-1106',
|
|
117
|
+
tokens: 16_385,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
displayName: 'GPT-3.5 Turbo Instruct',
|
|
121
|
+
id: 'gpt-3.5-turbo-instruct',
|
|
122
|
+
tokens: 4096,
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
description: 'Currently points to gpt-3.5-turbo-16k-0613',
|
|
126
|
+
displayName: 'GPT-3.5 Turbo 16K',
|
|
127
|
+
id: 'gpt-3.5-turbo-16k',
|
|
128
|
+
legacy: true,
|
|
129
|
+
tokens: 16_385,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
displayName: 'GPT-3.5 Turbo (0613)',
|
|
133
|
+
id: 'gpt-3.5-turbo-0613',
|
|
134
|
+
legacy: true,
|
|
135
|
+
tokens: 4096,
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
displayName: 'GPT-3.5 Turbo 16K (0613)',
|
|
139
|
+
id: 'gpt-3.5-turbo-16k-0613',
|
|
140
|
+
legacy: true,
|
|
141
|
+
tokens: 16_385,
|
|
133
142
|
},
|
|
134
143
|
],
|
|
135
|
-
checkModel: 'gpt-
|
|
144
|
+
checkModel: 'gpt-4o-mini',
|
|
136
145
|
enabled: true,
|
|
137
146
|
id: 'openai',
|
|
138
147
|
modelList: { showModelFetcher: true },
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_AGENT_META } from '@/const/meta';
|
|
2
|
+
import { DEFAULT_MODEL } from '@/const/settings/llm';
|
|
2
3
|
import { ModelProvider } from '@/libs/agent-runtime';
|
|
3
4
|
import { LobeAgentChatConfig, LobeAgentConfig, LobeAgentTTSConfig } from '@/types/agent';
|
|
4
5
|
import { UserDefaultAgent } from '@/types/user/settings';
|
|
@@ -21,7 +22,7 @@ export const DEFAULT_AGENT_CHAT_CONFIG: LobeAgentChatConfig = {
|
|
|
21
22
|
|
|
22
23
|
export const DEFAULT_AGENT_CONFIG: LobeAgentConfig = {
|
|
23
24
|
chatConfig: DEFAULT_AGENT_CHAT_CONFIG,
|
|
24
|
-
model:
|
|
25
|
+
model: DEFAULT_MODEL,
|
|
25
26
|
params: {
|
|
26
27
|
frequency_penalty: 0,
|
|
27
28
|
presence_penalty: 0,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
import { DEFAULT_MODEL } from '@/const/settings';
|
|
3
4
|
import { AgentChatConfigSchema } from '@/types/agent';
|
|
4
5
|
import { LobeMetaDataSchema } from '@/types/meta';
|
|
5
6
|
|
|
@@ -26,7 +27,7 @@ const ttsSchema = z.object({
|
|
|
26
27
|
export const AgentSchema = z.object({
|
|
27
28
|
chatConfig: AgentChatConfigSchema,
|
|
28
29
|
fewShots: fewShotsSchema.optional(),
|
|
29
|
-
model: z.string().default(
|
|
30
|
+
model: z.string().default(DEFAULT_MODEL),
|
|
30
31
|
params: z.object({
|
|
31
32
|
frequency_penalty: z.number().default(0).optional(),
|
|
32
33
|
max_tokens: z.number().optional(),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { ConfigProvider } from 'antd';
|
|
4
|
+
import dayjs from 'dayjs';
|
|
4
5
|
import { PropsWithChildren, memo, useEffect, useState } from 'react';
|
|
5
6
|
import { isRtlLang } from 'rtl-detect';
|
|
6
7
|
|
|
@@ -21,12 +22,24 @@ const Locale = memo<LocaleLayoutProps>(({ children, defaultLang, antdLocale }) =
|
|
|
21
22
|
// if run on server side, init i18n instance everytime
|
|
22
23
|
if (isOnServerSide) {
|
|
23
24
|
i18n.init();
|
|
25
|
+
|
|
26
|
+
// load the dayjs locale
|
|
27
|
+
if (lang) {
|
|
28
|
+
const dayJSLocale = require(`dayjs/locale/${lang!.toLowerCase()}.js`);
|
|
29
|
+
|
|
30
|
+
dayjs.locale(dayJSLocale);
|
|
31
|
+
}
|
|
24
32
|
} else {
|
|
25
33
|
// if on browser side, init i18n instance only once
|
|
26
34
|
if (!i18n.instance.isInitialized)
|
|
27
35
|
// console.debug('locale', lang);
|
|
28
|
-
i18n.init().then(() => {
|
|
29
|
-
|
|
36
|
+
i18n.init().then(async () => {
|
|
37
|
+
if (!lang) return;
|
|
38
|
+
|
|
39
|
+
// load default lang
|
|
40
|
+
const dayJSLocale = await import(`dayjs/locale/${lang!.toLowerCase()}.js`);
|
|
41
|
+
|
|
42
|
+
dayjs.locale(dayJSLocale.default);
|
|
30
43
|
});
|
|
31
44
|
}
|
|
32
45
|
|
|
@@ -39,6 +52,10 @@ const Locale = memo<LocaleLayoutProps>(({ children, defaultLang, antdLocale }) =
|
|
|
39
52
|
|
|
40
53
|
const newLocale = await getAntdLocale(lng);
|
|
41
54
|
setLocale(newLocale);
|
|
55
|
+
|
|
56
|
+
const dayJSLocale = await import(`dayjs/locale/${lng.toLowerCase()}.js`);
|
|
57
|
+
|
|
58
|
+
dayjs.locale(dayJSLocale.default);
|
|
42
59
|
};
|
|
43
60
|
|
|
44
61
|
i18n.instance.on('languageChanged', handleLang);
|
|
@@ -33,7 +33,7 @@ This project is led by [qnguyen3](https://twitter.com/stablequan) and [teknium](
|
|
|
33
33
|
|
|
34
34
|
Updated by OpenAI to point to the [latest version of GPT-3.5](/models?q=openai/gpt-3.5). Training data up to Sep 2021.",
|
|
35
35
|
"displayName": "OpenAI: GPT-3.5 Turbo",
|
|
36
|
-
"enabled":
|
|
36
|
+
"enabled": false,
|
|
37
37
|
"functionCall": false,
|
|
38
38
|
"id": "openai/gpt-3.5-turbo",
|
|
39
39
|
"maxTokens": 4096,
|