|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
import { NButton, NInput, useMessage } from 'naive-ui'
|
|
|
|
|
import { NButton, NInput, NSlider, useMessage } from 'naive-ui'
|
|
|
|
|
import { useSettingStore } from '@/store'
|
|
|
|
|
import type { SettingsState } from '@/store/modules/settings/helper'
|
|
|
|
|
import { t } from '@/locales'
|
|
|
|
@ -11,6 +11,10 @@ const ms = useMessage()
|
|
|
|
|
|
|
|
|
|
const systemMessage = ref(settingStore.systemMessage ?? '')
|
|
|
|
|
|
|
|
|
|
const temperature = ref(settingStore.temperature ?? 0.5)
|
|
|
|
|
|
|
|
|
|
const top_p = ref(settingStore.top_p ?? 1)
|
|
|
|
|
|
|
|
|
|
function updateSettings(options: Partial<SettingsState>) {
|
|
|
|
|
settingStore.updateSetting(options)
|
|
|
|
|
ms.success(t('common.success'))
|
|
|
|
@ -27,7 +31,7 @@ function handleReset() {
|
|
|
|
|
<div class="p-4 space-y-5 min-h-[200px]">
|
|
|
|
|
<div class="space-y-6">
|
|
|
|
|
<div class="flex items-center space-x-4">
|
|
|
|
|
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.role') }}</span>
|
|
|
|
|
<span class="flex-shrink-0 w-[120px]">{{ $t('setting.role') }}</span>
|
|
|
|
|
<div class="flex-1">
|
|
|
|
|
<NInput v-model:value="systemMessage" type="textarea" :autosize="{ minRows: 1, maxRows: 4 }" />
|
|
|
|
|
</div>
|
|
|
|
@ -36,7 +40,27 @@ function handleReset() {
|
|
|
|
|
</NButton>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex items-center space-x-4">
|
|
|
|
|
<span class="flex-shrink-0 w-[100px]"> </span>
|
|
|
|
|
<span class="flex-shrink-0 w-[120px]">{{ $t('setting.temperature') }} </span>
|
|
|
|
|
<div class="flex-1">
|
|
|
|
|
<NSlider v-model:value="temperature" :max="1" :min="0" :step="0.1" />
|
|
|
|
|
</div>
|
|
|
|
|
<span>{{ temperature }}</span>
|
|
|
|
|
<NButton size="tiny" text type="primary" @click="updateSettings({ temperature })">
|
|
|
|
|
{{ $t('common.save') }}
|
|
|
|
|
</NButton>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex items-center space-x-4">
|
|
|
|
|
<span class="flex-shrink-0 w-[120px]">{{ $t('setting.top_p') }} </span>
|
|
|
|
|
<div class="flex-1">
|
|
|
|
|
<NSlider v-model:value="top_p" :max="1" :min="0" :step="0.1" />
|
|
|
|
|
</div>
|
|
|
|
|
<span>{{ top_p }}</span>
|
|
|
|
|
<NButton size="tiny" text type="primary" @click="updateSettings({ top_p })">
|
|
|
|
|
{{ $t('common.save') }}
|
|
|
|
|
</NButton>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex items-center space-x-4">
|
|
|
|
|
<span class="flex-shrink-0 w-[120px]"> </span>
|
|
|
|
|
<NButton size="small" @click="handleReset">
|
|
|
|
|
{{ $t('common.reset') }}
|
|
|
|
|
</NButton>
|
|
|
|
|