import { defineComponent, ref, reactive, computed, mergeProps, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrRenderStyle, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual, ssrRenderList, ssrRenderAttr, ssrInterpolate, ssrRenderClass, ssrRenderComponent, ssrRenderDynamicModel } from 'vue/server-renderer'; import { _ as _export_sfc } from './server.mjs'; import { u as useApi } from './useApi-DMQewX5_.mjs'; import { u as useToast } from './useToast-CS21XT61.mjs'; 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 'pinia'; import 'perfect-debounce'; import './auth-QFkCoU1C.mjs'; import './useLoading-D4zrSa2m.mjs'; const LANG_OPTIONS = [ { code: "zh-CN", name: "中文(简体)" }, { code: "zh-TW", name: "中文(繁体)" }, { code: "zh-HK", name: "中文(香港)" }, { code: "yue-HK", name: "粤语" }, { code: "en-US", name: "英语(美国)" }, { code: "en-GB", name: "英语(英国)" }, { code: "ja-JP", name: "日语" }, { code: "ko-KR", name: "韩语" }, { code: "id-ID", name: "印尼语" }, { code: "es-ES", name: "西班牙语(西)" }, { code: "es-MX", name: "西班牙语(墨)" }, { code: "pt-BR", name: "葡萄牙语(巴西)" }, { code: "pt-PT", name: "葡萄牙语(葡)" }, { code: "de-DE", name: "德语" }, { code: "fr-FR", name: "法语" }, { code: "it-IT", name: "意大利语" }, { code: "nl-NL", name: "荷兰语" }, { code: "pl-PL", name: "波兰语" }, { code: "ru-RU", name: "俄语" }, { code: "uk-UA", name: "乌克兰语" }, { code: "tr-TR", name: "土耳其语" }, { code: "vi-VN", name: "越南语" }, { code: "th-TH", name: "泰语" }, { code: "ms-MY", name: "马来语" }, { code: "fil-PH", name: "菲律宾语" }, { code: "ar-SA", name: "阿拉伯语" } ]; function langName(code) { const o = LANG_OPTIONS.find((x) => x.code === code); return o ? o.name : code; } const _sfc_main$1 = /* @__PURE__ */ defineComponent({ __name: "LangSelect", __ssrInlineRender: true, props: { modelValue: {}, multiple: { type: Boolean, default: false }, disabled: { type: Boolean, default: false }, options: { default: void 0 } }, emits: ["update:modelValue"], setup(__props, { emit: __emit }) { const props = __props; const opts = computed(() => props.options && props.options.length ? props.options : LANG_OPTIONS); const selected = computed( () => (props.modelValue || "").split(",").map((s) => s.trim()).filter(Boolean) ); function nameOf(code) { return langName(code); } return (_ctx, _push, _parent, _attrs) => { _push(``); if (__props.multiple) { _push(`
`); ssrRenderList(selected.value, (code) => { _push(`${ssrInterpolate(code)}${ssrInterpolate(nameOf(code))}`); }); _push(``); if (!selected.value.length) { _push(`未选择语言`); } else { _push(``); } _push(`
`); if (!__props.disabled) { _push(`
+ 选择语言(已选 ${ssrInterpolate(selected.value.length)})
`); ssrRenderList(opts.value, (o) => { _push(``); }); _push(`
`); } else { _push(``); } _push(``); } else { _push(``); } _push(``); }; } }); const _sfc_setup$1 = _sfc_main$1.setup; _sfc_main$1.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/LangSelect.vue"); return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0; }; const __nuxt_component_0 = /* @__PURE__ */ Object.assign(_export_sfc(_sfc_main$1, [["__scopeId", "data-v-4903af59"]]), { __name: "LangSelect" }); 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: 7, label: "STS 端到端对话", short: "STS", color: "#be185d", bg: "#fce7f3" }, { v: 6, label: "存储 OSS/COS", short: "存储", color: "#475569", bg: "#f1f5f9" } ]; useApi(); useToast(); const scopeApp = ref(""); const scopeApps = ref([]); 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: "", provider: "", description: "", enable: false }); const editType = ref(0); const editFields = ref([]); const selectedTemplateId = ref(""); const wizardStep = ref(1); const overrideFields = ref([]); const extraRegionFields = ref([]); const regionLoading = ref(false); const templates = ref([]); const curRegionLabel = computed(() => { const r = REGIONS.find((x) => x.value === curRegion.value); return r ? r.label : "区域" + curRegion.value; }); const templatesByCat = computed(() => { return SCAT.map((sc) => ({ cat: sc.v, label: sc.label, items: templates.value.filter((t) => t.category === sc.v) })).filter((g) => g.items.length); }); const templatesForType = computed(() => templates.value.filter((t) => t.category === editType.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)); const tplModalVisible = ref(false); const tplView = ref("list"); const tplEditing = ref(false); const tplForm = reactive({ id: "", category: 2, provider: "", name: "", description: "" }); const tplFields = ref([]); return (_ctx, _push, _parent, _attrs) => { const _component_LangSelect = __nuxt_component_0; _push(``); if (!backendReady.value) { _push(`
⚠ 「第三方服务配置」后端接口暂不可用(连接失败),请检查 console 服务是否运行。
`); } else { _push(``); } _push(`

