import { defineComponent, ref, reactive, computed, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrRenderStyle, ssrRenderAttr, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual, ssrRenderList, ssrInterpolate, ssrRenderClass, ssrRenderDynamicModel } from 'vue/server-renderer'; import { u as useApi } from './useApi-B7CB0Cnn.mjs'; import { u as useToast } from './useToast-BwtTR9dH.mjs'; import { _ as _export_sfc } from './server.mjs'; import './auth-QFkCoU1C.mjs'; import 'pinia'; import '../nitro/nitro.mjs'; import 'node:http'; import 'node:https'; import 'node:events'; import 'node:buffer'; import 'node:fs'; import 'node:path'; import 'node:crypto'; import 'node:url'; import '../routes/renderer.mjs'; import 'vue-bundle-renderer/runtime'; import 'unhead/server'; import 'devalue'; import 'unhead/utils'; import 'perfect-debounce'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "serviceconfig", __ssrInlineRender: true, setup(__props) { const REGIONS = [ { value: 1, label: "中国" }, { value: 2, label: "美国" }, { value: 3, label: "东亚" }, { value: 4, label: "东南亚" }, { value: 5, label: "南亚" }, { value: 6, label: "中东" }, { value: 7, label: "欧洲" }, { value: 8, label: "俄罗斯" }, { value: 9, label: "非洲" }, { value: 10, label: "南美" }, { value: 11, label: "北美" }, { value: 12, label: "大洋洲" }, { value: 13, label: "巴西" }, { value: 14, label: "印度" } ]; const SCAT = [ { v: 1, label: "STT 语音识别", short: "STT", color: "#0369a1", bg: "#dbeafe" }, { v: 2, label: "TTS 语音合成", short: "TTS", color: "#7c3aed", bg: "#ede9fe" }, { v: 3, label: "MT 机器翻译", short: "MT", color: "#059669", bg: "#dcfce7" }, { v: 4, label: "AST 端到端", short: "AST", color: "#c2410c", bg: "#fff7ed" }, { v: 5, label: "LLM 大语言", short: "LLM", color: "#b45309", bg: "#fef9c3" }, { v: 6, label: "存储 OSS/COS", short: "存储", color: "#475569", bg: "#f1f5f9" } ]; useApi(); useToast(); function scatInfo(v) { return SCAT.find((s) => s.v === v) || { short: "?", color: "#999", bg: "#eee", v: 0, label: "" }; } function parseCats(s) { return (s || "").split(",").map((x) => parseInt(x) || 0).filter((x) => x > 0); } function encCount(s) { return (s.fields || []).filter((f) => f.encrypted).length; } const backendReady = ref(true); const allSvcs = ref([]); const curSvc = ref(null); const curRegion = ref(0); const detailMode = ref("empty"); const editForm = reactive({ id: "", name: "", description: "", enable: false }); const editCats = ref([]); const editFields = ref([]); const overrideFields = ref([]); const regionLoading = ref(false); const curRegionLabel = computed(() => { const r = REGIONS.find((x) => x.value === curRegion.value); return r ? r.label : "区域" + curRegion.value; }); const syncVisible = ref(false); ref(false); const syncDesc = ref(""); const syncScopeNote = ref(""); const syncTargets = ref([]); const syncRegionList = computed(() => REGIONS.filter((r) => r.value !== curRegion.value)); return (_ctx, _push, _parent, _attrs) => { _push(``); if (!backendReady.value) { _push(`
⚠ 「依赖服务配置」的后端接口尚未迁移到当前 console 服务,功能暂不可用。
`); } else { _push(``); } _push(`

依赖服务配置

配置火山引擎、阿里云等第三方服务;字段支持加密存储。默认配置全区域共用,可按区域覆盖字段值。

`); ssrRenderList(allSvcs.value, (s) => { _push(`
${ssrInterpolate(s.name)}${ssrInterpolate(s.enable ? "启用" : "停用")}
`); ssrRenderList(parseCats(s.categories), (v) => { _push(`${ssrInterpolate(scatInfo(v).short)}`); }); _push(``); if (encCount(s)) { _push(`🔒${ssrInterpolate(encCount(s))}`); } else { _push(``); } _push(`
`); }); _push(``); if (!allSvcs.value.length) { _push(`

暂无服务

`); } else { _push(``); } _push(`
`); if (detailMode.value === "empty") { _push(`
⚙️

从左侧选择一个服务开始配置

`); } else if (detailMode.value === "default" && curSvc.value) { _push(`

${ssrInterpolate(curSvc.value.name)}

${ssrInterpolate(curSvc.value.id)}

基本信息

服务类别 (可多选)

`); ssrRenderList(SCAT, (sc) => { _push(``); }); _push(`
自定义字段
`); if (!editFields.value.length) { _push(`

尚无自定义字段,点击下方添加

`); } else { _push(`
`); ssrRenderList(editFields.value, (f, i) => { _push(``); }); _push(`
字段名字段描述加密默认值
`); if (f.encrypted) { _push(`
🔒 加密`); } else { _push(``); } _push(`
`); } _push(`
`); } else if (detailMode.value === "new") { _push(`

新增依赖服务

基本信息

服务类别

`); ssrRenderList(SCAT, (sc) => { _push(``); }); _push(`
自定义字段
`); if (!editFields.value.length) { _push(`

尚无自定义字段,点击下方添加

`); } else { _push(`
`); ssrRenderList(editFields.value, (f, i) => { _push(``); }); _push(`
字段名字段描述加密默认值
`); if (f.encrypted) { _push(`
🔒 加密`); } else { _push(``); } _push(`
`); } _push(`
`); } else if (detailMode.value === "region" && curSvc.value) { _push(``); if (regionLoading.value) { _push(`
加载中...
`); } else { _push(`

${ssrInterpolate(curSvc.value.name)}

${ssrInterpolate(curRegionLabel.value)} 覆盖模式
✦ 当前编辑「${ssrInterpolate(curRegionLabel.value)}」的字段覆盖值。留空的字段将继承默认值。加密字段留空保留已存储密文。
`); ssrRenderList(overrideFields.value, (f, i) => { _push(``); }); _push(`
字段名字段描述状态有效值
${ssrInterpolate(f.key)}${ssrInterpolate(f.description)}`); if (f.is_overridden) { _push(`覆盖`); } else { _push(`继承`); } _push(``); if (f.encrypted) { _push(`
🔒`); } else { _push(``); } _push(`
`); } _push(``); } else { _push(``); } _push(`

同步到其他区域

${ssrInterpolate(syncDesc.value)}

${syncScopeNote.value ?? ""}
选择目标区域
`); ssrRenderList(syncRegionList.value, (r) => { _push(``); }); _push(`

⚠ 已勾选区域中与当前配置相同的字段将被覆盖;加密字段密文一并同步。

`); }; } }); const _sfc_setup = _sfc_main.setup; _sfc_main.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/serviceconfig.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; const serviceconfig = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-97419e3c"]]); export { serviceconfig as default }; //# sourceMappingURL=serviceconfig-BTX37VDF.mjs.map