| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <script setup lang="ts">
- import { Plus } from '@element-plus/icons-vue'
- import { ElButton, ElDialog, ElEmpty, ElInput, ElMessage, ElOption, ElPagination, ElSelect, ElTable, ElTableColumn, ElTag } from 'element-plus'
- import { selectGlobalPrompt, updateGlobalPrompt } from '@/api/modules/model'
- import { toast } from 'vue-sonner'
- import LangSelector from '@/components/LangSelector.vue'
- const loading = ref(false)
- const input = ref<string>('')
- const lang = ref<string>('zh_CN')
- async function fetchData() {
- loading.value = true
- const {code, data} = await selectGlobalPrompt({i18nKey: lang.value})
- if(code === 0){
- input.value = data
- }
- loading.value = false
- }
- async function handleSave () {
- const {code, data} = await updateGlobalPrompt({i18nKey: lang.value, text: input.value})
- if(code === 0){
- toast.success('保存成功')
- }
- }
- onMounted(async () => {
- await fetchData()
- })
- </script>
- <template>
- <div class="absolute-container">
- <FaPageHeader title="全局提示词" />
- <FaPageMain class="flex-1 overflow-auto" main-class="flex-1 flex flex-col overflow-auto gap-4">
- <LangSelector v-model="lang"></LangSelector>
- <el-input
- v-model="input"
- style="width: 100%;"
- :autosize="{ minRows: 4, maxRows: 10 }"
- type="textarea"
- placeholder="Please input"
- class="mb-4"
- />
- <ElSpace>
- <ElButton type="primary" @click="handleSave">保存</ElButton>
- </ElSpace>
- </FaPageMain>
- </div>
- </template>
- <style scoped>
- .absolute-container {
- position: absolute;
- display: flex;
- flex-direction: column;
- width: 100%;
- height: 100%;
- }
- </style>
|