PageSourceSearch

https://www.caodui.com.cn/assets/LlmPromptTemplateForm-ed6dd084.js

js caodui.com.cn collected 2026-10-02 01:21:06 UTC 65,672 bytes, 31 lines download raw bytes

1import{_ as La}from"./index-bf4c1f57.js";import{v as Fa,y as za,z as f,A as X,B as Da,a4 as Va,F as y,G as b,N as p,O as z,H as c,I as u,Q as he,L as Y,K as _,M as Ne,J as ut,P as ge,V as ve,R as Ua,cA as ja,W as E,C as w,Y as P}from"./head-ed4e7f32.js";import{m as Ga,n as Ba,g as Ja,o as $a}from"./llm-5e5fcb05.js";import{d as Ka,f as _e,L as dt,e as Ya,g as Wa,a as Ha,h as qa}from"./llmBizType-6e24b77b.js";import{_ as le}from"./Input.vue_vue_type_script_setup_true_lang-35193508.js";import{_ as Xa}from"./Textarea.vue_vue_type_script_setup_true_lang-4cc3b591.js";import{U as Me}from"./UiSelect-3aa8c56e.js";import Za from"./DocumentSelectModal-605e8186.js";import Qa from"./PromptContextConfigEditor-3efad5fb.js";import{_ as en}from"./PromptTemplateOptimizeModal.vue_vue_type_script_setup_true_lang-b395ffc5.js";import{P as tn,s as mt,i as pt}from"./promptTemplateTaxonomy-77b3808f.js";import an from"./AiAvatarPickerModal-6f4087a0.js";import{u as nn}from"./avatarStore-151882b9.js";import{S as sn}from"./sparkles-3ceaec48.js";import{S as ft}from"./search-5eabff58.js";import{X as ht}from"./x-bfce1282.js";import{F as Z}from"./file-text-5a7e230d.js";import{U as on}from"./upload-a0936a89.js";import{c as Ee}from"./createLucideIcon-1b00ea2d.js";import{C as rn}from"./circle-alert-8f01d4a6.js";import{F as gt}from"./file-ee9910fd.js";import{F as ln}from"./index-05b7c264.js";import{M as cn}from"./index-5b23bafe.js";import{F as Le,a as D}from"./FileIcon.vue_vue_type_script_setup_true_lang-77f38cb0.js";import{F as Fe}from"./file-headphone-9a836d8a.js";import{F as ze}from"./file-play-966fa5af.js";import{_ as un}from"./FormItem-a4d6142c.js";import{_ as dn}from"./index-94da77ce.js";import{_ as mn}from"./_plugin-vue_export-helper-c27b6911.js";/**
2 * @license lucide-vue-next v0.562.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const pn=Ee("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);/**
7 * @license lucide-vue-next v0.562.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const ie=Ee("file-archive",[["path",{d:"M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5",key:"4pqfef"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 12v-1",key:"1ej8lb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M8 7V6",key:"1nbb54"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]]);/**
12 * @license lucide-vue-next v0.562.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const vt=Ee("file-chart-pie",[["path",{d:"M15.941 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.704l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v3.512",key:"13hoie"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M4.017 11.512a6 6 0 1 0 8.466 8.475",key:"s6vs5t"}],["path",{d:"M9 16a1 1 0 0 1-1-1v-4c0-.552.45-1.008.995-.917a6 6 0 0 1 4.922 4.922c.091.544-.365.995-.917.995z",key:"1dl6s6"}]]);/**
17 * @license lucide-vue-next v0.562.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const Q=Ee("file-image",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);function fn(h){return JSON.parse(JSON.stringify(h))}function hn(h,T,v){const l=Ka(h);if(!l||Object.keys(l).length===0)return{};const k=fn(l);return gn(h,k,T,v),k}function gn(h,T,v,l){const k=`dashboard.llmResponseJsonSchema.${h}`,A=(x,g)=>{if(x==null)return;if(Array.isArray(x)){x.forEach((R,C)=>A(R,[...g,String(C)]));return}if(typeof x!="object")return;const S=x;for(const[R,C]of Object.entries(S))if(R==="description"&&typeof C=="string"){const N=`${k}.${[...g,"description"].join(".")}`;l(N)&&(S[R]=v(N))}else A(C,[...g,R])};A(T,[])}const vn={系统默认:[{name:"输入JSON",key:"inputJson"},{name:"开业状态枚举",key:"openingStatusEnum"},{name:"执照状态枚举",key:"licenseStatusEnum"},{name:"时间周期枚举",key:"periodTypeEnum"},{name:"时间粒度枚举",key:"granularityEnum"},{name:"星期枚举",key:"weekdayEnum"},{name:"品类枚举",key:"categoryEnum"},{name:"槽位结果配置",key:"slotResultConfig"},{name:"路由动作列表",key:"actions"},{name:"知识库候选列表",key:"kbList"},{name:"开放工单列表",key:"openSupportTickets"},{name:"最新消息列表",key:"msgList"},{name:"全部字幕内容",key:"srtContent"},{name:"提纲词",key:"outlineKeywords"},{name:"重点词",key:"keyPointsKeywords"},{name:"素材",key:"materialDesc"},{name:"底板视频",key:"baseMaterialDesc"},{name:"待改写文案",key:"originalText"},{name:"近10条文案",key:"recentCopyList"},{name:"参考图素材描述",key:"referenceImageDescriptions"},{name:"每行字幕拆分段数",key:"partCount"},{name:"拆分后字幕最大字数",key:"maxPartLength"},{name:"每行字幕文本",key:"text"},{name:"AI已生成文案",key:"generatedText"},{name:"底板素材剩余文案",key:"remainingGeneratedText"},{name:"底板素材剩余文案(精排)",key:"sceneMaterialRemainingText"},{name:"素材标签库",key:"assetTagLibrary"},{name:"拆句打标签结果",key:"segmentTaggingJson"},{name:"分句候选素材列表",key:"segmentCandidatesJson"},{name:"封面标题",key:"coverTitle"},{name:"标题",key:"title"},{name:"图片文字(第1张)",key:"imageText1"},{name:"客户画像",key:"customerProfile"},{name:"最近聊天上下文",key:"historyMsgList"},{name:"系统后续动作任务",key:"followUpTasks"},{name:"可即时触发策略列表",key:"availableImmediateStrategies"},{name:"当前活动跟进任务",key:"activeFollowUpTasks"},{name:"时间周期枚举列表",key:"periodTypeEnums"},{name:"时间粒度枚举列表",key:"granularityEnums"},{name:"星期枚举列表",key:"weekdayEnums"},{name:"价格上下文",key:"pricingContext"},{name:"问题分类列表",key:"categoryList"}
21,{name:"问题内容",key:"issueContent"},{name:"候选跟进模板",key:"candidateTemplates"},{name:"原始模板文案",key:"templateContent"},{name:"触发类型编码",key:"triggerTypeCode"},{name:"触发类型ID",key:"triggerTypeId"},{name:"任务类型",key:"taskType"},{name:"命中模板ID",key:"followupTemplateId"}],筛选条件:[{name:"素材名称关键词",key:"nameKeyword"},{name:"搜索关键词",key:"searchKeywords"},{name:"素材分类",key:"materialCategory"},{name:"文档分类",key:"documentCategory"},{name:"标签域",key:"tagDomain"},{name:"标签分类",key:"tagCategory"},{name:"标签",key:"tag"},{name:"提示词占位符",key:"promptPlaceholder"}]},De=(h,T)=>h.startsWith("zh")?T.zh:T.en,_n={materialDesc:{section:{zh:"文案与素材",en:"Copywriting and assets"},description:{zh:"插入当前命中的辅助素材说明,适合让模型参考素材内容、镜头信息或画面气质继续生成文案。",en:"Injects the matched asset descriptions so the model can continue from actual visual references."},example:{zh:"示例值:北欧客厅远景,木质地板,暖光,自然采光,人物从左向右走入画面。",en:"Example value: Wide Nordic living room shot, wood floor, warm light, natural daylight, person entering from left to right."},keywords:["素材","镜头","画面","asset","visual"]},baseMaterialDesc:{section:{zh:"文案与素材",en:"Copywriting and assets"},description:{zh:"插入底板素材的描述信息,通常用于让模型围绕底板镜头去补充标题、口播或改写文案。",en:"Injects the base material description, useful when the prompt should follow the base footage."},example:{zh:"示例值:竖屏家居底板视频,镜头平移展示客厅收纳柜,时长 8 秒。",en:"Example value: Vertical home-living base video, panning across a storage cabinet, 8 seconds."}},originalText:{section:{zh:"文案与素材",en:"Copywriting and assets"},description:{zh:"插入待改写或待优化的原始文案,适合改写、缩写、风格调整等场景。",en:"Injects the original copy to rewrite, shorten, or restyle."},example:{zh:"示例值:这款收纳柜真的太能装了,小户型也能轻松腾出空间。",en:"Example value: This storage cabinet holds far more than you expect and frees up space even in small rooms."}},generatedText:{section:{zh:"文案与素材",en:"Copywriting and assets"},description:{zh:"插入系统前一步已经生成的文案结果,适合串联多阶段流程继续润色或结构化输出。",en:"Injects the copy already generated in an earlier step so the next step can refine or restructure it."},example:{zh:"示例值:原木色收纳柜,让客厅从杂乱变整洁,颜值和收纳力一次到位。",en:"Example value: A natural wood storage cabinet that turns a cluttered living room into a tidy one with both style and capacity."}},remainingGeneratedText:{section:{zh:"文案与素材",en:"Copywriting and assets"},description:{zh:"插入尚未被底板镜头消耗掉的剩余文案,适合继续补全脚本或做二次分配。",en:"Injects the remaining generated copy that has not yet been allocated to base footage."},example:{zh:"示例值:还想强调静音滑轨、分类收纳和一柜多用等卖点。",en:"Example value: Still needs to emphasize silent rails, categorized storage, and multi-purpose usage."}},sceneMaterialRemainingText:{section:{zh:"文案与素材",en:"Copywriting and assets"},description:{zh:"插入精排模式下剔除已命中文案后的剩余底板文案,适合继续做后续粗排。",en:"Injects the remaining base-material copy after precise-mode matched sentences are removed."},example:{zh:"示例值:还需要补上活动中心配置和结尾号召部分。",en:"Example value: Still needs the activity-center setup and the closing call-to-action."}},title:{section:{zh:"标题与封面",en:"Titles and covers"},description:{zh:"插入当前任务的标题内容,适合标题扩写、标题校对和结构化输出。",en:"Injects the current title, useful for title refinement or structured output."},example:{zh:"示例值:客厅收纳翻倍的小技巧",en:"Example value: Small tricks to double living-room storage"}},coverTitle:{section:{zh:"标题与封面",en:"Titles and covers"},description:{zh:"插入封面标题,通常用于封面文案优化或让正文与封面主题保持一致。",en:"Injects the cover title so the prompt c
21an align the body with the cover theme."},example:{zh:"示例值:3 招做好客厅收纳",en:"Example value: 3 ways to fix living-room storage"}},referenceImageDescriptions:{section:{zh:"图像理解",en:"Image understanding"},description:{zh:"插入参考图经过视觉模型提取后的描述结果,适合图文改写、风格跟随或提示词增强。",en:"Injects descriptions extracted from reference images, useful for style-following or prompt enhancement."},example:{zh:"示例值:画面为奶油风卧室,主色偏米白,床头有暖色氛围灯,整体柔和温暖。",en:"Example value: The image shows a cream-style bedroom with warm ambient lighting and a soft cozy palette."}},srtContent:{section:{zh:"字幕处理",en:"Subtitle processing"},description:{zh:"插入完整字幕内容,适合做字幕校对、截短、分句或标签提取。",en:"Injects the full subtitle text for proofreading, shortening, splitting, or tagging."},example:{zh:"示例值:大家好,今天带你们看看这套小户型是怎么把收纳做满的……",en:"Example value: Hi everyone, today we will walk through how this small apartment maximizes storage..."}},partCount:{section:{zh:"字幕处理",en:"Subtitle processing"},description:{zh:"插入当前字幕需要拆成几段的约束值,常用于字幕截短与断句任务。",en:"Injects how many parts the current subtitle line should be split into."},example:{zh:"示例值:2",en:"Example value: 2"}},maxPartLength:{section:{zh:"字幕处理",en:"Subtitle processing"},description:{zh:"插入拆分后每段允许的最大字数,用于控制字幕长度。",en:"Injects the maximum length allowed for each subtitle segment."},example:{zh:"示例值:12",en:"Example value: 12"}},text:{section:{zh:"字幕处理",en:"Subtitle processing"},description:{zh:"插入当前处理的单行字幕文本,适合逐句改写、纠错或压缩。",en:"Injects the current subtitle line for per-line rewrite, correction, or compression."},example:{zh:"示例值:这个柜子把零碎杂物都藏起来了。",en:"Example value: This cabinet hides away all the small clutter."}},segmentTaggingJson:{section:{zh:"素材分析",en:"Asset analysis"},description:{zh:"插入拆句后的标签结果,适合继续做素材路由、素材挑选或校验。",en:"Injects tagging results for split sentences, useful for routing and selecting assets."},example:{zh:'示例值:[{"segment":"客厅更整洁","tags":["收纳","客厅"]}]',en:'Example value: [{"segment":"Living room becomes tidier","tags":["storage","living room"]}]'}},segmentCandidatesJson:{section:{zh:"素材分析",en:"Asset analysis"},description:{zh:"插入每个分句匹配到的候选素材列表,适合继续排序、筛选或解释选择原因。",en:"Injects candidate assets per sentence segment for ranking, filtering, or rationale generation."},example:{zh:'示例值:[{"segment":"收纳更强","candidates":[{"assetId":101,"score":0.92}]}]',en:'Example value: [{"segment":"stronger storage","candidates":[{"assetId":101,"score":0.92}]}]'}},assetTagLibrary:{section:{zh:"素材分析",en:"Asset analysis"},description:{zh:"插入当前可用的素材标签库,方便模型按照标签体系输出结构化结果。",en:"Injects the available asset tag library so the model can respond against the known taxonomy."},example:{zh:"示例值:风格:现代/奶油/原木;空间:客厅/卧室;功能:收纳/展示。",en:"Example value: Style: modern/cream/natural wood; Space: living room/bedroom; Function: storage/display."}},customerProfile:{section:{zh:"售前对话",en:"Pre-sale dialogue"},description:{zh:"插入客户画像信息,适合生成更贴近客户背景的跟进话术或策略。",en:"Injects the customer profile so follow-up messages can match the customer context."},example:{zh:"示例值:新房装修用户,预算中高,关注环保和储物能力,决策周期 2 周。",en:"Example value: New-home renovation customer, mid-to-high budget, cares about eco-friendliness and storage, decision cycle two weeks."}}
21,historyMsgList:{section:{zh:"售前对话",en:"Pre-sale dialogue"},description:{zh:"插入最近聊天记录,适合做上下文续写、意图判断和跟进建议。",en:"Injects recent chat history for contextual follow-up, intent detection, or strategy advice."},example:{zh:"示例值:用户:有没有适合小户型的?顾问:有,这边先看几款带抽屉的方案……",en:"Example value: User: Do you have options for small apartments? Agent: Yes, here are several drawer-based layouts..."}},issueContent:{section:{zh:"售前对话",en:"Pre-sale dialogue"},description:{zh:"插入当前客户问题正文,适合做问题归类、答复生成或跟进模板匹配。",en:"Injects the current customer issue content for classification or reply generation."},example:{zh:"示例值:我想知道这款柜子能不能定制尺寸,多久能安装?",en:"Example value: Can this cabinet be customized in size, and how long does installation take?"}},candidateTemplates:{section:{zh:"售前对话",en:"Pre-sale dialogue"},description:{zh:"插入候选跟进模板,适合让模型从多个模板中做选择或二次改写。",en:"Injects candidate follow-up templates so the model can choose or adapt one."},example:{zh:"示例值:模板 A:价格咨询;模板 B:预约到店;模板 C:尺寸定制。",en:"Example value: Template A: pricing inquiry; Template B: store visit booking; Template C: size customization."}},pricingContext:{section:{zh:"售前对话",en:"Pre-sale dialogue"},description:{zh:"插入价格相关上下文,适合做报价说明、价格解释或优惠策略建议。",en:"Injects pricing context for quote explanations or discount strategy suggestions."},example:{zh:"示例值:当前活动满 5000 减 500,安装费包含在套餐内。",en:"Example value: Current promotion offers 500 off orders above 5000, with installation included."}}
21,promptPlaceholder:{section:{zh:"运行时筛选",en:"Runtime filters"},description:{zh:"插入制作页填写的提示词占位符条件,适合让模型参考用户手动输入的补充信息。",en:"Injects prompt-placeholder inputs collected at runtime so the model can use manual hints from the creator."},example:{zh:"示例值:重点突出“环保板材”“适合小户型”“原木风”。",en:"Example value: Emphasize eco-friendly boards, small-space fit, and natural wood style."}}},yn=new Set(["inputJson","openingStatusEnum","licenseStatusEnum","periodTypeEnum","granularityEnum","weekdayEnum","categoryEnum","slotResultConfig","periodTypeEnums","granularityEnums","weekdayEnums","triggerTypeCode","triggerTypeId","taskType"]),Tn=new Set(["nameKeyword","searchKeywords","materialCategory","documentCategory","tagDomain","tagCategory","tag","promptPlaceholder"]),En=new Set(["actions","kbList","openSupportTickets","msgList","customerProfile","historyMsgList","followUpTasks","availableImmediateStrategies","activeFollowUpTasks","pricingContext","categoryList","issueContent","candidateTemplates","templateContent","followupTemplateId"]),In=/^imageText\d+$/i,bn=(h,T,v)=>In.test(h)?{section:{zh:"图像理解",en:"Image understanding"},description:{zh:"插入对应图片中的识别文字,适合图文改写、封面文案校对或从图片中抽取关键信息。",en:"Injects OCR text from the corresponding image, useful for copy adaptation or key-info extraction."},example:{zh:"示例值:收纳不够?这一招直接多出 30% 空间",en:"Example value: Not enough storage? This one trick adds 30% more space"}}:Tn.has(h)||T==="筛选条件"?{section:{zh:"运行时筛选",en:"Runtime filters"},description:{zh:`引用运行时填写的「${v}」条件,通常用于约束素材或文档的匹配范围。`,en:`Uses the runtime value of "${v}" to constrain asset or document matching.`},example:{zh:"示例值:现代、原木风、客厅收纳",en:"Example value: modern, natural wood, living-room storage"}}:En.has(h)?{section:{zh:"售前对话",en:"Pre-sale dialogue"},description:{zh:`插入与「${v}」相关的业务上下文,适合售前问答、跟进策略和模板选择。`,en:`Injects "${v}" business context for pre-sale replies, strategy, or template selection.`},example:{zh:"示例值:按流程注入的会话上下文或业务配置数据。",en:"Example value: Conversation context or business configuration injected by the workflow."}}:yn.has(h)?{section:{zh:"系统配置",en:"System configuration"},description:{zh:`插入系统维护的「${v}」配置或枚举值,适合要求模型按既定范围输出。`,en:`Injects the system-managed "${v}" config or enum values so the model stays within allowed ranges.`},example:{zh:'示例值:["启用","禁用"] 或 JSON 配置对象',en:'Example value: ["enabled", "disabled"] or a JSON config object'}}:T==="素材"?{section:{zh:"自定义素材占位符",en:"Custom asset placeholders"},description:{zh:`插入自定义素材占位符「${v}」对应的检索结果,适合把特定素材集合注入提示词。`,en:`Injects the matched result for custom asset placeholder "${v}".`},example:{zh:"示例值:符合筛选条件的素材说明摘要。",en:"Example value: A summary of matched asset descriptions."}}:T==="切片"?{section:{zh:"自定义切片占位符",en:"Custom slice placeholders"},description:{zh:`插入自定义切片占位符「${v}」对应的检索结果,适合把特定切片集合注入提示词。`,en:`Injects the matched result for custom slice placeholder "${v}".`},example:{zh:"示例值:符合筛选条件的切片说明摘要。",en:"Example value: A summary of matched slice descriptions."}}:T==="文档"?{section:{zh:"自定义文档占位符",en:"Custom document placeholders"},description:{zh:`插入自定义文档占位符「${v}」匹配到的文档内容,适合把知识文档注入提示词。`,en:`Injects the matched result for custom document placeholder "${v}".`},example:{zh:"示例值:命中文档中的摘要段落或关键说明。",en:"Example value: Key excerpts or summary paragraphs from matched documents."}}:{section:{zh:"系统上下文",en:"System context"},description:{zh:`运行时会将「${v}」对应的数据替换到这里,适合让模型使用当前流程中的上下文信息。`,en:`At runtime, "${v}" data is injected here so the model can use the current workflow context.`},example:{zh:"示例值:由系统流程生成的上下文文本或结构化数据。",en:"Example value: Context text or structured data generated by the workflow."}};function An(h){var N,O;const T=String(h.rawKey||"").trim(),v=h.category,l=h.label||T,k=_n[T]??bn(T,v,l),A=De(h.locale,k.section),x=((N=h.customDescription)==null?void 0:N.trim())||De(h.locale,k.description),g=De(h.locale,k.example),S=(O=h.sceneLabel)==null?void 0:O.trim(),R=h.locale.startsWith("zh")?S?`在当前å
21œºæ™¯ã€Œ${S}」中,执行时会先解析「${l}」对应的数据,再替换到这个占位符位置。`:`执行时会先解析「${l}」对应的数据,再替换到这个占位符位置。`:S?`In the current scene "${S}", the runtime resolves "${l}" first and then replaces this placeholder.`:`At runtime, "${l}" is resolved first and then replaces this placeholder.`,C=[T,l,A,x,g,...k.keywords||[]].join(" ").toLowerCase();return{section:A,description:x,example:g,sceneHint:R,searchText:C}}function Ve(h,T=!0){const v=(k,A=!1)=>{var C,N;let x="",g=!1,S=!1;const R=Array.from(k.childNodes).filter(O=>O.nodeType===1||O.nodeType===3);A&&((C=R[R.length-1])==null?void 0:C.tagName)==="BR"&&R.pop();for(const O of R){const $=O,o=(N=$.dataset)==null?void 0:N.placeholderKey,V=!o&&($.tagName==="DIV"||$.tagName==="P"),I=O.nodeType===3?O.textContent||"":o?`{{${o}}}`:$.tagName==="BR"?`
22`:v(O,V);!V&&!I||(S&&(g||V&&!x.endsWith(`
23`))&&(x+=`
24`),x+=I,S=!0,g=V)}return x},l=v(h);return T?l.replace(/\n+$/,""):l}const xn={class:"llm-prompt-template-form"},Sn={class:"grid grid-cols-1 md:grid-cols-3 gap-6"},Pn={key:0,class:"flex gap-2"},Rn={class:"mb-6 rounded-2xl border border-slate-100 bg-slate-50/60 px-4 py-4"},kn={class:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between"},Cn={class:"min-w-0"},On={class:"text-sm font-semibold text-slate-900"},wn={class:"mt-1 text-xs leading-5 text-slate-500"},Nn={class:"mb-3 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-slate-100 bg-slate-50/70 px-4 py-3"},Mn={class:"text-sm font-semibold text-slate-900"},Ln={class:"text-xs text-slate-500"},Fn={class:"rounded-xl border border-slate-100 bg-white overflow-hidden"},zn={class:"prompt-content-layout"},Dn={class:"prompt-editor-wrap flex-1 min-w-0 p-1"},Vn=["data-placeholder"],Un={class:"prompt-placeholder-panel"},jn={class:"border-b border-slate-100 px-3 py-3"},Gn={class:"flex items-center justify-between gap-2"},Bn={class:"text-sm font-semibold text-slate-900"},Jn={class:"rounded-full bg-slate-100 px-2 py-0.5 text-[11px] font-semibold text-slate-500"},$n={class:"relative mt-3"},Kn={class:"prompt-placeholder-panel__list custom-scrollbar"},Yn=["onClick"],Wn={class:"block min-w-0 truncate text-xs font-semibold text-slate-700"},Hn={key:0,class:"ml-1 shrink-0 rounded-full bg-emerald-50 px-1.5 py-0.5 text-[10px] font-semibold leading-none text-emerald-600"},qn={key:1,class:"flex h-full items-center justify-center px-3 text-center text-xs text-slate-400"},Xn={class:"rounded-xl border border-slate-100 overflow-hidden bg-white"},Zn={class:"bg-slate-50/80 px-4 py-2 flex items-center justify-between border-b border-slate-100"},Qn={class:"flex items-center gap-2"},es={class:"text-xs text-slate-500 font-medium italic"},ts={key:0,class:"text-[10px] bg-slate-200 text-slate-600 px-1.5 py-0.5 rounded-full font-bold"},as={class:"p-4 bg-slate-50/30 min-h-[100px]"},ns={key:0,class:"flex flex-col items-center justify-center py-8 text-slate-400"},ss={class:"text-xs"},os={key:1,class:"flex flex-col gap-2"},rs={class:"flex items-center gap-3 min-w-0"},ls={class:"w-8 h-8 rounded bg-slate-100 flex items-center justify-center flex-shrink-0 group-hover:bg-emerald-50 transition-colors"},is={class:"min-w-0"},cs=["title"],us={class:"text-[10px] text-slate-400"},ds=["onClick"],ms={class:"rounded-xl border border-slate-100 overflow-hidden bg-white"},ps={class:"bg-slate-50/80 px-4 py-2 flex items-center justify-between border-b border-slate-100"},fs={class:"text-xs text-slate-500 font-medium italic"},hs={key:0,class:"mt-2 flex items-center gap-1.5 text-red-500 text-xs animate-in slide-in-from-top-1"},gs={class:"flex items-center justify-between pt-4 border-t border-slate-50"},vs={class:"flex items-center gap-2"},_s={class:"text-sm font-medium text-slate-700"},ys={class:"text-xs text-slate-400"},Ts={class:"mb-4"},Es={class:"relative"},Is={class:"space-y-5 max-h-[60vh] overflow-y-auto pr-1 custom-scrollbar"},bs={class:"text-[11px] font-bold text-slate-400 uppercase tracking-widest mb-2 px-1"},As={class:"flex flex-wrap gap-2"},xs=["onClick"],Ss={class:"text-sm leading-snug"},Ps={key:0,class:"py-8 text-center text-slate-400 text-sm"},_t="AI_ASSET_LIBRARY_GENERATE_MATERIAL",Rs="AI_ASSET_LIBRARY_MATERIAL_CONTENT_PARSE",ks="AI_ASSET_LIBRARY_VIDEO_VARIANT_PROMPT_GENERATE",Cs="AI_ASSET_LIBRARY_VIDEO_VARIANT_PARSE",yt="__ai_virtual_avatar__",ye="sys.",Tt="custom.",Te="promptContextBlocks",Et="BEFORE_OUTPUT_REQUIREMENTS",It=20,Os=Fa({__name:"LlmPromptTemplateForm",props:{category:{},initialData:{default:()=>({})},templateId:{default:void 0},lockScene:{type:Boolean,default:!1},copyAsNew:{type:Boolean,default:!1},adminAppRegion:{default:void 0}},emits:["saved","cancel"],setup(h,{expose:T,emit:v}){const{t:l,te:k,locale:A}=za(),x=e=>e==="系统默认"?l("dashboard.llmPromptTemplateFormPage.catSystem"):e==="素材"?l("dashboard.llmPromptTemplateFormPage.catMaterial"):e==="切片"?l("dashboard.llmPromptTemplateFormPage.catSlice"):e==="文档"?l("dashboard.llmPromptTemplateFormPage.catDocument"):e==="筛选条件"?l("dashboard.llmPromptTemplateFormPage.catFilter"):e,g=h,S=f(()=>{var e;return((e=g.adminAppRegion)==null?void 0:e.trim())||void 0}),R=f(()=>(g.category||"MARKET")==="MARKET"),C=f(()=>S.value?{appRegion:S.value}:void 0),N=v,O=E(!1),$=E(0),o=E({id:void 0,name:"",scene:"",promptGroup:"",promptSubgroup:"",modelId:void 0,content:"",status:!0,responseJson:"",documentIds:[],enableThinking:!1,structuredInput:""}),V=E([]),I=E([]),ee=E(!1),U=E(null),te=E(""),M=E(""),Ie=E(!1),be=E(!1),ce=e=>e===1||e==="1"||e===!0||e==="true",bt=e=>({...e,id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",platformId:(e==null?void 0:e.platformId)??(e==null?void 0:e.platform_id)??"",platformModelId:(e==null?void 0:e.platformModelId)??(e==null?void 0:e.platform_model_id)??(e==null?void 0:e.platformId)??(e==null?void 0:e.platform_id)??"",supportStructuredOutput:ce((e==null?void 0:e.supportStructuredOutput)??(e==null?void 0:e.support_structured_output)??0),supportThinking:ce((e==null?void 0:e.supportThinking)??(e==null?void 0:e.support_thinking)??0),supportStructuredOutputWhenThinking:ce((e==null?void 0:e.supportStructuredOutputWhenThinking)??(e==null?void 0:e.support_structured_output_when_thinking)??1)}),Ue=(e={})=>{const t=pt(e.scene,e.name);return{...e,promptGroup:e.promptGroup||e.prompt_group||t.promptGroup,promptSubgroup:e.promptSubgroup||e.prompt_subgroup||t.promptSubgroup,enableThinking:ce(e.enableThinking??e.enable_thinking??!1)}},At=tn.map(e=>({value:e.value,label:e.label})),xt=f(()=>mt(o.value.promptGroup).map(e=>({value:e.value,label:e.label})));X(()=>o.value.promptGroup,(e,t)=>{var n;if(!t||e===t)return;const a=mt(e);a.some(s=>s.value===o.value.promptSubgroup)||(o.value.promptSubgroup=((n=a[0])==null?void 0:n.value)||"")});const St=()=>{const e=g.category||"MARKET",t=Wa(e),a=Ha(qa(t)),n=["MARKET_DEBUG","PRE_SALE_DEBUG","AFTER_SALE_DEBUG"];return a.filter(s=>!n.includes(s)).map(s=>({value:s,label:_e(s)}))},Pt=f(()=>($.value,A.value,St())),ae=E(!1),ue=E(""),Ae=E(!1),je=E(""),Ge=nn(),Rt=f(()=>Ge.avatars.value),kt=[{key:"AI视频",label:"AI 视频"},{key:"AI图文",label:"AI 图文"},{key:"AI素材库",label:"AI 素材库"},{key:"AI短剧",label:"AI 短剧"},{key:"短视频",label:"短视频"},{key:"提示词模板优化",label:"提示词模板优化"},{key:"AI内容选题",label:"AI 内容选题"},{key:"AI选题",label:"AI 内容选题"},{key:"AI快速试用",label:"AI 快速试用"},{key:"AI标签",label:"AI 标签"},{key:"浏览器插件",label:"浏览器插件"}],Be=f(()=>{const e=Pt.value,t=ue.value.toLowerCase().trim(),a=t?e.filter(r=>r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)):e,n=new Map,s=new Set;for(const r of kt){const m=a.filter(d=>!s.has(d.value)&&d.label.startsWith(r.key)).map(d=>({value:d.value,label:d.label,shortLabel:d.label.startsWith(r.key+"-")?d.label.slice(r.key.length+1):d.label}));if(m.length>0){const d=n.get(r.label);d?d.items.push(...m):n.set(r.label,{label:r.label,items:m}),m.forEach(j=>s.add(j.value))}}const i=a.filter(r=>!s.has(r.value)).map(r=>({value:r.value,label:r.label,shortLabel:r.label}));return i.length>0&&n.set("其他",{label:"其他",items:i}),Array.from(n.values())}),Ct=e=>{o.value.scene=e;const t=pt(e,o.value.name);o.value.promptGroup=t.promptGroup,o.value.promptSubgroup=t.promptSubgroup,ae.value=!1,ue.value=""},Ot=f(()=>V.value.map(e=>({value:e.id,label:e.platformModelId||e.platformId?`${e.name} (${e.platformModelId||e.platformId})`:e.name??String(e.id)}))),L=f(()=>{const e=o.value.modelId;return e==null||e===""?null:V.value.find(t=>String(t.id)===String(e))||null}),wt=f(()=>!L.value||!L.value.supportThinking),Je=f(()=>{var e,t,a;return!!(o.value.enableThinking&&((e=L.value)!=null&&e.supportThinking)&&((t=L.value)!=null&&t.supportStructuredOutput)&&!((a=L.value)!=null&&a.supportStructuredOutputWhenThinking))}),Nt=f(()=>!o.value.modelId||!L.value?l("dashboard.llmPromptTemplateFormPage.reasoningNeedsModel"):L.value.supportThinking?Je.value?l("dashboard.llmPromptTemplateFormPage.reasoningStructuredFallback"):o.value.enableThinking?l("dashboard.llmPromptTemplateFormPage.reasoningEnabledHint"):l("dashboard.llmPromptTemplateFormPage.reasoningDisabledHint"):l("dashboard.llmPromptTemplateFormPage.reasoningUnsupported")),xe=new Set(["AI_VIDEO_MATERIAL_TIME_MATCH","AI_VIDEO_BACKGROUND_TIME_MATCH","AI_COPYWRITING_CONTENT_PACKAGING_COPY_ALIGN","AI_VIDEO_BASE_MATERIAL_COPY_ALIGN","AI_VIDEO_BASE_MATERIAL_INVALID_ID_RESELECT","AI_VIDEO_ASSIST_MATERIAL_COPY_ALIGN","AI_VIDEO_ASSIST_MATERIAL_INVALID_ID_RESELECT","AI_ASSET_LIBRARY_GENERATE_SYSTEM_DESCRIPTION","AI_ASSET_LIBRARY_GENERATE_INTERFACE_DESCRIPTION","AI_ASSET_LIBRARY_MATERIAL_CONTENT_PARSE","AI_ASSET_LIBRARY_VIDEO_VARIANT_PROMPT_GENERATE","AI_ASSET_LIBRARY_VIDEO_VARIANT_PARSE","AI_ASSET_LIBRARY_AUTO_TAGGING","AI_ASSET_LIBRARY_DESCRIBE_AND_AUTO_TAGGING_BATCH","AI_TERM_AUTO_CLASSIFY","AI_TERM_AUTO_CLASSIFY_IN_DOMAIN","PROMPT_TEMPLATE_OPTIMIZE_GENERATE_NEW","PROMPT_TEMPLATE_OPTIMIZE_REFINE","AI_QUICK_PREVIEW_BUSINESS_SUMMARY","AI_QUICK_PREVIEW_PROMPT_ENHANCE","AI_QUICK_PREVIEW_GENERATION_PROMPT","BROWSER_PLUGIN_TRANSLATE","AI_VIDEO_SUBTITLE_TRUNCATION","AI_VIDEO_SUBTITLE_TRUNCATION_BATCH","AI_VIDEO_AUTO_CROP_SEMANTIC_MATCH","AI_COPYWRITING_ORIGINAL_VOICE_MATERIAL","AI_COPYWRITING_GENERATE_SCENE_MATERIAL","AI_COPYWRITING_GENERATE_SCENE_MATERIAL_TAG_ROUTING","AI_COPYWRITING_GENERATE_SCENE_MATERIAL_CANDIDATE_SELECT","AI_SHORT_DRAMA_EPISODE_OUTLINE_GENERATION_ZH_CN","AI_SHORT_DRAMA_EPISODE_OUTLINE_GENERATION_EN","AI_SHORT_DRAMA_EPISODE_OUTLINE_REVIEW_ZH_CN","AI_SHORT_DRAMA_EPISODE_OUTLINE_REVISION_ZH_CN","AI_SHORT_DRAMA_EPISODE_SCRIPT_GENERATION_EN","AI_SHORT_DRAMA_EPISODE_SCRIPT_REVIEW_EN","AI_SHORT_DRAMA_EPISODE_SCRIPT_REVISION_EN","AI_SHORT_DRAMA_STORYBOARD_GENERATION_EN","AI_SHORT_DRAMA_STORYBOARD_REVIEW_EN","AI_SHORT_DRAMA_STORYBOARD_REVISION_EN","AI_SHORT_DRAMA_CODEX_REVIEW","AI_CONTENT_MONITOR_FRAME_BATCH_ANALYSIS","AI_CONTENT_MONITOR_FRAME_FINAL_ANALYSIS","AI_CONTENT_MONITOR_REWRITE_REFERENCE_REFINE","AI_CONTENT_REWRITE_STORY_STRUCTURE","AI_CONTENT_REWRITE_STORY_DETAIL","FLOW_PLAYBOOK_EDIT_PRE_SALE"]),Mt=f(()=>xe.has(String(o.value.scene||"").trim())),de=f(()=>Mt.value);function G(e){if(!e)return"";const t=hn(e,l,k);return Object.keys(t).length===0?"":JSON.stringify(t,null,2)}const Lt=new Set(["AI_IMAGE_TEXT_ORIGINAL_COPYWRITING","AI_IMAGE_TEXT_COPYWRITING_REWRITE"]);function Ft(e,t){var d;const a=String(e||"").trim();if(!Lt.has(a))return!1;const n=String(t||"").trim();if(!n)return!1;let s;try{s=JSON.parse(n)}catch{return!1}const i=s.required;if(!Array.isArray(i)||!i.includes("new_copy"))return!1;if(i.includes("image_modifications")||!i.includes("title")||!i.includes("cover_title"))return!0;const r=s.properties;return((d=r==null?void 0:r.cover_title)==null?void 0:d.type)==="string"}function zt(e,t){var rt;if(String(e||"").trim()!=="AI_IMAGE_TEXT_INTERLEAVED_ORIGINAL_COPYWRITING")return!1;const n=String(t||"").trim();if(!n)return!1;let s;try{s=JSON.parse(n)}catch{return!1}const i=s.required;if(Array.isArray(i)&&i.includes("article_html"))return!0;const r=s.properties;if(r&&"article_html"in r&&!("article_blocks"in r))return!0;const m=r==null?void 0:r.article_blocks,d=m==null?void 0:m.items,j=Array.isArray(d==null?void 0:d.oneOf)?d==null?void 0:d.oneOf:[];if(!j.length)return!0;const q=j.flatMap(re=>{var it,ct;const lt=(ct=(it=re==null?void 0:re.properties)==null?void 0:it.type)==null?void 0:ct.enum;return Array.isArray(lt)?lt.map(Ma=>String(Ma)):[]});return!["heading","paragraph","image","list","blockquote","divider"].every(re=>q.includes(re))||((rt=r==null?void 0:r.subtitle)==null?void 0:rt.type)!=="str
24ing"}function $e(e){if(!e)return;if(xe.has(e)){const a=G(e);a&&(o.value.responseJson=a);return}const t=String(o.value.responseJson||"").trim();if(!t){const a=G(e);a&&(o.value.responseJson=a);return}if(Ft(e,t)){const a=G(e);a&&(o.value.responseJson=a)}if(zt(e,t)){const a=G(e);a&&(o.value.responseJson=a)}}X(()=>o.value.scene,e=>{if(Ie.value){Ie.value=!1;return}o.value.responseJson=G(e),M.value=""}),X(A,()=>{const e=String(o.value.scene||"").trim();if(!e||!xe.has(e))return;const t=G(e);t&&(o.value.responseJson=t)});const Dt=vn,Se=e=>e?e.startsWith(ye)?e.slice(ye.length):e.startsWith(Tt)?e.slice(Tt.length):e:"",Ke=(e,t)=>{const a=Se(e);if(!a)return t;if(/^imageText\d+$/i.test(a)){const s=a.match(/^imageText(\d+)$/i),i=s?Number(s[1]):1;if(Number.isFinite(i)&&i>=1)return l("dashboard.llmPromptTemplateFormPage.imageTextNth",{n:i})}const n=`dashboard.promptPlaceholders.${a}`;return k(n)?l(n):t},Pe=e=>{if((e==null?void 0:e.id)!=null&&e.id!=="")return String(e.name||e.key||"");const t=String(e.rawKey||"").trim();return t?Ke(t,String(e.name||t)):String(e.name||e.key||"")},Vt=e=>e?e.startsWith(ye)?e:`${ye}${e}`:"",Ye=f(()=>g.category||"MARKET"),Ut=new Set(["inputJson","openingStatusEnum","licenseStatusEnum","periodTypeEnum","granularityEnum","weekdayEnum","categoryEnum","slotResultConfig","actions","kbList","o
24penSupportTickets","msgList","customerProfile","historyMsgList","followUpTasks","availableImmediateStrategies","activeFollowUpTasks","periodTypeEnums","granularityEnums","weekdayEnums","pricingContext","categoryList","issueContent","candidateTemplates","templateContent","triggerTypeCode","triggerTypeId","taskType","followupTemplateId"]),jt=(e,t)=>{if(!t)return!1;const a=Ut.has(t);return e==="PRE_SALE"?a:!a},Gt=f(()=>{var e;return!!g.lockScene||!g.templateId&&!!((e=g.initialData)!=null&&e.scene)}),Bt=f(()=>{const e={};return Object.entries(Dt).forEach(([t,a])=>{e[t]=a.map(n=>{const s=Se(String(n.key||""));return{...n,key:Vt(s),rawKey:s}}).filter(n=>jt(Ye.value,n.rawKey))}),e}),me=f(()=>{const e={};return Object.entries(Bt.value).forEach(([t,a])=>{e[t]=[...a]}),e}),Jt=f(()=>{A.value;const e=new Map;Object.values(me.value).forEach(t=>{t.forEach(a=>{const n=Pe(a);a!=null&&a.key&&e.set(a.key,n),a!=null&&a.rawKey&&e.set(a.rawKey,n)})});for(let t=1;t<=50;t+=1){const a=l("dashboard.llmPromptTemplateFormPage.imageTextNth",{n:t});e.set(`sys.imageText${t}`,a),e.set(`imageText${t}`,a)}return e}),W=E([]),$t=f(()=>W.value.filter(e=>e.enabled)),We=e=>e==="DOCUMENT"?"文档":e==="SLICE"?"切片":"素材",He=e=>e==="DOCUMENT"?"请参考以下文档内容,提取与当前任务相关的信息。":e==="SLICE"?"请参考以下切片字幕候选,按语义挑选可复用片段。":"请参考以下素材库候选信息,优先使用与当前任务匹配的内容。",Kt=(e,t)=>{const a=String(e||"").trim().toUpperCase();return a==="DOCUMENT"?"DOCUMENT":a==="SLICE"?"SLICE":t==="文档"?"DOCUMENT":t==="切片"?"SLICE":"ASSET"},Yt=f(()=>{const e=String(o.value.scene||"").trim();return e?_e(e):""}),Wt=f(()=>String(o.value.scene||"").trim()===_t),Ht=e=>{const t=new Set,a=/{{\s*([^{}]+?)\s*}}/g;let n;for(;n=a.exec(e||"");){const s=String(n[1]||"").trim();s&&t.add(s)}return Array.from(t)},qt=f(()=>Ht(o.value.content||"")),qe=f(()=>{const e=new Map,t=o.value.content||"",a=/{{\s*([^{}]+?)\s*}}/g;let n;for(;n=a.exec(t);){const s=n[1].trim();e.set(s,(e.get(s)||0)+1)}return e}),Xt=f(()=>{A.value;const e=[];if(Object.entries(me.value).forEach(([t,a])=>{(a||[]).forEach(n=>{const s=Pe(n),i=Se(String((n==null?void 0:n.rawKey)||(n==null?void 0:n.key)||"")),r=String((n==null?void 0:n.key)||i||"").trim();if(!i||!r)return;const m=An({rawKey:i,locale:A.value,category:t,label:s,customDescription:String((n==null?void 0:n.description)||""),sceneLabel:Yt.value}),d=(qe.value.get(r)||0)+(i!==r&&qe.value.get(i)||0);e.push({id:n==null?void 0:n.id,key:r,insertKey:r,rawKey:i,label:s,category:t,sectionKey:`${t}-${m.section}`,sectionLabel:m.section,description:m.description,sceneHint:m.sceneHint,example:m.example,count:d,searchText:m.searchText,interactionType:"default"})})}),Wt.value){const t=A.value.startsWith("zh");e.push({key:yt,insertKey:yt,rawKey:"aiVirtualAvatarId",label:"AI虚拟人像",category:"素材",sectionKey:"素材-ai-virtual-avatar",sectionLabel:t?"AI 素材库":"AI Asset Library",description:t?"点击后打开 AI 虚拟人像弹窗,选中后把对应虚拟人像 ID 直接插入到提示词中。":"Open the AI avatar picker and insert the selected avatar ID into the prompt.",sceneHint:t?"适合在 AI素材库 场景里把固定虚拟人像资产 ID 嵌入到模板正文。":"Use this to inject a fixed AI avatar asset ID into AI asset library prompts.",example:t?"示例值:avatar-luna":"Example value: avatar-luna",count:0,searchText:t?"AI虚拟人像 虚拟人像 avatar id 素材库":"AI avatar virtual human asset id",interactionType:"avatar-picker"})}return e.sort((t,a)=>{const n=x(t.category).localeCompare(x(a.category),A.value);return n!==0?n:t.label.localeCompare(a.label,A.value)})}),Zt=e=>{const t=te.value.trim().toLowerCase();return t?[e.label,e.rawKey,e.insertKey,e.sectionLabel,e.description,e.searchText].some(a=>String(a||"").toLowerCase().includes(t)):!0},Re=f(()=>Xt.value.filter(Zt)),Xe=e=>{if(!e)return{};if(typeof e=="object"&&!Array.isArray(e))return{...e};if(typeof e!="string")return{};const t=e.trim();if(!t||t==="null")return{};try{const a=JSON.parse(t);return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}catch{return{}}},K=e=>Array.isArray(e)?Array.from(new Set(e.map(t=>Number(t)).filter(t=>Number.isFinite(t)&&t>0))):[],ke=e=>Array.isArray(e)?Array.from(new Set(e.map(t=>
24String(t||"").trim()).filter(Boolean))):[],Ce=e=>Array.isArray(e)?e.map(t=>({conditions:(Array.isArray(t==null?void 0:t.conditions)?t.conditions:[]).map(s=>({field:["typeIds","tagDomainId","tagCategoryId","tagIds"].includes(s==null?void 0:s.field)?s.field:"typeIds",values:K(s==null?void 0:s.values),runtimeMode:(s==null?void 0:s.runtimeMode)==="FIXED_ONLY"?"FIXED_ONLY":"FOLLOW_RUNTIME"})).filter(s=>s.values.length>0),ignoreRuntimeTermFilters:(t==null?void 0:t.ignoreRuntimeTermFilters)===!0})).filter(t=>t.conditions.length>0):[],Qt=e=>{const t={typeIds:"FOLLOW_RUNTIME",tagDomainId:"FOLLOW_RUNTIME",tagCategoryId:"FOLLOW_RUNTIME",tagIds:"FOLLOW_RUNTIME"},a=e.flatMap(n=>n.conditions||[]);return Object.keys(t).forEach(n=>{const s=a.filter(i=>i.field===n&&i.values.length>0);s.length>0&&s.every(i=>i.runtimeMode==="FIXED_ONLY")&&(t[n]="FIXED_ONLY")}),t},ea=e=>{const t={};if(e.type==="DOCUMENT"){const n=ke(e.nameKeyword),s=K(e.documentCategoryId),i=K(e.tagIds);return n.length>0&&(t.nameKeyword=n),s.length>0&&(t.documentCategoryId=s),i.length>0&&(t.tagIds=i),JSON.stringify({filters:t})}const a=Ce(e.advancedAssetFilterGroups);return a.length>0&&(t.advancedTermFilter={enabled:!0,groups:a.map(n=>{const s={conditions:n.conditions.map(r=>({field:r.field,values:r.values,runtimeMode:r.runtimeMode}))};return(n.ignoreRuntimeTermFilters===!0||n.conditions.every(r=>r.runtimeMode==="FIXED_ONLY"))&&(s.ignoreRuntimeTermFilters=!0),s})},t.filterModeConfig=Qt(a)),(e.assetMediaType==="IMAGE"||e.assetMediaType==="VIDEO")&&(t.mediaType=e.assetMediaType),JSON.stringify({filters:t})},ta=e=>{if(!e||typeof e!="object")return null;const t=Kt(e.type,e.category);return{id:String(e.id||`ctx_${Date.now()}_${Math.random().toString(36).slice(2,8)}`),enabled:!0,type:t,instruction:He(t),placement:Et,limitSize:It,assetMediaType:e.assetMediaType==="IMAGE"||e.assetMediaType==="VIDEO"?e.assetMediaType:"",nameKeyword:t==="DOCUMENT"?ke(e.nameKeyword):[],documentCategoryId:K(e.documentCategoryId),tagIds:K(e.tagIds),advancedAssetFilterGroups:Ce(e.advancedAssetFilterGroups)}},Ze=()=>{const e=Xe(o.value.structuredInput),t=Array.isArray(e[Te])?e[Te]:[];W.value=t.map(ta).filter(a=>a!=null)},aa=()=>W.value.filter(e=>e.type).map(e=>({id:e.id,enabled:!0,type:e.type,instruction:He(e.type),placement:Et,limitSize:It,assetMediaType:e.assetMediaType||"",nameKeyword:e.type==="DOCUMENT"?ke(e.nameKeyword):[],documentCategoryId:K(e.documentCategoryId),tagIds:K(e.tagIds),advancedAssetFilterGroups:Ce(e.advancedAssetFilterGroups),filterConditions:ea(e)})),na=()=>{const e=Xe(o.value.structuredInput),t=String(o.value.scene||"").trim();t===_t?e.aiMaterialConfigType="AI_MATERIAL_TEMPLATE":t===Rs?e.aiMaterialConfigType="AI_MATERIAL_CONTENT_PARSE":(t===ks||t===Cs)&&(e.aiMaterialConfigType="AI_MATERIAL_VIDEO_VARIANT_PROMPT_GENERATE");const a=aa();return a.length>0?e[Te]=a:delete e[Te],Object.keys(e).length>0?JSON.stringify(e):null},sa=e=>{const t=e.filter(n=>n.enabled);if(t.length===0)return"";const a=["【上下文对象】"];return t.forEach((n,s)=>{a.push(""),a.push(`${s+1}. ${We(n.type)}`),n.instruction&&a.push(`使用说明:${n.instruction}`),a.push(`数据:[运行时注入${We(n.type)}筛选结果]`)}),a.join(`
25`)},oa=(e,t)=>{const n=["【输出要求】","## 输出要求","### 输出要求","输出要求:","输出格式:","【输出格式】"].map(i=>e.indexOf(i)).filter(i=>i>=0);if(n.length===0)return`${e}
26
27${t}`.trim();const s=Math.min(...n);return`${e.slice(0,s).trimEnd()}
28
29${t}
30
31${e.slice(s).trimStart()}`.trim()},ra=f(()=>{const e=String(o.value.content||"").trim(),t=sa($t.value);let a=e;return t&&(a=oa(a,t)),a||"暂无提示词内容"}),la=f(()=>{const e=new Set,t=[];return Object.values(me.value).forEach(a=>{(a||[]).forEach(n=>{const s=String((n==null?void 0:n.key)||(n==null?void 0:n.rawKey)||"").trim();!s||e.has(s)||(e.add(s),t.push({key:s,name:Pe(n)}))})}),t}),F=E(null),ne=E(null),se=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]||t),ia=e=>{for(const[t,a]of Object.entries(me.value))if(a.some(n=>n.key===e||n.rawKey===e))return t;return"系统默认"},ca=e=>e==="素材"?"background: #ecfdf5; border-color: #a7f3d0; color: #059669;":e==="切片"?"background: #ecfeff; border-color: #a5f3fc; color: #0891b2;":e==="文档"?"background: #eff6ff; border-color: #bfdbfe; color: #2563eb;":e==="筛选条件"?"background: #fff7ed; border-color: #fed7aa; color: #ea580c;":"background: #f1f5f9; border-color: #e2e8f0; color: #475569;",ua=e=>e==="素材"?"background: #059669;":e==="切片"?"background: #0891b2;":e==="文档"?"background: #2563eb;":e==="筛选条件"?"background: #ea580c;":"background: #475569;",B=()=>{const e=U.value;if(!e)return;const t=o.value.content||"",a=/{{\s*([^{}]+?)\s*}}/g;let n=0,s="",i;for(;i=a.exec(t);){const m=t.slice(n,i.index);m&&(s+=se(m).replace(/\n/g,"<br/>"));const d=i[1].trim(),j=Jt.value.get(d)||Ke(d,d),q=ia(d);s+=`<span class="placeholder-tag" style="${ca(q)}" data-placeholder-key="${se(d)}" contenteditable="false"><span class="placeholder-name">${se(j)}</span><span class="placeholder-remove" style="${ua(q)}">×</span></span>`,n=i.index+i[0].length}const r=t.slice(n);r&&(s+=se(r).replace(/\n/g,"<br/>")),e.innerHTML=s||""},pe=()=>{const e=U.value;if(!e)return null;const t=window.getSelection();if(!t||t.rangeCount===0)return null;const a=t.getRangeAt(0);if(!e.contains(a.startContainer))return null;const n=a.cloneRange();return n.selectNodeContents(e),n.setEnd(a.startContainer,a.startOffset),Ve(n.cloneContents(),!1).length},Qe=()=>{const e=U.value;return e?Ve(e):""},da=e=>Ve(e),fe=()=>{o.value.content=Qe()},ma=async(e,t)=>{await w();const a=o.value.content||"",n=t??pe()??F.value??a.length,s=`{{${e}}}`;o.value.content=a.slice(0,n)+s+a.slice(n),B(),await w();const i=n+s.length;return oe(i),F.value=i,ne.value=null,i},pa=async(e,t)=>{await w();const a=o.value.content||"",n=t??pe()??F.value??a.length;o.value.content=a.slice(0,n)+e+a.slice(n),B(),await w();const s=n+e.length;return oe(s),F.value=s,ne.value=null,s},fa=()=>{be.value=!0},ha=async e=>{o.value.content=e,await w(),B(),await w(),oe((o.value.content||"").length),P.success(l("dashboard.llmPromptTemplateFormPage.optimizeApplied"))},ga=async e=>{var a;if(e.interactionType==="avatar-picker"){Ae.value=!0;return}const t=await ma(e.insertKey,ne.value??F.value);await w(),(a=U.value)==null||a.focus(),oe(t)},va=async e=>{var n;const t=String(e||"").trim();if(!t)return;je.value=t;
31const a=await pa(t,ne.value??F.value);await w(),(n=U.value)==null||n.focus(),oe(a)},H=()=>{const e=pe();e!=null&&(F.value=e)},_a=()=>{H(),ne.value=F.value??Qe().length},ya=()=>{fe(),H()},Ta=()=>{H(),fe(),B()},Ea=e=>{const t=e.target;if(t)if(t.classList.contains("placeholder-remove")){const a=t.closest(".placeholder-tag");a&&(a.remove(),fe())}else H()},Ia=()=>{H()},ba=()=>{H()},et=(e,t)=>{const a=da(t.cloneContents());e.setData("text/plain",a);const n=se(a).replace(/\n/g,"<br/>");e.setData("text/html",`<div>${n}</div>`)},Aa=e=>{const t=U.value,a=e.clipboardData;if(!t||!a)return;const n=window.getSelection();if(!n||n.rangeCount===0)return;const s=n.getRangeAt(0);s.collapsed||t.contains(s.commonAncestorContainer)&&(e.preventDefault(),et(a,s))},xa=async e=>{const t=U.value,a=e.clipboardData;if(!t||!a)return;const n=window.getSelection();if(!n||n.rangeCount===0)return;const s=n.getRangeAt(0);s.collapsed||t.contains(s.commonAncestorContainer)&&(e.preventDefault(),et(a,s),s.deleteContents(),fe(),await w(),B(),await w(),F.value=pe())},oe=e=>{const t=U.value;if(!t)return;const a=window.getSelection();if(!a)return;const n=document.createRange();let s=e,i=!1;const r=m=>{var we;if(i)return;if(m.nodeType===Node.TEXT_NODE){const J=((we=m.textContent)==null?void 0:we.length)??0;if(s<=J){n.setStart(m,s),n.collapse(!0),i=!0;return}s-=J;return}if(m.nodeType!==Node.ELEMENT_NODE)return;const d=m,j=d.dataset.placeholderKey;if(j){const J=`{{${j}}}`.length;if(s<=J){n.setStartAfter(d),n.collapse(!0),i=!0;return}s-=J;return}if(d.tagName==="BR"){if(s<=1){n.setStartAfter(d),n.collapse(!0),i=!0;return}s-=1;return}const q=d.tagName==="DIV"||d.tagName==="P";if(d.childNodes.forEach(J=>r(J)),!i&&q){if(s<=1){n.setStartAfter(d),n.collapse(!0),i=!0;return}s-=1}};t.childNodes.forEach(m=>r(m)),i||(n.selectNodeContents(t),n.collapse(!1)),a.removeAllRanges(),a.addRange(n),F.value=e},Oe=()=>{if(!o.value.responseJson){M.value="";return}try{const e=JSON.parse(o.value.responseJson);o.value.responseJson=JSON.stringify(e,null,2),M.value=""}catch{M.value=l("dashboard.llmPromptTemplateFormPage.jsonInvalid")}},tt=()=>{if(!o.value.responseJson)return M.value="",!0;try{return JSON.parse(o.value.responseJson),M.value="",!0}catch{return M.value=l("dashboard.llmPromptTemplateFormPage.jsonInvalid"),!1}},Sa=()=>{if(o.value.responseJson)try{const e=JSON.parse(o.value.responseJson);o.value.responseJson=JSON.stringify(e)}catch{}},Pa=()=>{ee.value=!0},Ra=e=>{if(!e||e.length===0)return;const t=e.map(s=>({id:s.id,name:s.name||s.fileName||"",fileName:s.name||s.fileName||"",url:s.url||s.path||"",path:s.url||s.path||"",fileId:s.fileId||"",status:"done",originalDoc:s})),a=I.value.map(s=>s.id).filter(Boolean),n=t.filter(s=>s.id&&!a.includes(s.id));n.length>0?(I.value.push(...n),o.value.documentIds=I.value.map(s=>s.id).filter(Boolean),P.success(l("dashboard.llmPromptTemplateFormPage.docsAdded",{n:n.length}))):t.length>0&&P.warning(l("dashboard.llmPromptTemplateFormPage.docsExist")),ee.value=!1},ka=()=>{ee.value=!1},Ca=e=>{var n;if(!e)return gt;const t=(n=e.split(".").pop())==null?void 0:n.toLowerCase();return(t?{pdf:Z,doc:Z,docx:Z,txt:Z,md:Z,xls:Le,xlsx:Le,csv:Le,ppt:vt,pptx:vt,png:Q,jpg:Q,jpeg:Q,gif:Q,webp:Q,svg:Q,js:D,ts:D,html:D,css:D,json:D,py:D,java:D,c:D,cpp:D,go:D,zip:ie,rar:ie,"7z":ie,tar:ie,gz:ie,mp3:Fe,wav:Fe,ogg:Fe,mp4:ze,mov:ze,avi:ze}[t]:void 0)||gt},Oa=(e,t)=>{t>=0&&t<I.value.length&&(I.value.splice(t,1),o.value.documentIds=I.value.map(a=>a.id).filter(Boolean))},wa=async e=>{var t;try{const a=await $a(e,C.value);if(a.data&&a.data.code===0&&a.data.data){Ie.value=!0,Object.assign(o.value,Ue(a.data.data)),Ze();{const n=String(o.value.scene||"").trim();$e(n)}if(o.value.documentIds&&Array.isArray(o.value.documentIds)&&o.value.documentIds.length>0){const{batchGetDocuments:n}=await La(()=>import("./document-d3d35d4d.js"),["assets/document-d3d35d4d.js","assets/base-dd5e669f.js","assets/head-ed4e7f32.js","assets/head-1783e53e.css"]);try{const s=await n(o.value.documentIds);if(s.data&&(s.data.code===0||s.data.code===200)&&s.data.data){const i=s.data.data.documents||[];I.value=i.map(r=>({id:r.id,name:r.name||"",fileName:r.name||"",url:r.url||"",path:r.url||"",fileId:r.fileId||"",status:"done",originalDoc:r}))}else I.value=[]}catch{I.value=[]}}else I.value=[];
31if(w(()=>{Oe(),B()}),g.copyAsNew){o.value.id=void 0;const n=String(o.value.name||"").trim(),s="(副本)",i=n.includes(s)||n.includes(" (copy)")||n.includes(" (Copy)");o.value.name=i?n:`${n||l("dashboard.llmPromptTemplateFormPage.defaultTplName")}${l("dashboard.llmPromptTemplateFormPage.copySuffix")}`}}else P.error(((t=a.data)==null?void 0:t.msg)||l("dashboard.llmPromptTemplateFormPage.msgLoadFail"))}catch{P.error(l("dashboard.llmPromptTemplateFormPage.msgLoadFail"))}};X(()=>o.value.responseJson,()=>{o.value.responseJson?tt():M.value=""});async function Na(){var t,a;if(!o.value.name){P.error(l("dashboard.llmPromptTemplateFormPage.errTplName"));return}if(!o.value.modelId){P.error(l("dashboard.llmPromptTemplateFormPage.errModel"));return}if(o.value.enableThinking&&(!L.value||!L.value.supportThinking)){P.error(l("dashboard.llmPromptTemplateFormPage.errReasoningUnsupported")),o.value.enableThinking=!1;return}if(!o.value.scene){P.error(l("dashboard.llmPromptTemplateFormPage.errScene"));return}if(R.value&&(!o.value.promptGroup||!o.value.promptSubgroup)){P.error("请选择一级业务分类和二级流程环节");return}if(!o.value.content){P.error(l("dashboard.llmPromptTemplateFormPage.errContent"));return}if(o.value.responseJson&&!tt()){P.error(l("dashboard.llmPromptTemplateFormPage.errJson"));return}const e=String(o.value.scene||"").trim();if(de.value)o.value.responseJson=G(e);else if(!String(o.value.responseJson||"").trim()){const n=G(e);n&&(o.value.responseJson=n)}Sa(),O.value=!0;try{const n=g.category||"MARKET",s={...o.value,category:n,structuredInput:na()};if(S.value&&(s.appRegion=S.value),o.value.id){const i=await Ga(s,C.value);i.data&&i.data.code===0?(P.success(l("dashboard.llmPromptTemplateFormPage.updateOk")),N("saved",i.data.data??s)):P.error(((t=i.data)==null?void 0:t.msg)||l("dashboard.llmPromptTemplateFormPage.updateFail"))}else{const i=await Ba(s,C.value);if(i.data&&i.data.code===0){P.success(l("dashboard.llmPromptTemplateFormPage.addOk"));const r=i.data.data??{id:i.data.id,name:o.value.name,...s};N("saved",r)}else P.error(((a=i.data)==null?void 0:a.msg)||l("dashboard.llmPromptTemplateFormPage.addFail"))}}catch(n){P.error((n==null?void 0:n.message)||l("dashboard.llmPromptTemplateFormPage.saveFail"))}finally{O.value=!1}}const at=async()=>{var e;try{const t=await Ja({page:0,size:200,status:1},C.value);t.data&&t.data.code===0&&(V.value=Array.isArray((e=t.data.data)==null?void 0:e.content)?t.data.data.content.map(a=>bt(a)):[])}catch{V.value=[]}};function nt(){o.value={id:void 0,name:"",scene:"",promptGroup:"",promptSubgroup:"",modelId:void 0,content:"",status:!0,responseJson:"",documentIds:[],enableThinking:!1,structuredInput:""},I.value=[],W.value=[],M.value=""}const st=E(!1);async function ot(){var t;const e=g.templateId??((t=g.initialData)==null?void 0:t.id);if(e!=null&&e!=="")await wa(String(e));else if(g.initialData&&Object.keys(g.initialData).length>0){Object.assign(o.value,Ue(g.initialData)),Ze();{const a=String(o.value.scene||"").trim();$e(a)}w(()=>{Oe(),B()})}else w(()=>B())}return Da(async()=>{typeof window<"u"&&window.addEventListener(dt,()=>{$.value+=1}),await Ya(),await at(),await Ge.ensureLoaded().catch(()=>{}),await ot(),st.value=!0}),X(()=>[g.templateId,g.copyAsNew,S.value],async()=>{st.value&&(nt(),await w(),await at(),await ot())}),Va(()=>{typeof window<"u"&&window.removeEventListener(dt,()=>{})}),X(L,e=>{e!=null&&e.supportThinking||o.value.enableThinking&&(o.value.enableThinking=!1)},{immediate:!0}),T({submit:Na,submitting:O,resetForm:nt,form:o}),(e,t)=>{const a=un,n=dn,s=ln,i=cn;return y(),b("div",xn,[p(s,{model:o.value,layout:"vertical",class:"modern-form"},{default:z(()=>[c("div",Sn,[p(a,{label:u(l)("dashboard.llmPromptTemplateFormPage.tplName"),name:"name",rules:[{required:!0,message:u(l)("dashboard.llmPromptTemplateFormPage.tplNameRequired")}]},{default:z(()=>[p(le,{modelValue:o.value.name,"onUpdate:modelValue":t[0]||(t[0]=r=>o.value.name=r),placeholder:u(l)("dashboard.llmPromptTemplateFormPage.phTplName"),class:"modern-input"},null,8,["modelValue","placeholder"])]),_:1},8,["label","rules"]),p(a,{label:u(l)("dashboard.llmPromptTemplateFormPage.bindModel"),name:"modelId",rules:[{required:!0,message:u(l)("dashboard.llmPromptTemplateFormPage.bindModelRequired")}]},{default:z(()=>[p(Me,{modelValue:o.value.modelId,"onUpdate:modelValue":t[1]||(t[1]=r=>o.value.modelId=r),placeholder:u(l)("dashboard.llmPromptTemplateFormPage.phBindModel"),class:"modern-select",options:Ot.value,"allow-clear":"","show-search":"","append-to-body":""},null,8,["modelValue","placeholder","options"])]),_:1},8,["label","rules"]),p(a,{label:u(l)("dashboard.llmPromptTemplateFormPage.scene"),name:"scene",rules:[{required:!0,message:u(l)("dashboard.llmPromptTemplateFormPage.sceneRequired")}]},{default:z(()=>[Gt.value?(y(),he(le,{key:1,"model-value":o.value.scene?u(_e)(o.value.scene):o.value.scene,disabled:"",class:"modern-input bg-slate-50"},null,8,["model-value"])):(y(),b("div",Pn,[p(le,{"model-value":o.value.scene?u(_e)(o.value.scene):"",readonly:"",placeholder:u(l)("dashboard.llmPromptTemplateFormPage.phScene"),class:"modern-input flex-1 cursor-pointer !bg-slate-50",onClick:t[2]||(t[2]=r=>ae.value=!0)},null,8,["model-value","placeholder"]),c("button",{type:"button",class:"flex-shrink-0 px-3 py-1.5 rounded-lg border border-slate-200 text-sm text-slate-600 hover:bg-slate-50 hover:border-emerald-300 hover:text-emerald-600 transition-all whitespace-nowrap",onClick:t[3]||(t[3]=r=>ae.value=!0)}," 选择场景 ")]))]),_:1},8,["label","rules"]),R.value?(y(),he(a,{key:0,label:"一级业务分类",name:"promptGroup",rules:[{required:!0,message:"请选择一级业务分类"}]},{default:z(()=>[p(Me,{modelValue:o.value.promptGroup,"onUpdate:modelValue":t[4]||(t[4]=r=>o.value.promptGroup=r),placeholder:"选择短剧、混剪、萌宠等业务",class:"modern-select",options:u(At),"append-to-body":""},null,8,["modelValue","options"])]),_:1})):Y("",!0),R.value?(y(),he(a,{key:1,label:"二级流程环节",name:"promptSubgroup",rules:[{required:!0,message:"请选择二级流程环节"}]},{default:z(()=>[p(Me,{modelValue:o.value.promptSubgroup,"onUpdate:modelValue":t[5]||(t[5]=r=>o.value.promptSubgroup=r),placeholder:"选择故事核、商业创意等环节",class:"modern-select",options:xt.value,"append-to-body":""},null,8,["modelValue","options"])]),_:1})):Y("",!0)]),c("div",Rn,[c("div",kn,[c("div",Cn,[c("div",On,_(u(l)("dashboard.llmPromptTemplateFormPage.reasoningMode")),1),c("p",wn,_(u(l)("dashboard.llmPromptTemplateFormPage.reasoningModeDesc")),1
31)]),p(n,{checked:o.value.enableThinking,"onUpdate:checked":t[6]||(t[6]=r=>o.value.enableThinking=r),"checked-children":u(l)("dashboard.llmPromptTemplateFormPage.switchOn"),"un-checked-children":u(l)("dashboard.llmPromptTemplateFormPage.switchOff"),disabled:wt.value},null,8,["checked","checked-children","un-checked-children","disabled"])]),c("div",{class:Ne(["mt-3 rounded-xl border px-3 py-2 text-xs leading-5",Je.value?"border-amber-200 bg-amber-50 text-amber-700":o.value.enableThinking?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-slate-200 bg-white text-slate-500"])},_(Nt.value),3)]),p(a,{label:u(l)("dashboard.llmPromptTemplateFormPage.content"),name:"content",rules:[{required:!0,message:u(l)("dashboard.llmPromptTemplateFormPage.contentRequired")}]},{default:z(()=>[c("div",Nn,[c("div",null,[c("div",Mn,_(u(l)("dashboard.llmPromptTemplateFormPage.optimizeTitle")),1),c("p",Ln,_(u(l)("dashboard.llmPromptTemplateFormPage.optimizeDesc")),1)]),c("button",{type:"button",class:"inline-flex items-center gap-2 rounded-lg bg-emerald-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-emerald-700",onClick:fa},[p(u(sn),{size:16}),ut(" "+_(u(l)("dashboard.llmPromptTemplateFormPage.optimizeBtn")),1)])]),c("div",Fn,[c("div",zn,[c("div",Dn,[c("div",{ref_key:"contentEditorRef",ref:U,class:"prompt-content-editor min-h-[500px] p-4 bg-white rounded-lg focus:outline-none focus:ring-2 focus:ring-emerald-500/10 transition-all",contenteditable:"true","data-placeholder":u(l)("dashboard.llmPromptTemplateFormPage.editorPh"),onInput:ya,onCopy:Aa,onCut:xa,onBlur:Ta,onClick:Ea,onKeyup:Ia,onMouseup:ba}
31,null,40,Vn)]),c("aside",Un,[c("div",jn,[c("div",Gn,[c("div",null,[c("div",Bn,_(u(l)("dashboard.llmPromptTemplateFormPage.insertPh")),1),t[17]||(t[17]=c("p",{class:"mt-0.5 text-[11px] text-slate-500"},"点击名称插入到当前光标",-1))]),c("span",Jn,_(Re.value.length),1)]),c("div",$n,[p(u(ft),{size:13,class:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),p(le,{modelValue:te.value,"onUpdate:modelValue":t[7]||(t[7]=r=>te.value=r),placeholder:u(l)("dashboard.llmPromptTemplateFormPage.phSearchPh"),class:"modern-input placeholder-side-search pl-8 pr-8 text-xs"},null,8,["modelValue","placeholder"]),te.value?(y(),b("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600",onClick:t[8]||(t[8]=r=>te.value="")},[p(u(ht),{size:12})])):Y("",!0)])]),c("div",Kn,[Re.value.length>0?(y(!0),b(ge,{key:0},ve(Re.value,r=>(y(),b("button",{key:`side-ph-${r.key}`,type:"button",class:"placeholder-side-item",onMousedown:Ua(_a,["prevent"]),onClick:m=>ga(r)},[c("span",Wn,_(r.label),1),r.count>0?(y(),b("span",Hn,_(r.count),1)):Y("",!0)],40,Yn))),128)):(y(),b("div",qn,_(u(l)("dashboard.llmPromptTemplateFormPage.noPlaceholderMatch")),1))])])])]),p(Qa,{modelValue:W.value,"onUpdate:modelValue":t[9]||(t[9]=r=>W.value=r),class:"mt-4","final-prompt-preview":ra.value},null,8,["modelValue","final-prompt-preview"])]),_:1},8,["label","rules"]),p(a,{label:u(l)("dashboard.llmPromptTemplateFormPage.tplDocs"),name:"documentIds"},{default:z(()=>[c("div",Xn,[c("div",Zn,[c("div",Qn,[c("span",es,_(u(l)("dashboard.llmPromptTemplateFormPage.docHint")),1),I.value.length>0?(y(),b("span",ts,_(I.value.length),1)):Y("",!0)]),c("button",{onClick:Pa,class:"flex items-center gap-1.5 text-emerald-600 hover:text-emerald-700 transition-colors text-xs font-medium"},[p(u(Z),{size:14}),c("span",null,_(u(l)("dashboard.llmPromptTemplateFormPage.pickFromLibrary")),1)])]),c("div",as,[I.value.length===0?(y(),b("div",ns,[p(u(on),{size:32,class:"mb-2 opacity-20"}),c("p",ss,_(u(l)("dashboard.llmPromptTemplateFormPage.noDocs")),1)])):(y(),b("div",os,[(y(!0),b(ge,null,ve(I.value,(r,m)=>(y(),b("div",{key:r.id||m,class:"flex items-center justify-between p-3 bg-white border border-slate-100 rounded-lg shadow-sm group hover:border-emerald-200 transition-all"},[c("div",rs,[c("div",ls,[(y(),he(ja(Ca(r.name||r.fileName)),{size:16,class:"text-slate-400 group-hover:text-emerald-500"}))]),c("div",is,[c("p",{class:"text-xs font-medium text-slate-700 truncate",title:r.name||r.fileName},_(r.name||r.fileName),9,cs),c("p",us,_(u(l)("dashboard.llmPromptTemplateFormPage.selected")),1)])]),c("button",{onClick:d=>Oa(r,m),class:"p-1.5 text-slate-300 hover:text-red-500 hover:bg-red-50 rounded-md transition-all"},[p(u(ht),{size:14})],8,ds)]))),128))]))])])]),_:1},8,["label"]),p(a,{label:u(l)("dashboard.llmPromptTemplateFormPage.responseJson"),name:"responseJson"},{default:z(()=>[c("div",ms,[c("div",ps,[c("span",fs,_(de.value?u(l)("dashboard.llmPromptTemplateFormPage.jsonHintSystem"):u(l)("dashboard.llmPromptTemplateFormPage.jsonHintEditable")),1),c("button",{class:"flex items-center gap-1.5 text-slate-600 hover:text-slate-900 transition-colors text-xs font-medium flex-shrink-0 whitespace-nowrap",onClick:Oe},[p(u(pn),{size:14}),c("span",null,_(u(l)("dashboard.llmPromptTemplateFormPage.formatJson")),1)])]),p(Xa,{modelValue:o.value.responseJson,"onUpdate:modelValue":t[10]||(t[10]=r=>o.value.responseJson=r),rows:12,readonly:de.value,placeholder:de.value?u(l)("dashboard.llmPromptTemplateFormPage.jsonPhSystem"):u(l)("dashboard.llmPromptTemplateFormPage.jsonPhEditable"),class:"modern-textarea !border-none !rounded-none !bg-slate-50/50 !p-4 !font-mono !text-sm !shadow-none focus-visible:!ring-0"},null,8,["modelValue","readonly","placeholder"])]),M.value?(y(),b("div",hs,[p(u(rn),{size:14}),ut(" "+_(M.value),1)])):Y("",!0)]),_:1},8,["label"]),c("div",gs,[c("div",vs,[c("span",_s,_(u(l)("dashboard.llmPromptTemplateFormPage.statusLabel")),1),c("span",ys,_(u(l)("dashboard.llmPromptTemplateFormPage.statusDesc")),1
31)]),p(n,{checked:o.value.status,"onUpdate:checked":t[11]||(t[11]=r=>o.value.status=r),"checked-children":u(l)("dashboard.llmPromptTemplateFormPage.switchOn"),"un-checked-children":u(l)("dashboard.llmPromptTemplateFormPage.switchOff")},null,8,["checked","checked-children","un-checked-children"])])]),_:1},8,["model"]),p(Za,{visible:ee.value,"onUpdate:visible":t[12]||(t[12]=r=>ee.value=r),multiple:!0,"selected-ids":[],onConfirm:Ra,onCancel:ka},null,8,["visible"]),p(en,{open:be.value,scene:o.value.scene,category:Ye.value,"current-content":o.value.content,"response-json":o.value.responseJson,"preserve-placeholder-keys":qt.value,"available-placeholders":la.value,"app-region":S.value,"onUpdate:open":t[13]||(t[13]=r=>be.value=r),onApply:ha},null,8,["open","scene","category","current-content","response-json","preserve-placeholder-keys","available-placeholders","app-region"]),p(i,{visible:ae.value,"onUpdate:visible":t[15]||(t[15]=r=>ae.value=r),title:"选择业务场景",width:1300,footer:null,destroyOnClose:!0},{default:z(()=>[c("div",Ts,[c("div",Es,[p(u(ft),{size:14,class:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),p(le,{modelValue:ue.value,"onUpdate:modelValue":t[14]||(t[14]=r=>ue.value=r),placeholder:"搜索场景...",class:"modern-input pl-8"},null,8,["modelValue"])])]),c("div",Is,[(y(!0),b(ge,null,ve(Be.value,r=>(y(),b("div",{key:r.label},[c("div",bs,_(r.label),1),c("div",As,[(y(!0),b(ge,null,ve(r.items,m=>(y(),b("button",{key:m.value,type:"button",class:Ne(["flex flex-col items-start px-3 py-2 rounded-lg border text-left transition-all",o.value.scene===m.value?"bg-emerald-600 text-white border-emerald-600 shadow-sm":"border-slate-200 text-slate-700 hover:border-emerald-300 hover:text-emerald-600 hover:bg-emerald-50"]),onClick:d=>Ct(m.value)},[c("span",Ss,_(m.shortLabel),1),c("span",{class:Ne(["text-[10px] font-mono leading-snug mt-0.5",o.value.scene===m.value?"text-emerald-100":"text-slate-400"])},_(m.value),3)],10,xs))),128))])]))),128)),Be.value.length===0?(y(),b("div",Ps," 未找到匹配的场景 ")):Y("",!0)])]),_:1},8,["visible"]),p(an,{open:Ae.value,avatars:Rt.value,"selected-id":je.value,title:"选择AI虚拟人像",description:"选中后会把虚拟人像 ID 直接插入到当前提示词光标位置。","onUpdate:open":t[16]||(t[16]=r=>Ae.value=r),onSelect:va},null,8,["open","avatars","selected-id"])])}}});const ws=mn(Os,[["__scopeId","data-v-ca064bcf"]]),io=Object.freeze(Object.defineProperty({__proto__:null,default:ws},Symbol.toStringTag,{value:"Module"}));export{ws as L,io as a,hn as g};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.