From 79cfbac11fbf5033e30b645d8385e9c4a6065e72 Mon Sep 17 00:00:00 2001 From: MatrixDynamo Date: Sat, 14 Sep 2024 03:19:24 +0800 Subject: [PATCH 1/7] Add a space between model and provider in ModelSelector to improve readability. --- app/components/chat.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index dafb9846421..fc7e04aef79 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -624,7 +624,7 @@ export function ChatActions(props: { items={models.map((m) => ({ title: `${m.displayName}${ m?.provider?.providerName - ? "(" + m?.provider?.providerName + ")" + ? " (" + m?.provider?.providerName + ")" : "" }`, value: `${m.name}@${m?.provider?.providerName}`, From fc274415619f0714f11cd888f2069930a2b693a5 Mon Sep 17 00:00:00 2001 From: skymkmk Date: Fri, 13 Sep 2024 21:09:03 +0800 Subject: [PATCH 2/7] feat: manual refresh for title --- app/components/chat.tsx | 12 ++++++++++++ app/store/chat.ts | 26 ++++++++++++++++---------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index dafb9846421..bd411826f0d 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -43,6 +43,7 @@ import QualityIcon from "../icons/hd.svg"; import StyleIcon from "../icons/palette.svg"; import PluginIcon from "../icons/plugin.svg"; import ShortcutkeyIcon from "../icons/shortcutkey.svg"; +import ReloadIcon from "../icons/reload.svg"; import { ChatMessage, @@ -1541,6 +1542,17 @@ function _Chat() {
+
+ } + bordered + title={Locale.Chat.Actions.RefreshTitle} + onClick={() => { + showToast(Locale.Chat.Actions.RefreshToast); + chatStore.summarizeSession(true); + }} + /> +
{!isMobileScreen && (
= SUMMARIZE_MIN_LEN + (config.enableAutoGenerateTitle && + session.topic === DEFAULT_TOPIC && + countMessages(messages) >= SUMMARIZE_MIN_LEN) || + refreshTitle ) { - const topicMessages = messages.concat( - createMessage({ - role: "user", - content: Locale.Store.Prompt.Topic, - }), - ); + const topicMessages = messages + .slice( + messages.length - modelConfig.historyMessageCount, + messages.length, + ) + .concat( + createMessage({ + role: "user", + content: Locale.Store.Prompt.Topic, + }), + ); api.llm.chat({ messages: topicMessages, config: { From 37c0cfe1e9d2568138e820634ad9404c0c5fb21f Mon Sep 17 00:00:00 2001 From: skymkmk Date: Fri, 13 Sep 2024 21:13:19 +0800 Subject: [PATCH 3/7] translation: translations by claude for manual refresh --- app/locales/ar.ts | 2 ++ app/locales/bn.ts | 2 ++ app/locales/cn.ts | 2 ++ app/locales/cs.ts | 2 ++ app/locales/de.ts | 2 ++ app/locales/en.ts | 2 ++ app/locales/es.ts | 2 ++ app/locales/fr.ts | 2 ++ app/locales/id.ts | 2 ++ app/locales/it.ts | 2 ++ app/locales/jp.ts | 2 ++ app/locales/ko.ts | 2 ++ app/locales/no.ts | 2 ++ app/locales/pt.ts | 2 ++ app/locales/ru.ts | 2 ++ app/locales/sk.ts | 2 ++ app/locales/tr.ts | 2 ++ app/locales/tw.ts | 2 ++ app/locales/vi.ts | 2 ++ 19 files changed, 38 insertions(+) diff --git a/app/locales/ar.ts b/app/locales/ar.ts index 9bd491083e4..0c3fef7209f 100644 --- a/app/locales/ar.ts +++ b/app/locales/ar.ts @@ -43,6 +43,8 @@ const ar: PartialLocaleType = { PinToastAction: "عرض", Delete: "حذف", Edit: "تحرير", + RefreshTitle: "تحديث العنوان", + RefreshToast: "تم إرسال طلب تحديث العنوان", }, Commands: { new: "دردشة جديدة", diff --git a/app/locales/bn.ts b/app/locales/bn.ts index acabc8e2ad4..eeb1608e079 100644 --- a/app/locales/bn.ts +++ b/app/locales/bn.ts @@ -43,6 +43,8 @@ const bn: PartialLocaleType = { PinToastAction: "দেখুন", Delete: "মুছে ফেলুন", Edit: "সম্পাদনা করুন", + RefreshTitle: "শিরোনাম রিফ্রেশ করুন", + RefreshToast: "শিরোনাম রিফ্রেশ অনুরোধ পাঠানো হয়েছে", }, Commands: { new: "নতুন চ্যাট", diff --git a/app/locales/cn.ts b/app/locales/cn.ts index 92e81bcb1ba..b5fcdbb8b5f 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -44,6 +44,8 @@ const cn = { Delete: "删除", Edit: "编辑", FullScreen: "全屏", + RefreshTitle: "刷新标题", + RefreshToast: "已发送刷新标题请求", }, Commands: { new: "新建聊天", diff --git a/app/locales/cs.ts b/app/locales/cs.ts index d16c474e824..d0c7f392c34 100644 --- a/app/locales/cs.ts +++ b/app/locales/cs.ts @@ -43,6 +43,8 @@ const cs: PartialLocaleType = { PinToastAction: "Zobrazit", Delete: "Smazat", Edit: "Upravit", + RefreshTitle: "Obnovit název", + RefreshToast: "Požadavek na obnovení názvu byl odeslán", }, Commands: { new: "Nová konverzace", diff --git a/app/locales/de.ts b/app/locales/de.ts index a1f81704726..da2859f0107 100644 --- a/app/locales/de.ts +++ b/app/locales/de.ts @@ -43,6 +43,8 @@ const de: PartialLocaleType = { PinToastAction: "Ansehen", Delete: "Löschen", Edit: "Bearbeiten", + RefreshTitle: "Titel aktualisieren", + RefreshToast: "Anfrage zur Titelaktualisierung gesendet", }, Commands: { new: "Neues Gespräch", diff --git a/app/locales/en.ts b/app/locales/en.ts index 09b76f1fa12..0a2fcc275f0 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -45,6 +45,8 @@ const en: LocaleType = { Delete: "Delete", Edit: "Edit", FullScreen: "FullScreen", + RefreshTitle: "Refresh Title", + RefreshToast: "Title refresh request sent", }, Commands: { new: "Start a new chat", diff --git a/app/locales/es.ts b/app/locales/es.ts index 5e4f900b70f..6f2344c2c65 100644 --- a/app/locales/es.ts +++ b/app/locales/es.ts @@ -44,6 +44,8 @@ const es: PartialLocaleType = { PinToastAction: "Ver", Delete: "Eliminar", Edit: "Editar", + RefreshTitle: "Actualizar título", + RefreshToast: "Se ha enviado la solicitud de actualización del título", }, Commands: { new: "Nueva conversación", diff --git a/app/locales/fr.ts b/app/locales/fr.ts index 65efc32b8d6..5a2a86ad9f6 100644 --- a/app/locales/fr.ts +++ b/app/locales/fr.ts @@ -43,6 +43,8 @@ const fr: PartialLocaleType = { PinToastAction: "Voir", Delete: "Supprimer", Edit: "Modifier", + RefreshTitle: "Actualiser le titre", + RefreshToast: "Demande d'actualisation du titre envoyée", }, Commands: { new: "Nouvelle discussion", diff --git a/app/locales/id.ts b/app/locales/id.ts index 3ac7af49006..09bf0d09a4a 100644 --- a/app/locales/id.ts +++ b/app/locales/id.ts @@ -43,6 +43,8 @@ const id: PartialLocaleType = { PinToastAction: "Lihat", Delete: "Hapus", Edit: "Edit", + RefreshTitle: "Segarkan Judul", + RefreshToast: "Permintaan penyegaran judul telah dikirim", }, Commands: { new: "Obrolan Baru", diff --git a/app/locales/it.ts b/app/locales/it.ts index 1a54cfa43ed..67983a8dba3 100644 --- a/app/locales/it.ts +++ b/app/locales/it.ts @@ -43,6 +43,8 @@ const it: PartialLocaleType = { PinToastAction: "Visualizza", Delete: "Elimina", Edit: "Modifica", + RefreshTitle: "Aggiorna titolo", + RefreshToast: "Richiesta di aggiornamento del titolo inviata", }, Commands: { new: "Nuova chat", diff --git a/app/locales/jp.ts b/app/locales/jp.ts index 6aaf0ba6737..efb080a2052 100644 --- a/app/locales/jp.ts +++ b/app/locales/jp.ts @@ -43,6 +43,8 @@ const jp: PartialLocaleType = { PinToastAction: "見る", Delete: "削除", Edit: "編集", + RefreshTitle: "タイトルを更新", + RefreshToast: "タイトル更新リクエストが送信されました", }, Commands: { new: "新しいチャット", diff --git a/app/locales/ko.ts b/app/locales/ko.ts index 563827fb966..827c5fc0a3f 100644 --- a/app/locales/ko.ts +++ b/app/locales/ko.ts @@ -43,6 +43,8 @@ const ko: PartialLocaleType = { PinToastAction: "보기", Delete: "삭제", Edit: "편집", + RefreshTitle: "제목 새로고침", + RefreshToast: "제목 새로고침 요청이 전송되었습니다", }, Commands: { new: "새 채팅", diff --git a/app/locales/no.ts b/app/locales/no.ts index d7dc16b3fe1..0fe2ad456af 100644 --- a/app/locales/no.ts +++ b/app/locales/no.ts @@ -44,6 +44,8 @@ const no: PartialLocaleType = { PinToastAction: "Se", Delete: "Slett", Edit: "Rediger", + RefreshTitle: "Oppdater tittel", + RefreshToast: "Forespørsel om titteloppdatering sendt", }, Commands: { new: "Ny samtale", diff --git a/app/locales/pt.ts b/app/locales/pt.ts index 9fd13ba1cba..03610ecce84 100644 --- a/app/locales/pt.ts +++ b/app/locales/pt.ts @@ -43,6 +43,8 @@ const pt: PartialLocaleType = { PinToastAction: "Visualizar", Delete: "Deletar", Edit: "Editar", + RefreshTitle: "Atualizar Título", + RefreshToast: "Solicitação de atualização de título enviada", }, Commands: { new: "Iniciar um novo chat", diff --git a/app/locales/ru.ts b/app/locales/ru.ts index e983dcddbda..f4d76f810e5 100644 --- a/app/locales/ru.ts +++ b/app/locales/ru.ts @@ -43,6 +43,8 @@ const ru: PartialLocaleType = { PinToastAction: "Просмотреть", Delete: "Удалить", Edit: "Редактировать", + RefreshTitle: "Обновить заголовок", + RefreshToast: "Запрос на обновление заголовка отправлен", }, Commands: { new: "Новый чат", diff --git a/app/locales/sk.ts b/app/locales/sk.ts index 2586aaaa7b4..61ea18b7822 100644 --- a/app/locales/sk.ts +++ b/app/locales/sk.ts @@ -45,6 +45,8 @@ const sk: PartialLocaleType = { PinToastAction: "Zobraziť", Delete: "Vymazať", Edit: "Upraviť", + RefreshTitle: "Obnoviť názov", + RefreshToast: "Požiadavka na obnovenie názvu bola odoslaná", }, Commands: { new: "Začať nový chat", diff --git a/app/locales/tr.ts b/app/locales/tr.ts index ac410615e74..6fccdda5e42 100644 --- a/app/locales/tr.ts +++ b/app/locales/tr.ts @@ -43,6 +43,8 @@ const tr: PartialLocaleType = { PinToastAction: "Görünüm", Delete: "Sil", Edit: "Düzenle", + RefreshTitle: "Başlığı Yenile", + RefreshToast: "Başlık yenileme isteği gönderildi", }, Commands: { new: "Yeni sohbet", diff --git a/app/locales/tw.ts b/app/locales/tw.ts index c54a7b8c5ae..a080b000c16 100644 --- a/app/locales/tw.ts +++ b/app/locales/tw.ts @@ -43,6 +43,8 @@ const tw = { PinToastAction: "檢視", Delete: "刪除", Edit: "編輯", + RefreshTitle: "刷新標題", + RefreshToast: "已發送刷新標題請求", }, Commands: { new: "新建聊天", diff --git a/app/locales/vi.ts b/app/locales/vi.ts index 9a21ee406f8..00934b3a67a 100644 --- a/app/locales/vi.ts +++ b/app/locales/vi.ts @@ -43,6 +43,8 @@ const vi: PartialLocaleType = { PinToastAction: "Xem", Delete: "Xóa", Edit: "Chỉnh sửa", + RefreshTitle: "Làm mới tiêu đề", + RefreshToast: "Đã gửi yêu cầu làm mới tiêu đề", }, Commands: { new: "Tạo cuộc trò chuyện mới", From 93bc2f5870976a17ce9deacd29816022f5036c52 Mon Sep 17 00:00:00 2001 From: skymkmk Date: Fri, 13 Sep 2024 20:30:12 +0800 Subject: [PATCH 4/7] feat: now user can choose their own summarize model --- app/components/model-config.tsx | 25 +++++++++++ app/store/chat.ts | 73 +++++++++++++-------------------- app/store/config.ts | 13 +++++- 3 files changed, 65 insertions(+), 46 deletions(-) diff --git a/app/components/model-config.tsx b/app/components/model-config.tsx index 6ce25f6642c..948c9fb2921 100644 --- a/app/components/model-config.tsx +++ b/app/components/model-config.tsx @@ -12,6 +12,7 @@ export function ModelConfigList(props: { }) { const allModels = useAllModels(); const value = `${props.modelConfig.model}@${props.modelConfig?.providerName}`; + const compressModelValue = `${props.modelConfig.compressModel}@${props.modelConfig?.compressProviderName}`; return ( <> @@ -228,6 +229,30 @@ export function ModelConfigList(props: { } > + + + ); } diff --git a/app/store/chat.ts b/app/store/chat.ts index 58c105e7ef7..4332c2246ad 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -1,33 +1,29 @@ -import { trimTopic, getMessageTextContent } from "../utils"; +import { getMessageTextContent, trimTopic } from "../utils"; -import Locale, { getLang } from "../locales"; +import { indexedDBStorage } from "@/app/utils/indexedDB-storage"; +import { nanoid } from "nanoid"; +import type { + ClientApi, + MultimodalContent, + RequestMessage, +} from "../client/api"; +import { getClientApi } from "../client/api"; +import { ChatControllerPool } from "../client/controller"; import { showToast } from "../components/ui-lib"; -import { ModelConfig, ModelType, useAppConfig } from "./config"; -import { createEmptyMask, Mask } from "./mask"; import { DEFAULT_INPUT_TEMPLATE, DEFAULT_MODELS, DEFAULT_SYSTEM_TEMPLATE, KnowledgeCutOffDate, StoreKey, - SUMMARIZE_MODEL, - GEMINI_SUMMARIZE_MODEL, } from "../constant"; -import { getClientApi } from "../client/api"; -import type { - ClientApi, - RequestMessage, - MultimodalContent, -} from "../client/api"; -import { ChatControllerPool } from "../client/controller"; +import Locale, { getLang } from "../locales"; +import { isDalle3, safeLocalStorage } from "../utils"; import { prettyObject } from "../utils/format"; -import { estimateTokenLength } from "../utils/token"; -import { nanoid } from "nanoid"; import { createPersistStore } from "../utils/store"; -import { collectModelsWithDefaultModel } from "../utils/model"; -import { useAccessStore } from "./access"; -import { isDalle3, safeLocalStorage } from "../utils"; -import { indexedDBStorage } from "@/app/utils/indexedDB-storage"; +import { estimateTokenLength } from "../utils/token"; +import { ModelConfig, ModelType, useAppConfig } from "./config"; +import { createEmptyMask, Mask } from "./mask"; const localStorage = safeLocalStorage(); @@ -106,27 +102,6 @@ function createEmptySession(): ChatSession { }; } -function getSummarizeModel(currentModel: string) { - // if it is using gpt-* models, force to use 4o-mini to summarize - if (currentModel.startsWith("gpt") || currentModel.startsWith("chatgpt")) { - const configStore = useAppConfig.getState(); - const accessStore = useAccessStore.getState(); - const allModel = collectModelsWithDefaultModel( - configStore.models, - [configStore.customModels, accessStore.customModels].join(","), - accessStore.defaultModel, - ); - const summarizeModel = allModel.find( - (m) => m.name === SUMMARIZE_MODEL && m.available, - ); - return summarizeModel?.name ?? currentModel; - } - if (currentModel.startsWith("gemini")) { - return GEMINI_SUMMARIZE_MODEL; - } - return currentModel; -} - function countMessages(msgs: ChatMessage[]) { return msgs.reduce( (pre, cur) => pre + estimateTokenLength(getMessageTextContent(cur)), @@ -581,7 +556,7 @@ export const useChatStore = createPersistStore( return; } - const providerName = modelConfig.providerName; + const providerName = modelConfig.compressProviderName; const api: ClientApi = getClientApi(providerName); // remove error messages if any @@ -603,7 +578,7 @@ export const useChatStore = createPersistStore( api.llm.chat({ messages: topicMessages, config: { - model: getSummarizeModel(session.mask.modelConfig.model), + model: modelConfig.compressModel, stream: false, providerName, }, @@ -666,7 +641,7 @@ export const useChatStore = createPersistStore( config: { ...modelcfg, stream: true, - model: getSummarizeModel(session.mask.modelConfig.model), + model: modelConfig.compressModel, }, onUpdate(message) { session.memoryPrompt = message; @@ -715,7 +690,7 @@ export const useChatStore = createPersistStore( }, { name: StoreKey.Chat, - version: 3.1, + version: 3.2, migrate(persistedState, version) { const state = persistedState as any; const newState = JSON.parse( @@ -762,6 +737,16 @@ export const useChatStore = createPersistStore( }); } + // add default summarize model for every session + if (version < 3.2) { + newState.sessions.forEach((s) => { + const config = useAppConfig.getState(); + s.mask.modelConfig.compressModel = config.modelConfig.compressModel; + s.mask.modelConfig.compressProviderName = + config.modelConfig.compressProviderName; + }); + } + return newState as any; }, }, diff --git a/app/store/config.ts b/app/store/config.ts index e8e3c9863ef..9985b9e768c 100644 --- a/app/store/config.ts +++ b/app/store/config.ts @@ -50,7 +50,7 @@ export const DEFAULT_CONFIG = { models: DEFAULT_MODELS as any as LLMModel[], modelConfig: { - model: "gpt-3.5-turbo" as ModelType, + model: "gpt-4o-mini" as ModelType, providerName: "OpenAI" as ServiceProvider, temperature: 0.5, top_p: 1, @@ -60,6 +60,8 @@ export const DEFAULT_CONFIG = { sendMemory: true, historyMessageCount: 4, compressMessageLengthThreshold: 1000, + compressModel: "gpt-4o-mini" as ModelType, + compressProviderName: "OpenAI" as ServiceProvider, enableInjectSystemPrompts: true, template: config?.template ?? DEFAULT_INPUT_TEMPLATE, size: "1024x1024" as DalleSize, @@ -140,7 +142,7 @@ export const useAppConfig = createPersistStore( }), { name: StoreKey.Config, - version: 3.9, + version: 4, migrate(persistedState, version) { const state = persistedState as ChatConfig; @@ -178,6 +180,13 @@ export const useAppConfig = createPersistStore( : config?.template ?? DEFAULT_INPUT_TEMPLATE; } + if (version < 4) { + state.modelConfig.compressModel = + DEFAULT_CONFIG.modelConfig.compressModel; + state.modelConfig.compressProviderName = + DEFAULT_CONFIG.modelConfig.compressProviderName; + } + return state as any; }, }, From 1b869d930593060d416f565a4570ab3afdcda932 Mon Sep 17 00:00:00 2001 From: skymkmk Date: Fri, 13 Sep 2024 21:13:19 +0800 Subject: [PATCH 5/7] translation: translations by claude for new writings --- app/locales/ar.ts | 4 ++++ app/locales/bn.ts | 4 ++++ app/locales/cn.ts | 4 ++++ app/locales/cs.ts | 4 ++++ app/locales/de.ts | 4 ++++ app/locales/en.ts | 4 ++++ app/locales/es.ts | 4 ++++ app/locales/fr.ts | 4 ++++ app/locales/id.ts | 4 ++++ app/locales/it.ts | 4 ++++ app/locales/jp.ts | 4 ++++ app/locales/ko.ts | 4 ++++ app/locales/no.ts | 4 ++++ app/locales/pt.ts | 4 ++++ app/locales/ru.ts | 4 ++++ app/locales/sk.ts | 4 ++++ app/locales/tr.ts | 4 ++++ app/locales/tw.ts | 4 ++++ app/locales/vi.ts | 4 ++++ 19 files changed, 76 insertions(+) diff --git a/app/locales/ar.ts b/app/locales/ar.ts index 9bd491083e4..fef12304796 100644 --- a/app/locales/ar.ts +++ b/app/locales/ar.ts @@ -404,6 +404,10 @@ const ar: PartialLocaleType = { }, Model: "النموذج", + CompressModel: { + Title: "نموذج الضغط", + SubTitle: "النموذج المستخدم لضغط السجل التاريخي", + }, Temperature: { Title: "العشوائية (temperature)", SubTitle: "كلما زادت القيمة، زادت العشوائية في الردود", diff --git a/app/locales/bn.ts b/app/locales/bn.ts index acabc8e2ad4..ea66ce646b2 100644 --- a/app/locales/bn.ts +++ b/app/locales/bn.ts @@ -411,6 +411,10 @@ const bn: PartialLocaleType = { }, Model: "মডেল (model)", + CompressModel: { + Title: "সংকোচন মডেল", + SubTitle: "ইতিহাস সংকুচিত করার জন্য ব্যবহৃত মডেল", + }, Temperature: { Title: "যাদুকরিতা (temperature)", SubTitle: "মান বাড়ালে উত্তর বেশি এলোমেলো হবে", diff --git a/app/locales/cn.ts b/app/locales/cn.ts index 92e81bcb1ba..068429585bc 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -470,6 +470,10 @@ const cn = { }, Model: "模型 (model)", + CompressModel: { + Title: "压缩模型", + SubTitle: "用于压缩历史记录的模型", + }, Temperature: { Title: "随机性 (temperature)", SubTitle: "值越大,回复越随机", diff --git a/app/locales/cs.ts b/app/locales/cs.ts index d16c474e824..a23367472c5 100644 --- a/app/locales/cs.ts +++ b/app/locales/cs.ts @@ -410,6 +410,10 @@ const cs: PartialLocaleType = { }, Model: "Model (model)", + CompressModel: { + Title: "Kompresní model", + SubTitle: "Model používaný pro kompresi historie", + }, Temperature: { Title: "Náhodnost (temperature)", SubTitle: "Čím vyšší hodnota, tím náhodnější odpovědi", diff --git a/app/locales/de.ts b/app/locales/de.ts index a1f81704726..56e78738183 100644 --- a/app/locales/de.ts +++ b/app/locales/de.ts @@ -421,6 +421,10 @@ const de: PartialLocaleType = { }, Model: "Modell", + CompressModel: { + Title: "Kompressionsmodell", + SubTitle: "Modell zur Komprimierung des Verlaufs", + }, Temperature: { Title: "Zufälligkeit (temperature)", SubTitle: "Je höher der Wert, desto zufälliger die Antwort", diff --git a/app/locales/en.ts b/app/locales/en.ts index 09b76f1fa12..41337ac2f8a 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -474,6 +474,10 @@ const en: LocaleType = { }, Model: "Model", + CompressModel: { + Title: "Compression Model", + SubTitle: "Model used to compress history", + }, Temperature: { Title: "Temperature", SubTitle: "A larger value makes the more random output", diff --git a/app/locales/es.ts b/app/locales/es.ts index 5e4f900b70f..8fa42b6599d 100644 --- a/app/locales/es.ts +++ b/app/locales/es.ts @@ -423,6 +423,10 @@ const es: PartialLocaleType = { }, Model: "Modelo (model)", + CompressModel: { + Title: "Modelo de compresión", + SubTitle: "Modelo utilizado para comprimir el historial", + }, Temperature: { Title: "Aleatoriedad (temperature)", SubTitle: "Cuanto mayor sea el valor, más aleatorio será el resultado", diff --git a/app/locales/fr.ts b/app/locales/fr.ts index 65efc32b8d6..198fdddd4b3 100644 --- a/app/locales/fr.ts +++ b/app/locales/fr.ts @@ -422,6 +422,10 @@ const fr: PartialLocaleType = { }, Model: "Modèle", + CompressModel: { + Title: "Modèle de compression", + SubTitle: "Modèle utilisé pour compresser l'historique", + }, Temperature: { Title: "Aléatoire (temperature)", SubTitle: "Plus la valeur est élevée, plus les réponses sont aléatoires", diff --git a/app/locales/id.ts b/app/locales/id.ts index 3ac7af49006..61530a77579 100644 --- a/app/locales/id.ts +++ b/app/locales/id.ts @@ -411,6 +411,10 @@ const id: PartialLocaleType = { }, Model: "Model", + CompressModel: { + Title: "Model Kompresi", + SubTitle: "Model yang digunakan untuk mengompres riwayat", + }, Temperature: { Title: "Randomness (temperature)", SubTitle: "Semakin tinggi nilainya, semakin acak responsnya", diff --git a/app/locales/it.ts b/app/locales/it.ts index 1a54cfa43ed..57d9d0f1541 100644 --- a/app/locales/it.ts +++ b/app/locales/it.ts @@ -423,6 +423,10 @@ const it: PartialLocaleType = { }, Model: "Modello (model)", + CompressModel: { + Title: "Modello di compressione", + SubTitle: "Modello utilizzato per comprimere la cronologia", + }, Temperature: { Title: "Casualità (temperature)", SubTitle: "Valore più alto, risposte più casuali", diff --git a/app/locales/jp.ts b/app/locales/jp.ts index 6aaf0ba6737..b09489d9fc5 100644 --- a/app/locales/jp.ts +++ b/app/locales/jp.ts @@ -407,6 +407,10 @@ const jp: PartialLocaleType = { }, Model: "モデル (model)", + CompressModel: { + Title: "圧縮モデル", + SubTitle: "履歴を圧縮するために使用されるモデル", + }, Temperature: { Title: "ランダム性 (temperature)", SubTitle: "値が大きいほど応答がランダムになります", diff --git a/app/locales/ko.ts b/app/locales/ko.ts index 563827fb966..973927ed5d7 100644 --- a/app/locales/ko.ts +++ b/app/locales/ko.ts @@ -404,6 +404,10 @@ const ko: PartialLocaleType = { }, Model: "모델 (model)", + CompressModel: { + Title: "압축 모델", + SubTitle: "기록을 압축하는 데 사용되는 모델", + }, Temperature: { Title: "무작위성 (temperature)", SubTitle: "값이 클수록 응답이 더 무작위적", diff --git a/app/locales/no.ts b/app/locales/no.ts index d7dc16b3fe1..490d2bfda7f 100644 --- a/app/locales/no.ts +++ b/app/locales/no.ts @@ -415,6 +415,10 @@ const no: PartialLocaleType = { }, Model: "Modell", + CompressModel: { + Title: "Komprimeringsmodell", + SubTitle: "Modell brukt for å komprimere historikken", + }, Temperature: { Title: "Tilfeldighet (temperature)", SubTitle: "Høyere verdi gir mer tilfeldige svar", diff --git a/app/locales/pt.ts b/app/locales/pt.ts index 9fd13ba1cba..5dadc8e3a65 100644 --- a/app/locales/pt.ts +++ b/app/locales/pt.ts @@ -346,6 +346,10 @@ const pt: PartialLocaleType = { }, Model: "Modelo", + CompressModel: { + Title: "Modelo de Compressão", + SubTitle: "Modelo usado para comprimir o histórico", + }, Temperature: { Title: "Temperatura", SubTitle: "Um valor maior torna a saída mais aleatória", diff --git a/app/locales/ru.ts b/app/locales/ru.ts index e983dcddbda..4c583618bdd 100644 --- a/app/locales/ru.ts +++ b/app/locales/ru.ts @@ -414,6 +414,10 @@ const ru: PartialLocaleType = { }, Model: "Модель", + CompressModel: { + Title: "Модель сжатия", + SubTitle: "Модель, используемая для сжатия истории", + }, Temperature: { Title: "Случайность (temperature)", SubTitle: "Чем больше значение, тем более случайные ответы", diff --git a/app/locales/sk.ts b/app/locales/sk.ts index 2586aaaa7b4..4b4085f4dd5 100644 --- a/app/locales/sk.ts +++ b/app/locales/sk.ts @@ -365,6 +365,10 @@ const sk: PartialLocaleType = { }, Model: "Model", + CompressModel: { + Title: "Kompresný model", + SubTitle: "Model používaný na kompresiu histórie", + }, Temperature: { Title: "Teplota", SubTitle: "Vyššia hodnota robí výstup náhodnejším", diff --git a/app/locales/tr.ts b/app/locales/tr.ts index ac410615e74..edb4572bf1d 100644 --- a/app/locales/tr.ts +++ b/app/locales/tr.ts @@ -414,6 +414,10 @@ const tr: PartialLocaleType = { }, Model: "Model (model)", + CompressModel: { + Title: "Sıkıştırma Modeli", + SubTitle: "Geçmişi sıkıştırmak için kullanılan model", + }, Temperature: { Title: "Rastgelelik (temperature)", SubTitle: "Değer arttıkça yanıt daha rastgele olur", diff --git a/app/locales/tw.ts b/app/locales/tw.ts index c54a7b8c5ae..88b86772cf9 100644 --- a/app/locales/tw.ts +++ b/app/locales/tw.ts @@ -368,6 +368,10 @@ const tw = { }, Model: "模型 (model)", + CompressModel: { + Title: "壓縮模型", + SubTitle: "用於壓縮歷史記錄的模型", + }, Temperature: { Title: "隨機性 (temperature)", SubTitle: "值越大,回應越隨機", diff --git a/app/locales/vi.ts b/app/locales/vi.ts index 9a21ee406f8..3b0456d1c49 100644 --- a/app/locales/vi.ts +++ b/app/locales/vi.ts @@ -410,6 +410,10 @@ const vi: PartialLocaleType = { }, Model: "Mô hình (model)", + CompressModel: { + Title: "Mô hình nén", + SubTitle: "Mô hình được sử dụng để nén lịch sử", + }, Temperature: { Title: "Độ ngẫu nhiên (temperature)", SubTitle: "Giá trị càng lớn, câu trả lời càng ngẫu nhiên", From fa48ace39badb237728188482550ae5bb8f0e47a Mon Sep 17 00:00:00 2001 From: skymkmk Date: Sat, 14 Sep 2024 07:49:26 +0800 Subject: [PATCH 6/7] fix: prevent users from setting a extremly short history that resulting in no content being sent for the title summary --- app/store/chat.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/store/chat.ts b/app/store/chat.ts index 1609666c331..d2a1fecd619 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -595,9 +595,13 @@ export const useChatStore = createPersistStore( countMessages(messages) >= SUMMARIZE_MIN_LEN) || refreshTitle ) { + const startIndex = Math.max( + 0, + messages.length - modelConfig.historyMessageCount, + ); const topicMessages = messages .slice( - messages.length - modelConfig.historyMessageCount, + startIndex < messages.length ? startIndex : messages.length - 1, messages.length, ) .concat( From 84a7afcd948743fa8c69b712d812ad6fbd73c5db Mon Sep 17 00:00:00 2001 From: evenwan Date: Sat, 14 Sep 2024 09:31:05 +0800 Subject: [PATCH 7/7] feat: Improve setting.model selector --- app/components/model-config.tsx | 22 +++++++++++++++------- app/components/ui-lib.module.scss | 6 ++++++ app/components/ui-lib.tsx | 12 +++++++++--- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/app/components/model-config.tsx b/app/components/model-config.tsx index 6ce25f6642c..6c40ab1b265 100644 --- a/app/components/model-config.tsx +++ b/app/components/model-config.tsx @@ -5,12 +5,17 @@ import Locale from "../locales"; import { InputRange } from "./input-range"; import { ListItem, Select } from "./ui-lib"; import { useAllModels } from "../utils/hooks"; +import { groupBy } from "lodash-es"; export function ModelConfigList(props: { modelConfig: ModelConfig; updateConfig: (updater: (config: ModelConfig) => void) => void; }) { const allModels = useAllModels(); + const groupModels = groupBy( + allModels.filter((v) => v.available), + "provider.providerName", + ); const value = `${props.modelConfig.model}@${props.modelConfig?.providerName}`; return ( @@ -19,6 +24,7 @@ export function ModelConfigList(props: { , + React.SelectHTMLAttributes & { + align?: "left" | "center"; + }, HTMLSelectElement >, ) { - const { className, children, ...otherProps } = props; + const { className, children, align, ...otherProps } = props; return ( -
+