Skip to content

Fix max tokens setting #616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Glob API URL
VITE_GLOB_API_URL=/api

#VITE_APP_API_BASE_URL=http://127.0.0.1:3002
# VITE_APP_API_BASE_URL=http://127.0.0.1:3002
VITE_APP_API_BASE_URL=http://192.168.31.186:3002

# Whether long replies are supported, which may result in higher API fees
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ export default {
"historyToken": "More context improves accuracy but consumes more credits",
"historyTCnt": "Reply Count",
"historyTCntInfo": "Higher reply count may consume more credits",
"modelMaxTokens": "Max supported tokens",
"modelMaxTokensInfo": "The maximum amount supported by the model",
"role": "Role Setting",
"rolePlaceholder": "Set an exclusive role for your conversation (optional)",
"loading2": "Loading...",
Expand Down
2 changes: 2 additions & 0 deletions src/locales/fr-FR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ export default {
"historyToken": "Plus de contexte améliore la précision mais consomme plus de crédits",
"historyTCnt": "Nombre de Réponses",
"historyTCntInfo": "Un nombre plus élevé de réponses peut consommer plus de crédits",
"modelMaxTokens": "Le montant maximum pris en charge par le modèle",
"modelMaxTokensInfo": "Le montant maximum pris en charge par le modèle",
"role": "Paramètre de Rôle",
"rolePlaceholder": "Définissez un rôle exclusif pour votre conversation (facultatif)",
"loading2": "Chargement...",
Expand Down
2 changes: 2 additions & 0 deletions src/locales/ko-KR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ export default {
,"historyToken": "더 많은 컨텍스트는 기억을 더 정확하게 만들지만 더 많은 크레딧을 소비할 수 있습니다."
,"historyTCnt": "답장 수"
,"historyTCntInfo": "답장 수가 많을수록 더 많은 크레딧이 소비될 수 있습니다."
,"modelMaxTokens": "모델이 지원하는 최대 한도"
,"modelMaxTokensInfo": "모델이 지원하는 최대 한도"
,"role": "역할 설정"
,"rolePlaceholder": "대화에 고유한 역할을 설정하십시오. 필수는 아닙니다."
,"loading2": "로딩 중..."
Expand Down
2 changes: 2 additions & 0 deletions src/locales/ru-RU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ export default {
"historyToken": "Больше контекста делает память точнее, но расходует больше квоты",
"historyTCnt": "Количество ответов",
"historyTCntInfo": "Больше ответов, возможно, потребуется больше квоты",
"modelMaxTokens": "Максимальный лимит, поддерживаемый моделью",
"modelMaxTokensInfo": "Максимальный лимит, поддерживаемый моделью",
"role": "Настройка роли",
"rolePlaceholder": "Дайте своему разговору уникальную роль, необязательно",
"loading2": "Загрузка...",
Expand Down
2 changes: 2 additions & 0 deletions src/locales/tr-TR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ export default {
"historyToken": "Daha fazla bağlam, doğruluğu artırır ancak daha fazla kredi tüketir",
"historyTCnt": "Yanıt Sayısı",
"historyTCntInfo": "Daha yüksek yanıt sayısı daha fazla kredi tüketebilir",
"modelMaxTokens": "Modelin desteklediği maksimum limit",
"modelMaxTokensInfo": "Modelin desteklediği maksimum limit",
"role": "Rol Ayarı",
"rolePlaceholder": "Konuşmanız için özel bir rol ayarlayın (isteğe bağlı)",
"loading2": "Yükleniyor...",
Expand Down
2 changes: 2 additions & 0 deletions src/locales/vi-VN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ export default {
"historyToken": "Số ngữ cảnh nhiều hơn sẽ làm cho bộ nhớ chính xác hơn, nhưng sẽ tiêu tốn nhiều chi phí hơn",
"historyTCnt": "Số câu trả lời",
"historyTCntInfo": "Số câu trả lời càng nhiều, khả năng tiêu tốn chi phí càng cao",
"modelMaxTokens": "Giới hạn tối đa mà mô hình hỗ trợ",
"modelMaxTokensInfo": "Giới hạn tối đa mà mô hình hỗ trợ",
"role": "Đặt vai trò",
"rolePlaceholder": "Đặt một vai trò riêng cho cuộc trò chuyện của bạn, không bắt buộc",
"loading2": "Đang tải...",
Expand Down
2 changes: 2 additions & 0 deletions src/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ export default {
,historyToken:'更多的上下文会使记忆更精确,但会消耗更多的额度'
,historyTCnt:'回复数'
,historyTCntInfo:'(max_tokens)回复数越大 ,越有可能消耗更多的额度'
,modelMaxTokens: '模型支持的最大额度'
,modelMaxTokensInfo: '模型支持的最大额度'
,role:'角色设定'
,rolePlaceholder:'给你的会话设置一个专属的角色,不是必须'
,loading2:'正在加载...'
Expand Down
2 changes: 2 additions & 0 deletions src/locales/zh-TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ export default {
"historyToken": "更多的上下文會使記憶更精確,但會消耗更多的額度",
"historyTCnt": "回復數",
"historyTCntInfo": "回復數越大 ,越有可能消耗更多的額度",
"modelMaxTokens": "模型支持的最大額度",
"modelMaxTokensInfo": "模型支持的最大額度",
"role": "角色設定",
"rolePlaceholder": "給你的會話設置一個專屬的角色,不是必須",
"loading2": "正在加載...",
Expand Down
4 changes: 3 additions & 1 deletion src/store/homeStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export interface gptConfigType{
frequency_penalty?:number
presence_penalty?:number
tts_voice?:string //TTS 人物
model_max_tokens:number // 模型支持最大tokens
}
const getGptInt= ():gptConfigType =>{
let v:gptConfigType=getDefault();
Expand All @@ -73,7 +74,8 @@ let v:gptConfigType={
top_p:1,
presence_penalty:0,
frequency_penalty:0,
tts_voice:"alloy"
tts_voice:"alloy",
model_max_tokens:8192
}
return v ;
}
Expand Down
11 changes: 9 additions & 2 deletions src/views/mj/aiModel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ watch(()=>nGptStore.value.model,(n)=>{
max=4096*2;
}

config.value.maxToken=max/2;
config.value.maxToken=nGptStore.value.model_max_tokens ?? max/2;
if(nGptStore.value.max_tokens> config.value.maxToken ) nGptStore.value.max_tokens= config.value.maxToken;
})

Expand Down Expand Up @@ -183,12 +183,19 @@ const serverSuccess=(s:any)=>{
</div>
</section>
<div class="mb-4 text-[12px] text-gray-300 dark:text-gray-300/20">{{ $t('mjchat.historyToken') }}</div>
<section class="flex justify-between items-center">
<div>{{ $t('mjchat.modelMaxTokens') }}</div>
<div class="w-[80%] max-w-[240px]">
<n-input v-model:value="nGptStore.model_max_tokens" />
</div>
</section>
<div class="mb-4 text-[12px] text-gray-300 dark:text-gray-300/20">{{ $t('mjchat.modelMaxTokensInfo') }}</div>

<section class=" flex justify-between items-center" >
<div> {{ $t('mjchat.historyTCnt') }}
</div>
<div class=" flex justify-end items-center w-[80%] max-w-[240px]">
<div class=" w-[200px]"><n-slider v-model:value="nGptStore.max_tokens" :step="1" :max="config.maxToken" :min="1" /></div>
<div class=" w-[200px]"><n-slider v-model:value="nGptStore.max_tokens" :step="1" :max="nGptStore.model_max_tokens" :min="1" /></div>
<div class="w-[50px] text-right">{{ nGptStore.max_tokens }}</div>
</div>
</section>
Expand Down