Skip to content

Commit

Permalink
✨ feat: Implement settings and configuration functionality
Browse files Browse the repository at this point in the history
This commit introduces new features and modifies existing code to implement
functionality for the settings form. It includes adding new settings, modifying
existing settings, creating setting item groups, and updating files with new
functions, default settings, CSS overrides, and type declarations.

The changes aim to enhance the user experience by allowing users to customize
the application settings according to their preferences.
  • Loading branch information
canisminor1990 committed Jul 18, 2023
1 parent f9a814f commit 496c2d9
Show file tree
Hide file tree
Showing 13 changed files with 359 additions and 64 deletions.
40 changes: 24 additions & 16 deletions locales/en_US/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,60 +20,68 @@
"desc": "When the uncompressed chat history exceeds this value, it will be compressed",
"title": "Chat History Compression Threshold"
},
"enableCompressThreshold": {
"title": "Enable Chat History Compression Threshold"
},
"enableHistoryCount": {
"title": "Enable History Message Count Limit"
},
"historyCount": {
"desc": "Number of chat history messages carried in each request",
"desc": "Number of history messages to include in each request",
"title": "History Message Count"
},
"inputTemplate": {
"desc": "The latest user message will be filled into this template",
"title": "User Input Preprocessing"
},
"maxTokens": {
"desc": "Maximum number of tokens used for each interaction",
"title": "Reply Limit (max_tokens)"
},
"sendKey": {
"title": "Send Key"
},
"title": "Chat Settings"
},
"settingModel": {
"enableMaxTokens": {
"title": "Enable Single Reply Limit"
},
"frequencyPenalty": {
"desc": "The higher the value, the more likely it is to reduce repeated words",
"title": "Frequency Penalty (frequency_penalty)"
"title": "Frequency Penalty"
},
"maxTokens": {
"desc": "Maximum number of tokens used in a single interaction",
"title": "Single Reply Limit"
},
"model": {
"desc": "ChatGPT Model",
"title": "Model"
},
"presencePenalty": {
"desc": "The higher the value, the more likely it is to expand to new topics",
"title": "Topic Freshness (presence_penalty)"
"title": "Topic Freshness"
},
"temperature": {
"desc": "The higher the value, the more random the reply",
"title": "Randomness (temperature)"
"title": "Randomness"
},
"title": "Model Settings",
"topP": {
"desc": "Similar to randomness, but do not change together with randomness",
"title": "Nucleus Sampling (top_p)"
"title": "Top-p Sampling"
}
},
"settingOpenAI": {
"endpoint": {
"desc": "Must include http(s)://, in addition to the default address",
"title": "API Endpoint"
"placeholder": "https://api.openai.com/v1",
"title": "API Proxy Endpoint"
},
"title": "OpenAI Settings",
"token": {
"desc": "Use your own Key to bypass password access restrictions",
"desc": "Use your own OpenAI Key",
"placeholder": "OpenAI API Key",
"title": "API Key"
}
},
"settingSystem": {
"accessCode": {
"desc": "Encryption access has been enabled by the administrator",
"desc": "Encryption access is enabled by the administrator",
"placeholder": "Please enter the access password",
"title": "Access Password"
},
Expand All @@ -91,7 +99,7 @@
"title": "Language Settings"
},
"neutralColor": {
"desc": "Custom grayscale for different color tendencies",
"desc": "Custom grayscale for different color biases",
"title": "Neutral Color"
},
"primaryColor": {
Expand Down
34 changes: 21 additions & 13 deletions locales/zh_CN/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
"desc": "当未压缩的历史消息超过该值时,将进行压缩",
"title": "历史消息长度压缩阈值"
},
"enableCompressThreshold": {
"title": "是否开启历史消息长度压缩阈值"
},
"enableHistoryCount": {
"title": "是否开启携带的历史消息数限制"
},
"historyCount": {
"desc": "每次请求携带的历史消息数",
"title": "附带历史消息数"
Expand All @@ -28,45 +34,47 @@
"desc": "用户最新的一条消息会填充到此模板",
"title": "用户输入预处理"
},
"maxTokens": {
"desc": "单次交互所用的最大 Token 数",
"title": "单次回复限制 (max_tokens)"
},
"sendKey": {
"title": "发送键"
},
"title": "聊天设置"
},
"settingModel": {
"enableMaxTokens": {
"title": "开启单次回复限制"
},
"frequencyPenalty": {
"desc": "值越大,越有可能降低重复字词",
"title": "频率惩罚度 (frequency_penalty)"
"title": "频率惩罚度"
},
"maxTokens": {
"desc": "单次交互所用的最大 Token 数",
"title": "单次回复限制"
},
"model": {
"desc": "ChatGPT 模型",
"title": "模型"
},
"presencePenalty": {
"desc": "值越大,越有可能扩展到新话题",
"title": "话题新鲜度 (presence_penalty)"
"title": "话题新鲜度"
},
"temperature": {
"desc": "值越大,回复越随机",
"title": "随机性 (temperature)"
"title": "随机性"
},
"title": "模型设置",
"topP": {
"desc": "与随机性类似,但不要和随机性一起更改",
"title": "核采样 (top_p)"
"title": "核采样"
}
},
"settingOpenAI": {
"endpoint": {
"desc": "除默认地址外,必须包含 http(s)://",
"title": "接口地址"
"placeholder": "https://api.openai.com/v1",
"title": "接口代理地址"
},
"title": "OpenAI 设置",
"token": {
"desc": "使用自己的 Key 可绕过密码访问限制",
"desc": "使用自己的 OpenAI Key",
"placeholder": "OpenAI API Key",
"title": "API Key"
}
Expand Down
34 changes: 21 additions & 13 deletions src/locales/default/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ export default {
desc: '当未压缩的历史消息超过该值时,将进行压缩',
title: '历史消息长度压缩阈值',
},
enableCompressThreshold: {
title: '是否开启历史消息长度压缩阈值',
},
enableHistoryCount: {
title: '是否开启携带的历史消息数限制',
},
historyCount: {
desc: '每次请求携带的历史消息数',
title: '附带历史消息数',
Expand All @@ -28,45 +34,47 @@ export default {
desc: '用户最新的一条消息会填充到此模板',
title: '用户输入预处理',
},
maxTokens: {
desc: '单次交互所用的最大 Token 数',
title: '单次回复限制 (max_tokens)',
},
sendKey: {
title: '发送键',
},
title: '聊天设置',
},
settingModel: {
enableMaxTokens: {
title: '开启单次回复限制',
},
frequencyPenalty: {
desc: '值越大,越有可能降低重复字词',
title: '频率惩罚度 (frequency_penalty)',
title: '频率惩罚度',
},
maxTokens: {
desc: '单次交互所用的最大 Token 数',
title: '单次回复限制',
},
model: {
desc: 'ChatGPT 模型',
title: '模型',
},
presencePenalty: {
desc: '值越大,越有可能扩展到新话题',
title: '话题新鲜度 (presence_penalty)',
title: '话题新鲜度',
},
temperature: {
desc: '值越大,回复越随机',
title: '随机性 (temperature)',
title: '随机性',
},
title: '模型设置',
topP: {
desc: '与随机性类似,但不要和随机性一起更改',
title: '核采样 (top_p)',
title: '核采样',
},
},
settingOpenAI: {
endpoint: {
desc: '除默认地址外,必须包含 http(s)://',
title: '接口地址',
placeholder: 'https://api.openai.com/v1',
title: '接口代理地址',
},
title: 'OpenAI 设置',
token: {
desc: '使用自己的 Key 可绕过密码访问限制',
desc: '使用自己的 OpenAI Key',
placeholder: 'OpenAI API Key',
title: 'API Key',
},
Expand Down
2 changes: 2 additions & 0 deletions src/locales/resources/en_US.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import common from '../../../locales/en_US/common.json';
import setting from '../../../locales/en_US/setting.json';

const resources = {
common,
setting,
} as const;

export default resources;
Loading

0 comments on commit 496c2d9

Please sign in to comment.