import { defineComponent, ref, reactive, computed, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual, ssrRenderList, ssrRenderAttr, ssrInterpolate, ssrRenderStyle, ssrRenderClass, ssrRenderComponent } from 'vue/server-renderer'; import { u as useApi } from './useApi-B-E5eLsI.mjs'; import { u as useToast } from './useToast-CS21XT61.mjs'; import { L as LANG_OPTIONS } from './useLangOptions-DMhiAuTa.mjs'; import { _ as __nuxt_component_0 } from './LangSelect-C_QPlcDf.mjs'; import { _ as _export_sfc } from './server.mjs'; import './useLoading-D4zrSa2m.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'; const CAT_STT = 1; const CAT_TTS = 2; const CAT_MT = 3; const CAT_AST = 4; const CAT_LLM = 5; const CAT_STS = 7; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "agents", __ssrInlineRender: true, setup(__props) { const AGENT_TYPES = [ { value: "chat", label: "对话", icon: "💬", hint: "STT → LLM → TTS 三段拼接", color: "#b45309", bg: "#fef9c3" }, { value: "translate", label: "翻译", icon: "🧩", hint: "STT → MT → TTS 三段拼接", color: "#059669", bg: "#dcfce7" }, { value: "sts-chat", label: "端到端对话", icon: "⚡", hint: "单个 STS 服务直接完成语音对话", color: "#be185d", bg: "#fce7f3" }, { value: "ast-translate", label: "端到端翻译", icon: "🚀", hint: "单个 AST 服务直接完成语音翻译", color: "#c2410c", bg: "#fff7ed" } ]; const SLOTS = { chat: [ { key: "stt_svc_id", slot: "STT", label: "语音识别", cat: CAT_STT, color: "#1664ff" }, { key: "llm_svc_id", slot: "LLM", label: "大语言模型", cat: CAT_LLM, color: "#b45309" }, { key: "tts_svc_id", slot: "TTS", label: "语音合成", cat: CAT_TTS, color: "#7c3aed" } ], translate: [ { key: "stt_svc_id", slot: "STT", label: "语音识别", cat: CAT_STT, color: "#1664ff" }, { key: "mt_svc_id", slot: "MT", label: "机器翻译", cat: CAT_MT, color: "#059669" }, { key: "tts_svc_id", slot: "TTS", label: "语音合成", cat: CAT_TTS, color: "#7c3aed" } ], "sts-chat": [{ key: "sts_svc_id", slot: "STS", label: "端到端语音对话", cat: CAT_STS, color: "#be185d" }], "ast-translate": [{ key: "ast_svc_id", slot: "AST", label: "端到端语音翻译", cat: CAT_AST, color: "#f97316" }] }; function slotsOfType(t) { return SLOTS[t] ?? []; } useApi(); useToast(); const scopeApp = ref(""); const scopeApps = ref([]); const agents2 = ref([]); const allSvcs = ref([]); const modalOpen = ref(false); const isEditing = ref(false); const submitting = ref(false); function emptyForm() { return { app_name: "", id: "", name: "", type: "translate", description: "", avatar_url: "", enable: true, stt_svc_id: "", llm_svc_id: "", tts_svc_id: "", mt_svc_id: "", sts_svc_id: "", ast_svc_id: "", system_prompt: "", gender: 0, greeting_enabled: false, greeting_text: "", support_langs: "", default_lang: "", voice_map: [], sort: 0 }; } const form = reactive(emptyForm()); const isChatType = computed(() => form.type === "chat" || form.type === "sts-chat"); const supportedLangOptions = computed(() => { const codes = (form.support_langs || "").split(",").map((x) => x.trim()).filter(Boolean); if (!codes.length) return LANG_OPTIONS; return LANG_OPTIONS.filter((o) => codes.includes(o.code)); }); const grouped = computed( () => AGENT_TYPES.map((t) => ({ ...t, type: t.value, items: agents2.value.filter((a) => a.type === t.value).sort((a, b) => (b.sort || 0) - (a.sort || 0) || (a.name || "").localeCompare(b.name || "")) })).filter((g) => g.items.length) ); function svcsByCat(cat) { return allSvcs.value.filter( (s) => s.enable && (s.categories || "").split(",").map(Number).includes(cat) ); } function svcName(id) { if (!id) return "未配置"; const s = allSvcs.value.find((x) => x.id === id); return s ? s.name : id; } function pipelineOf(a) { return slotsOfType(a.type).map((s) => ({ slot: s.slot, color: s.color, id: a[s.key] })); } return (_ctx, _push, _parent, _attrs) => { _push(`
把已配置的第三方服务编排成可下发客户端的智能体。四种类型按需引用不同服务;通话翻译规则只能引用「翻译」与「端到端翻译」两类。
当前作用域下还没有 Agent
先在「第三方服务配置」里配好服务,再来把它们组装成 Agent
${ssrInterpolate(a.description)}
`); } else { _push(``); } _push(`