Skip to content

Commit

Permalink
Merge pull request #1 from fyl080801/main
Browse files Browse the repository at this point in the history
update
  • Loading branch information
fyl080801 committed Jul 10, 2023
2 parents 7a0b437 + dbda27b commit 2c09f4e
Show file tree
Hide file tree
Showing 21 changed files with 300 additions and 210 deletions.
16 changes: 16 additions & 0 deletions app/components/model-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,22 @@ export function ModelConfigList(props: {
></InputRange>
</ListItem>

<ListItem
title={Locale.Settings.InjectSystemPrompts.Title}
subTitle={Locale.Settings.InjectSystemPrompts.SubTitle}
>
<input
type="checkbox"
checked={props.modelConfig.enableInjectSystemPrompts}
onChange={(e) =>
props.updateConfig(
(config) =>
(config.enableInjectSystemPrompts = e.currentTarget.checked),
)
}
></input>
</ListItem>

<ListItem
title={Locale.Settings.InputTemplate.Title}
subTitle={Locale.Settings.InputTemplate.SubTitle}
Expand Down
5 changes: 5 additions & 0 deletions app/locales/ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ const ar: PartialLocaleType = {
Title: "حجم الخط",
SubTitle: "ضبط حجم الخط لمحتوى الدردشة",
},
InjectSystemPrompts: {
Title: "حقن تلميحات النظام",
SubTitle:
"قم بإضافة تلميحة نظام محاكاة ChatGPT إلى بداية قائمة الرسائل المُطلَبة في كل طلب",
},
InputTemplate: {
Title: "نموذج الإدخال",
SubTitle: "سيتم ملء أحدث رسالة في هذا النموذج",
Expand Down
6 changes: 5 additions & 1 deletion app/locales/bn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ const bn: PartialLocaleType = {
Title: "ফন্ট সাইজ",
SubTitle: "চ্যাট সামগ্রীর ফন্ট সাইজ সংশোধন করুন",
},

InjectSystemPrompts: {
Title: "حقن تلميحات النظام",
SubTitle:
"قم بإضافة تلميحة نظام محاكاة ChatGPT إلى بداية قائمة الرسائل المُطلَبة في كل طلب",
},
InputTemplate: {
Title: "ইনপুট টেমপ্লেট",
SubTitle: "নতুনতম বার্তা এই টেমপ্লেটে পূরণ হবে",
Expand Down
5 changes: 4 additions & 1 deletion app/locales/cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ const cn = {
Title: "字体大小",
SubTitle: "聊天内容的字体大小",
},

InjectSystemPrompts: {
Title: "注入系统级提示信息",
SubTitle: "强制给每次请求的消息列表开头添加一个模拟 ChatGPT 的系统提示",
},
InputTemplate: {
Title: "用户输入预处理",
SubTitle: "用户最新的一条消息会填充到此模板",
Expand Down
5 changes: 5 additions & 0 deletions app/locales/cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ const cs: PartialLocaleType = {
Title: "Velikost písma",
SubTitle: "Nastavení velikosti písma obsahu chatu",
},
InjectSystemPrompts: {
Title: "Vložit systémové prompty",
SubTitle:
"Vynutit přidání simulovaného systémového promptu ChatGPT na začátek seznamu zpráv každého požadavku",
},
Update: {
Version: (x: string) => `Verze: ${x}`,
IsLatest: "Aktuální verze",
Expand Down
5 changes: 5 additions & 0 deletions app/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ const de: PartialLocaleType = {
Title: "Schriftgröße",
SubTitle: "Schriftgröße des Chat-Inhalts anpassen",
},
InjectSystemPrompts: {
Title: "System-Prompts einfügen",
SubTitle:
"Erzwingt das Hinzufügen eines simulierten systemweiten Prompts von ChatGPT am Anfang der Nachrichtenliste bei jeder Anfrage",
},
Update: {
Version: (x: string) => `Version: ${x}`,
IsLatest: "Neueste Version",
Expand Down
6 changes: 5 additions & 1 deletion app/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ const en: LocaleType = {
Title: "Font Size",
SubTitle: "Adjust font size of chat content",
},

InjectSystemPrompts: {
Title: "Inject System Prompts",
SubTitle:
"Forcefully add a simulated ChatGPT system prompt at the beginning of the message list for every request",
},
InputTemplate: {
Title: "Input Template",
SubTitle: "Newest message will be filled to this template",
Expand Down
5 changes: 5 additions & 0 deletions app/locales/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ const es: PartialLocaleType = {
Title: "Tamaño de fuente",
SubTitle: "Ajustar el tamaño de fuente del contenido del chat",
},
InjectSystemPrompts: {
Title: "Inyectar Prompts del Sistema",
SubTitle:
"Agregar forzosamente un prompt de sistema simulado de ChatGPT al comienzo de la lista de mensajes en cada solicitud",
},
Update: {
Version: (x: string) => `Versión: ${x}`,
IsLatest: "Última versión",
Expand Down
5 changes: 5 additions & 0 deletions app/locales/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ const fr: PartialLocaleType = {
Title: "Taille des polices",
SubTitle: "Ajuste la taille de police du contenu de la conversation",
},
InjectSystemPrompts: {
Title: "Injecter des invites système",
SubTitle:
"Ajoute de force une invite système simulée de ChatGPT au début de la liste des messages pour chaque demande",
},
InputTemplate: {
Title: "Template",
SubTitle: "Le message le plus récent sera ajouté à ce template.",
Expand Down
5 changes: 5 additions & 0 deletions app/locales/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ const it: PartialLocaleType = {
Title: "Dimensione carattere",
SubTitle: "Regolare la dimensione dei caratteri del contenuto della chat",
},
InjectSystemPrompts: {
Title: "Inserisci Prompts di Sistema",
SubTitle:
"Aggiungi forzatamente un prompt di sistema simulato di ChatGPT all'inizio della lista dei messaggi per ogni richiesta",
},
Update: {
Version: (x: string) => `Versione: ${x}`,
IsLatest: "Ultima versione",
Expand Down
5 changes: 5 additions & 0 deletions app/locales/jp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ const jp: PartialLocaleType = {
Title: "フォントサイズ",
SubTitle: "チャット内容のフォントサイズ",
},
InjectSystemPrompts: {
Title: "システムプロンプトの挿入",
SubTitle:
"各リクエストのメッセージリストの先頭に、ChatGPTのシステムプロンプトを強制的に追加します",
},
InputTemplate: {
Title: "入力の前処理",
SubTitle: "新規入力がこのテンプレートに埋め込まれます",
Expand Down
5 changes: 5 additions & 0 deletions app/locales/ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ const ko: PartialLocaleType = {
Title: "글꼴 크기",
SubTitle: "채팅 내용의 글꼴 크기 조정",
},
InjectSystemPrompts: {
Title: "시스템 프롬프트 주입",
SubTitle:
"각 요청의 메시지 목록의 시작에 ChatGPT 시스템 프롬프트를 강제로 추가합니다",
},
Update: {
Version: (x: string) => `버전: ${x}`,
IsLatest: "최신 버전",
Expand Down
5 changes: 5 additions & 0 deletions app/locales/no.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ const no: PartialLocaleType = {
Title: "Fontstørrelsen",
SubTitle: "Juster fontstørrelsen for samtaleinnholdet.",
},
InjectSystemPrompts: {
Title: "Sett inn systemprompter",
SubTitle:
"Tving tillegg av en simulert ChatGPT-systemprompt i begynnelsen av meldingslisten for hver forespørsel",
},
Update: {
Version: (x: string) => `Versjon: ${x}`,
IsLatest: "Siste versjon",
Expand Down
5 changes: 5 additions & 0 deletions app/locales/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ const ru: PartialLocaleType = {
Title: "Размер шрифта",
SubTitle: "Настроить размер шрифта контента чата",
},
InjectSystemPrompts: {
Title: "Вставить системные подсказки",
SubTitle:
"Принудительно добавить симулированную системную подсказку ChatGPT в начало списка сообщений для каждого запроса",
},
Update: {
Version: (x: string) => `Версия: ${x}`,
IsLatest: "Последняя версия",
Expand Down
5 changes: 5 additions & 0 deletions app/locales/tr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ const tr: PartialLocaleType = {
Title: "Yazı Boyutu",
SubTitle: "Sohbet içeriğinin yazı boyutunu ayarlayın",
},
InjectSystemPrompts: {
Title: "Sistem İpucu Ekleyin",
SubTitle:
"Her istek için ileti listesinin başına simüle edilmiş bir ChatGPT sistem ipucu ekleyin",
},
Update: {
Version: (x: string) => `Sürüm: ${x}`,
IsLatest: "En son sürüm",
Expand Down
4 changes: 4 additions & 0 deletions app/locales/tw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ const tw: PartialLocaleType = {
Title: "字型大小",
SubTitle: "聊天內容的字型大小",
},
InjectSystemPrompts: {
Title: "注入系統提示",
SubTitle: "強制在每個請求的訊息列表開頭添加一個模擬 ChatGPT 的系統提示",
},
Update: {
Version: (x: string) => `當前版本:${x}`,
IsLatest: "已是最新版本",
Expand Down
5 changes: 5 additions & 0 deletions app/locales/vi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ const vi: PartialLocaleType = {
Title: "Font chữ",
SubTitle: "Thay đổi font chữ của nội dung trò chuyện",
},
InjectSystemPrompts: {
Title: "Tiêm Prompt Hệ thống",
SubTitle:
"Bắt buộc thêm một prompt hệ thống giả lập ChatGPT ở đầu danh sách tin nhắn cho mỗi yêu cầu",
},
Update: {
Version: (x: string) => `Phiên bản: ${x}`,
IsLatest: "Phiên bản mới nhất",
Expand Down
3 changes: 1 addition & 2 deletions app/store/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,7 @@ export const useChatStore = create<ChatStore>()(
const contextPrompts = session.mask.context.slice();

// system prompts, to get close to OpenAI Web ChatGPT
// only will be injected if user does not use a mask or set none context prompts
const shouldInjectSystemPrompts = contextPrompts.length === 0;
const shouldInjectSystemPrompts = modelConfig.enableInjectSystemPrompts;
const systemPrompts = shouldInjectSystemPrompts
? [
createMessage({
Expand Down
7 changes: 6 additions & 1 deletion app/store/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const DEFAULT_CONFIG = {
sendMemory: true,
historyMessageCount: 4,
compressMessageLengthThreshold: 1000,
enableInjectSystemPrompts: true,
template: DEFAULT_INPUT_TEMPLATE,
},
};
Expand Down Expand Up @@ -146,7 +147,7 @@ export const useAppConfig = create<ChatConfigStore>()(
}),
{
name: StoreKey.Config,
version: 3.5,
version: 3.6,
migrate(persistedState, version) {
const state = persistedState as ChatConfig;

Expand All @@ -165,6 +166,10 @@ export const useAppConfig = create<ChatConfigStore>()(
state.customModels = "claude,claude-100k";
}

if (version < 3.6) {
state.modelConfig.enableInjectSystemPrompts = true;
}

return state as any;
},
},
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
"html-to-image": "^1.11.11",
"mermaid": "^10.2.3",
"nanoid": "^4.0.2",
"next": "^13.4.6",
"next": "^13.4.9",
"node-fetch": "^3.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "^8.0.7",
"react-router-dom": "^6.10.0",
"react-router-dom": "^6.14.1",
"rehype-highlight": "^6.0.0",
"rehype-katex": "^6.0.3",
"remark-breaks": "^3.0.2",
Expand All @@ -42,14 +42,14 @@
"zustand": "^4.3.8"
},
"devDependencies": {
"@tauri-apps/cli": "^1.3.1",
"@tauri-apps/cli": "^1.4.0",
"@types/node": "^20.3.3",
"@types/react": "^18.2.12",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.0.11",
"@types/react-katex": "^3.0.0",
"@types/spark-md5": "^3.0.2",
"cross-env": "^7.0.3",
"eslint": "^8.36.0",
"eslint": "^8.44.0",
"eslint-config-next": "13.2.3",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
Expand Down
Loading

0 comments on commit 2c09f4e

Please sign in to comment.