11<script lang="ts" setup>
22import {ref }from ' vue'
3- import {NButton ,NInput ,useMessage }from ' naive-ui'
3+ import {NButton ,NInput ,NSlider , useMessage }from ' naive-ui'
44import {useSettingStore }from ' @/store'
55import type {SettingsState }from ' @/store/modules/settings/helper'
66import {t }from ' @/locales'
@@ -11,6 +11,10 @@ const ms = useMessage()
1111
1212const systemMessage= ref (settingStore .systemMessage ?? ' ' )
1313
14+ const temperature= ref (settingStore .temperature ?? 0.5 )
15+
16+ const top_p= ref (settingStore .top_p ?? 1 )
17+
1418function updateSettings(options : Partial <SettingsState >) {
1519settingStore .updateSetting (options )
1620ms .success (t (' common.success' ))
@@ -27,7 +31,7 @@ function handleReset() {
2731 <div class =" p-4 space-y-5 min-h-[200px]" >
2832 <div class =" space-y-6" >
2933 <div class =" flex items-center space-x-4" >
30- <span class =" flex-shrink-0 w-[100px ]" >{{ $t('setting.role') }}</span >
34+ <span class =" flex-shrink-0 w-[120px ]" >{{ $t('setting.role') }}</span >
3135 <div class =" flex-1" >
3236 <NInput v-model:value =" systemMessage" type =" textarea" :autosize =" { minRows: 1, maxRows: 4 }" />
3337 </div >
@@ -36,7 +40,27 @@ function handleReset() {
3640 </NButton >
3741 </div >
3842 <div class =" flex items-center space-x-4" >
39- <span class =" flex-shrink-0 w-[100px]" >  ; </span >
43+ <span class =" flex-shrink-0 w-[120px]" >{{ $t('setting.temperature') }} </span >
44+ <div class =" flex-1" >
45+ <NSlider v-model:value =" temperature" :max =" 1" :min =" 0" :step =" 0.1" />
46+ </div >
47+ <span >{{ temperature }}</span >
48+ <NButton size =" tiny" text type =" primary" @click =" updateSettings({ temperature })" >
49+ {{ $t('common.save') }}
50+ </NButton >
51+ </div >
52+ <div class =" flex items-center space-x-4" >
53+ <span class =" flex-shrink-0 w-[120px]" >{{ $t('setting.top_p') }} </span >
54+ <div class =" flex-1" >
55+ <NSlider v-model:value =" top_p" :max =" 1" :min =" 0" :step =" 0.1" />
56+ </div >
57+ <span >{{ top_p }}</span >
58+ <NButton size =" tiny" text type =" primary" @click =" updateSettings({ top_p })" >
59+ {{ $t('common.save') }}
60+ </NButton >
61+ </div >
62+ <div class =" flex items-center space-x-4" >
63+ <span class =" flex-shrink-0 w-[120px]" >  ; </span >
4064 <NButton size =" small" @click =" handleReset" >
4165 {{ $t('common.reset') }}
4266 </NButton >