第三方服务配置

按服务类型分组管理已接入的第三方服务(火山引擎、阿里云、Azure 等)。默认展示全局默认配置,可切换到具体应用;区域默认中国,切换区域可为该区域覆盖字段值。

`); ssrRenderList(allSvcs.value, (s) => { _push(`
${ssrInterpolate(s.name)}${ssrInterpolate(s.enable ? "启用" : "停用")}
`); if (s.provider) { _push(`${ssrInterpolate(s.provider)}`); } else { _push(``); } _push(``); 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)}`); if (editForm.provider) { _push(` · 服务商 ${ssrInterpolate(editForm.provider)}`); } else { _push(``); } _push(`

基本信息

服务类型

`); if (editType.value) { _push(`${ssrInterpolate(scatInfo(editType.value).short)}`); } else { _push(``); } _push(`${ssrInterpolate(editType.value ? scatInfo(editType.value).label : "未设置")}(类型在创建时确定,不可更改)
配置字段(全区域共用)
`); if (!editFields.value.length) { _push(`

尚无字段,点击下方添加

`); } else { _push(`
`); ssrRenderList(editFields.value, (f, i) => { _push(``); }); _push(`
字段名字段描述加密默认值
`); if (f.type === "langs") { _push(ssrRenderComponent(_component_LangSelect, { modelValue: f.def_value, "onUpdate:modelValue": ($event) => f.def_value = $event, multiple: true }, null, _parent)); } else if (f.type === "lang") { _push(ssrRenderComponent(_component_LangSelect, { modelValue: f.def_value, "onUpdate:modelValue": ($event) => f.def_value = $event }, null, _parent)); } else if (f.encrypted) { _push(`
🔒 加密`); } else { _push(``); } _push(`
`); } _push(`
`); } else if (detailMode.value === "new") { _push(`

新增第三方服务

① 服务类型`); if (editType.value) { _push(` · ${ssrInterpolate(scatInfo(editType.value).short)}`); } else { _push(``); } _push(`
② 服务商`); if (editForm.provider) { _push(` · ${ssrInterpolate(editForm.provider)}`); } else { _push(``); } _push(`
③ 配置
`); if (wizardStep.value === 1) { _push(`

请选择要接入的服务类型(每个服务归属单一类型,独立配置):

`); ssrRenderList(SCAT, (sc) => { _push(`
${ssrInterpolate(sc.short)}${ssrInterpolate(sc.label)}
`); }); _push(`
`); } else if (wizardStep.value === 2) { _push(`

为「${ssrInterpolate(scatInfo(editType.value).label)}」选择服务商:

`); ssrRenderList(templatesForType.value, (t) => { _push(`
${ssrInterpolate(t.provider)}${ssrInterpolate(t.name)}${ssrInterpolate((t.fields || []).length)} 字段
`); }); _push(`
自定义空白自定义手动添加字段
`); if (!templatesForType.value.length) { _push(`

该类型暂无内置模板,可选「空白自定义」,或到「服务商模板」新增。

`); } else { _push(``); } _push(``); } else { _push(`
${ssrInterpolate(scatInfo(editType.value).short)}`); if (editForm.provider) { _push(`${ssrInterpolate(editForm.provider)}`); } else { _push(``); } _push(`
配置字段
`); if (!editFields.value.length) { _push(`

尚无字段,选模板自动带出或点击下方添加

`); } else { _push(`
`); ssrRenderList(editFields.value, (f, i) => { _push(``); }); _push(`
字段名字段描述加密默认值
`); if (f.type === "langs") { _push(ssrRenderComponent(_component_LangSelect, { modelValue: f.def_value, "onUpdate:modelValue": ($event) => f.def_value = $event, multiple: true }, null, _parent)); } else if (f.type === "lang") { _push(ssrRenderComponent(_component_LangSelect, { modelValue: f.def_value, "onUpdate:modelValue": ($event) => f.def_value = $event }, null, _parent)); } else if (f.encrypted) { _push(`
🔒 加密`); } else { _push(``); } _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(``); if (!overrideFields.value.length) { _push(``); } else { _push(``); } _push(`
字段名字段描述状态本区域不适用有效值
${ssrInterpolate(f.key)}${ssrInterpolate(f.description)}`); if (f.disabled) { _push(`停用`); } else if (f.is_overridden) { _push(`覆盖`); } else { _push(`继承`); } _push(``); if (f.type === "langs") { _push(ssrRenderComponent(_component_LangSelect, { modelValue: f._input, "onUpdate:modelValue": ($event) => f._input = $event, multiple: true, disabled: f.disabled }, null, _parent)); } else if (f.type === "lang") { _push(ssrRenderComponent(_component_LangSelect, { modelValue: f._input, "onUpdate:modelValue": ($event) => f._input = $event, disabled: f.disabled }, null, _parent)); } else if (f.encrypted) { _push(`
🔒`); } else { _push(``); } _push(`
该服务尚无默认字段
${ssrInterpolate(curRegionLabel.value)} 专属字段
`); if (!extraRegionFields.value.length) { _push(`

尚无区域专属字段,点击下方添加

`); } else { _push(`
`); ssrRenderList(extraRegionFields.value, (f, i) => { _push(``); }); _push(`
字段名字段描述加密值
`); if (f.encrypted) { _push(`
🔒`); } else { _push(``); } _push(`
`); } _push(`
`); } _push(``); } else { _push(``); } _push(`

同步到其他区域

${ssrInterpolate(syncDesc.value)}

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

⚠ 已勾选区域将被当前配置(值覆盖 / 区域专属字段 / 停用字段)整体替换;加密字段密文一并同步。

`); if (tplView.value === "list") { _push(`

服务商模板

模板是字段预设,新增服务时可一键带出。内置模板可编辑;删除后重启会被重新补回。

`); ssrRenderList(templatesByCat.value, (g) => { _push(`

${ssrInterpolate(g.label)}

`); ssrRenderList(g.items, (t) => { _push(`
${ssrInterpolate(t.name)}${ssrInterpolate(t.provider)}`); if (t.builtin) { _push(`内置`); } else { _push(``); } _push(`

${ssrInterpolate(t.id)} · ${ssrInterpolate((t.fields || []).length)} 字段

`); }); _push(`
`); }); _push(``); if (!templates.value.length) { _push(`

暂无模板

`); } else { _push(``); } _push(`
`); } else { _push(`

${ssrInterpolate(tplEditing.value ? "编辑模板" : "新增模板")}

字段

`); ssrRenderList(tplFields.value, (f, i) => { _push(``); }); _push(``); if (!tplFields.value.length) { _push(``); } else { _push(``); } _push(`
字段名字段描述加密默认/提示值
`); if (f.type === "langs") { _push(ssrRenderComponent(_component_LangSelect, { modelValue: f.def_value, "onUpdate:modelValue": ($event) => f.def_value = $event, multiple: true }, null, _parent)); } else if (f.type === "lang") { _push(ssrRenderComponent(_component_LangSelect, { modelValue: f.def_value, "onUpdate:modelValue": ($event) => f.def_value = $event }, null, _parent)); } else { _push(``); } _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-04ce4a7d"]]); export { serviceconfig as default }; //# sourceMappingURL=serviceconfig-PSQWGwHl.mjs.map