Skip to content

Commit

Permalink
优化对话设置窗口选项
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Feb 24, 2024
1 parent 5df5842 commit 05b9bf6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
30 changes: 16 additions & 14 deletions web/src/components/common/Setting/Advanced.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { NButton, NInput, NRadioButton, NRadioGroup, NSlider } from 'naive-ui'
import { NButton, NInput, NSelect, NSlider } from 'naive-ui'
import { computed, ref } from 'vue'
import type { ModelConfig } from '@/store'
import { defaultChatSetting } from '@/store'
Expand Down Expand Up @@ -54,6 +54,16 @@ const model = computed(() => {
return null
})
const modelsSelectOptions = computed(() => {
return props.models.map((item) => {
return {
label: item.title.length === 0 ? item.model : item.title,
value: item.model,
disabled: !item.enable,
}
})
})
function ok() {
if (undefined !== props.prompt)
emit('update:prompt', prompt.value ?? '')
Expand All @@ -77,16 +87,8 @@ function handleReset() {
</div> -->
<div class="items-center space-x-4" :class="isMobile ? [] : ['flex']">
<span class="flex-shrink-0 w-[130px]">{{ $t('setting.model') }} </span>
<div class="flex-1 overflow-x-auto overflow-y-hidden" :class="isMobile ? ['!ml-0 mt-1'] : []">
<NRadioGroup v-model:value="setting.model" name="model">
<NRadioButton
v-for="modelItem of models"
:key="modelItem.model"
:value="modelItem.model"
:label="0 === modelItem.title.length ? modelItem.model : modelItem.title"
:disabled="!modelItem.enable || readonly"
/>
</NRadioGroup>
<div class="flex-1" :class="isMobile ? ['!ml-0 mt-2'] : []">
<NSelect v-model:value="setting.model" :options="modelsSelectOptions" />
</div>
</div>
<div v-if="model" class="leading-10 !mt-2">
Expand All @@ -95,10 +97,10 @@ function handleReset() {
<b>提示:</b>{{ model.tips }}
</p>
</div>
<div v-if="undefined !== props.prompt" class="flex items-center space-x-4">
<div v-if="undefined !== props.prompt" class="items-center space-x-4" :class="isMobile ? [] : ['flex']">
<span class="flex-shrink-0 w-[130px]">提示语</span>
<div class="flex-1">
<NInput v-model:value="prompt" type="textarea" :readonly="readonly" />
<div class="flex-1" :class="isMobile ? ['!ml-0 mt-2'] : []">
<NInput v-model:value="prompt" type="textarea" :readonly="readonly" rows="5" />
</div>
</div>
<div class="flex items-center space-x-4">
Expand Down
9 changes: 5 additions & 4 deletions web/src/views/embedding/components/Setting/General.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { computed } from 'vue'
import { NInput, NInputNumber } from 'naive-ui'
import type { EmbeddingChatSetting } from '@/store/modules/embedding'
import { useBasicLayout } from '@/hooks/useBasicLayout'
interface Props {
setting: EmbeddingChatSetting
Expand All @@ -14,7 +15,7 @@ interface Emit {
const props = defineProps<Props>()
const emit = defineEmits<Emit>()
const { isMobile } = useBasicLayout()
const setting = computed({
get() {
return props.setting
Expand Down Expand Up @@ -46,10 +47,10 @@ const setting = computed({
<NInputNumber v-model:value="setting.similarity" min="0" max="1" step="0.1" />
</div>
</div>
<div class="flex items-center space-x-4">
<div class="items-center space-x-4" :class="isMobile ? [] : ['flex']">
<span class="flex-shrink-0 w-[130px]">提示语</span>
<div class="flex-1">
<NInput v-model:value="setting.prompt" type="textarea" />
<div class="flex-1" :class="isMobile ? ['!ml-0 mt-2'] : []">
<NInput v-model:value="setting.prompt" type="textarea" rows="5" />
</div>
</div>
</div>
Expand Down

0 comments on commit 05b9bf6

Please sign in to comment.