d440fb1ae7
CI / docker (push) Has been cancelled
引入用户端对话/生图与管理端 Provider 配置,统一 invoke 编排、Gateway、请求日志与模型管理;前端按设计规范拆分布局,Go module 更名为 github.com/rose_cat707/Atlas;生图长任务 SSE 推送;管理端登录防爆破;协议与服务类型联动;Replicate 模型同步修复;用户端创作台 UI 重构;管理端创作历史替代请求日志。 Co-authored-by: Cursor <cursoragent@cursor.com>
71 lines
2.3 KiB
Vue
71 lines
2.3 KiB
Vue
<script setup lang="ts">
|
|
import { onMounted, reactive, ref } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
import { ElMessage } from 'element-plus'
|
|
import api, { type SettingsData } from '@/api/client'
|
|
import PageHeader from '@/components/PageHeader.vue'
|
|
import AppCard from '@/components/AppCard.vue'
|
|
import { useLocaleStore } from '@/stores/locale'
|
|
|
|
const { t } = useI18n()
|
|
const localeStore = useLocaleStore()
|
|
const loading = ref(true)
|
|
const saving = ref(false)
|
|
const form = reactive<SettingsData>({
|
|
app_name: 'Atlas',
|
|
api_port: '8080',
|
|
admin_password: '',
|
|
auth_enabled: 'true',
|
|
ui_locale: 'zh-CN',
|
|
})
|
|
|
|
onMounted(async () => {
|
|
try {
|
|
const res = await api.get<SettingsData>('/settings')
|
|
Object.assign(form, res.data)
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
})
|
|
|
|
async function save() {
|
|
saving.value = true
|
|
try {
|
|
await api.put('/settings', form)
|
|
if (form.ui_locale === 'zh-CN' || form.ui_locale === 'en') {
|
|
localeStore.setLocale(form.ui_locale)
|
|
}
|
|
ElMessage.success(t('settings.saved'))
|
|
} finally {
|
|
saving.value = false
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div>
|
|
<PageHeader :title="t('settings.title')" :description="t('settings.description')" />
|
|
<AppCard padded :title="t('settings.basic')">
|
|
<el-form v-loading="loading" label-width="140px" class="settings-form">
|
|
<el-form-item :label="t('settings.appName')">
|
|
<el-input v-model="form.app_name" />
|
|
</el-form-item>
|
|
<el-form-item :label="t('settings.authEnabled')">
|
|
<el-switch v-model="form.auth_enabled" active-value="true" inactive-value="false" />
|
|
</el-form-item>
|
|
<el-form-item :label="t('settings.adminPassword')">
|
|
<el-input v-model="form.admin_password" type="password" show-password placeholder="******" />
|
|
</el-form-item>
|
|
<el-form-item :label="t('settings.uiLocale')">
|
|
<el-select v-model="form.ui_locale" style="width: 200px">
|
|
<el-option label="简体中文" value="zh-CN" />
|
|
<el-option label="English" value="en" />
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" :loading="saving" @click="save">{{ t('common.save') }}</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</AppCard>
|
|
</div>
|
|
</template> |