(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-260f027d"],{"30db":function(e,t,a){"use strict";a("5c85")},"51eba":function(e,t,a){"use strict";a.r(t);var r=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("div",{staticClass:"header"},[a("h2",[a("span",[e._v(e._s("add"==e.type?"新增":"edit"==e.type?"编辑":"查看"))]),e._v("应用 ")])]),"add"==e.type?a("div",{staticClass:"center"},[a("el-form",{ref:"AIformRef",staticClass:"demo-form-inline",staticStyle:{"margin-top":"15px","margin-left":"50px"},attrs:{inline:!0,model:e.AIform,rules:e.rules,"label-position":"top","label-width":"90px"}},[a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"应用名称:",prop:"chat_name"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{placeholder:"请输入应用名称"},model:{value:e.AIform.chat_name,callback:function(t){e.$set(e.AIform,"chat_name",t)},expression:"AIform.chat_name"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"应用类型:",prop:"application_type"}},[a("el-select",{staticStyle:{width:"55%"},attrs:{placeholder:"应用类型",clearable:""},model:{value:e.AIform.application_type,callback:function(t){e.$set(e.AIform,"application_type",t)},expression:"AIform.application_type"}},e._l(e.appTypeList,(function(e,t){return a("el-option",{key:t,attrs:{label:e.label,value:e.value}})})),1)],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"模型名称:",prop:"model_name"}},[a("el-select",{staticStyle:{width:"55%"},attrs:{placeholder:"请输入选择",clearable:""},model:{value:e.AIform.model_name,callback:function(t){e.$set(e.AIform,"model_name",t)},expression:"AIform.model_name"}},e._l(e.modelNameList,(function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.name}})})),1)],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"知识库:",prop:"knowledge_base_names"}},[a("el-select",{staticStyle:{width:"55%"},attrs:{multiple:"",placeholder:"请选择知识库",clearable:"",filterable:""},on:{change:e.handleKnowledgeBaseChange},model:{value:e.AIform.knowledge_base_names,callback:function(t){e.$set(e.AIform,"knowledge_base_names",t)},expression:"AIform.knowledge_base_names"}},e._l(e.kneList,(function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.id}})})),1)],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"文档目录:",prop:"document_directories"}},[a("el-select",{staticStyle:{width:"55%"},attrs:{placeholder:"请选择文档目录",disabled:!e.AIform.knowledge_base_names.length,clearable:"",filterable:""},on:{change:e.handleDirectoryChange},model:{value:e.AIform.document_directories,callback:function(t){e.$set(e.AIform,"document_directories",t)},expression:"AIform.document_directories"}},e._l(e.directoryList,(function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.id}})})),1)],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"文 档:",prop:"documents"}},[a("el-select",{staticStyle:{width:"55%"},attrs:{multiple:"",placeholder:"请选择文档",disabled:e.isDocumentSelectDisabled,clearable:"",filterable:""},on:{change:e.handleDocumentChange},model:{value:e.AIform.documents,callback:function(t){e.$set(e.AIform,"documents",t)},expression:"AIform.documents"}},[a("el-option",{attrs:{label:"全部",value:"all"}}),e._l(e.documentList,(function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.id}})}))],2)],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"应用图标:"}},[a("el-upload",{staticClass:"avatar-uploader",attrs:{action:e.uploadUrl,method:"post",data:e.params,"show-file-list":!1,"on-success":e.onUploadAddSuccess}},[null!=e.AIform.aiagent_icon&&""!=e.AIform.aiagent_icon?a("img",{staticClass:"avatar",attrs:{src:e.AIform.aiagent_icon}}):a("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"描 述:"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{placeholder:"请输入描述",type:"textarea"},model:{value:e.AIform.role_description,callback:function(t){e.$set(e.AIform,"role_description",t)},expression:"AIform.role_description"}})],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"温度:",prop:"temperature"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{min:0,max:1,step:.1},model:{value:e.AIform.temperature,callback:function(t){e.$set(e.AIform,"temperature",t)},expression:"AIform.temperature"}}),a("el-input-number",{attrs:{min:0,max:1},model:{value:e.AIform.temperature,callback:function(t){e.$set(e.AIform,"temperature",t)},expression:"AIform.temperature"}})],1),a("div",{staticClass:"hint"},[e._v("控制生成文本的随机性,0为最保守,1为最创新")])])],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"最大token数:",prop:"max_tokens"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{min:1,max:4096,step:1},model:{value:e.AIform.max_tokens,callback:function(t){e.$set(e.AIform,"max_tokens",t)},expression:"AIform.max_tokens"}}),a("el-input-number",{attrs:{min:0,max:4096,step:1},model:{value:e.AIform.max_tokens,callback:function(t){e.$set(e.AIform,"max_tokens",t)},expression:"AIform.max_tokens"}})],1),a("div",{staticClass:"hint"},[e._v("限制生成文本的最大长度")])])],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"核采样参数:",prop:"top_p"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{min:0,max:1,step:.1},model:{value:e.AIform.top_p,callback:function(t){e.$set(e.AIform,"top_p",t)},expression:"AIform.top_p"}}),a("el-input-number",{attrs:{min:0,max:1,step:.1},model:{value:e.AIform.top_p,callback:function(t){e.$set(e.AIform,"top_p",t)},expression:"AIform.top_p"}})],1),a("div",{staticClass:"hint"},[e._v("控制词汇多样性,1为考虑所有可能性")])])],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"重复内容惩罚:",prop:"frequency_penalty"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{min:-2,max:2,step:.1},model:{value:e.AIform.frequency_penalty,callback:function(t){e.$set(e.AIform,"frequency_penalty",t)},expression:"AIform.frequency_penalty"}}),a("el-input-number",{attrs:{min:-2,max:2,step:.1},model:{value:e.AIform.frequency_penalty,callback:function(t){e.$set(e.AIform,"frequency_penalty",t)},expression:"AIform.frequency_penalty"}})],1),a("div",{staticClass:"hint"},[e._v("防止重复,正值减少重复,负值增加重复")])])],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"新话题偏好:",prop:"presence_penalty"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{min:-2,max:2,step:.1},model:{value:e.AIform.presence_penalty,callback:function(t){e.$set(e.AIform,"presence_penalty",t)},expression:"AIform.presence_penalty"}}),a("el-input-number",{attrs:{min:-2,max:2,step:.1},model:{value:e.AIform.presence_penalty,callback:function(t){e.$set(e.AIform,"presence_penalty",t)},expression:"AIform.presence_penalty"}})],1),a("div",{staticClass:"hint"},[e._v("正值鼓励新话题,负值保持话题一致性")])])],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"响应格式:",prop:"response_format"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{placeholder:"text"},model:{value:e.AIform.response_format,callback:function(t){e.$set(e.AIform,"response_format",t)},expression:"AIform.response_format"}}),a("div",{staticClass:"hint"},[e._v("指定AI响应的格式,如text, json等")])],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"上下文窗口:",prop:"context_window"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{min:1,max:4096},model:{value:e.AIform.context_window,callback:function(t){e.$set(e.AIform,"context_window",t)},expression:"AIform.context_window"}}),a("el-input-number",{attrs:{min:1,max:4096,step:1},model:{value:e.AIform.presence_penalty,callback:function(t){e.$set(e.AIform,"presence_penalty",t)},expression:"AIform.presence_penalty"}})],1),a("div",{staticClass:"hint"},[e._v("AI考虑的上下文token数量")])])],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"语言:",prop:"language"}},[a("el-select",{staticStyle:{width:"55%"},model:{value:e.AIform.language,callback:function(t){e.$set(e.AIform,"language",t)},expression:"AIform.language"}},[a("el-option",{attrs:{label:"中文",value:"zh"}}),a("el-option",{attrs:{label:"English",value:"en"}}),a("el-option",{attrs:{label:"日本語",value:"ja"}}),a("el-option",{attrs:{label:"한국어",value:"ko"}}),a("el-option",{attrs:{label:"Français",value:"fr"}}),a("el-option",{attrs:{label:"Deutsch",value:"de"}})],1),a("div",{staticClass:"hint"},[e._v("选择AI响应的主要语言")])],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"请求超时:",prop:"timeout"}},[a("el-input-number",{attrs:{min:1,max:60},model:{value:e.AIform.timeout,callback:function(t){e.$set(e.AIform,"timeout",t)},expression:"AIform.timeout"}}),a("div",{staticClass:"hint"},[e._v("设置请求的最大等待时间(秒)")])],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"角色名称:",prop:"role_name"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{placeholder:"例如: 客服专员"},model:{value:e.AIform.role_name,callback:function(t){e.$set(e.AIform,"role_name",t)},expression:"AIform.role_name"}}),a("div",{staticClass:"hint"},[e._v("为AI助手设定一个角色名称")])],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"角色权限:",prop:"role_permissions"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{placeholder:'["回答产品问题", "处理退换货请求", "升级复杂问题"]'},model:{value:e.AIform.role_permissions,callback:function(t){e.$set(e.AIform,"role_permissions",t)},expression:"AIform.role_permissions"}}),a("div",{staticClass:"hint"},[e._v("输入JSON数组,列出AI助手的具体权限")])],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"自定义变量:",prop:"custom_variables"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{placeholder:'{"custom_greeting": "很高兴为您服务!", "company_name": "ABC公司"}'},model:{value:e.AIform.custom_variables,callback:function(t){e.$set(e.AIform,"custom_variables",t)},expression:"AIform.custom_variables"}}),a("div",{staticClass:"hint"},[e._v(" 输入JSON对象,定义可在提示模板中使用的自定义变量 ")])],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"自定义提示模板:",prop:"custom_prompt"}},[a("el-input",{staticStyle:{width:"100%"},attrs:{type:"textarea",rows:12,placeholder:"使用以下上下文来回答问题。如果你不知道答案,就说你不知道,不要试图编造答案。\n 上下文: {context}\n 人类: {question}\n AI助手: 让我根据提供的上下文来回答你的问题。{custom_greeting}"},model:{value:e.AIform.custom_prompt,callback:function(t){e.$set(e.AIform,"custom_prompt",t)},expression:"AIform.custom_prompt"}}),a("div",{staticClass:"hint"},[e._v(" 自定义AI助手的回答模板,可使用变量如{context}, {question}等 ")])],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"是否启用API_key:",prop:"generate_new_api_key"}},[a("el-switch",{attrs:{"active-color":"#13ce66","inactive-color":"#ff4949"},model:{value:e.AIform.generate_new_api_key,callback:function(t){e.$set(e.AIform,"generate_new_api_key",t)},expression:"AIform.generate_new_api_key"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"是否设为默认:",prop:"is_default"}},[a("el-switch",{attrs:{"active-color":"#13ce66","inactive-color":"#ff4949"},model:{value:e.AIform.is_default,callback:function(t){e.$set(e.AIform,"is_default",t)},expression:"AIform.is_default"}})],1)],1)],1)],1)],1):"edit"==e.type?a("div",{staticClass:"center"},[a("el-form",{ref:"editFormRef",staticStyle:{margin:"20px 50px"},attrs:{model:e.editForm,rules:e.rules,"label-width":"120px","label-position":"top"}},[a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"应用名称:",prop:"chat_name"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{placeholder:"请输入应用名称"},model:{value:e.editForm.chat_name,callback:function(t){e.$set(e.editForm,"chat_name",t)},expression:"editForm.chat_name"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"应用类型:",prop:"application_type"}},[a("el-select",{staticStyle:{width:"55%"},attrs:{placeholder:"应用类型",clearable:""},model:{value:e.editForm.application_type,callback:function(t){e.$set(e.editForm,"application_type",t)},expression:"editForm.application_type"}},e._l(e.appTypeList,(function(e,t){return a("el-option",{key:t,attrs:{label:e.label,value:e.value}})})),1)],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"模型名称:",prop:"model_name"}},[a("el-select",{staticStyle:{width:"55%"},attrs:{placeholder:"请输入选择",clearable:""},model:{value:e.editForm.model_name,callback:function(t){e.$set(e.editForm,"model_name",t)},expression:"editForm.model_name"}},e._l(e.modelNameList,(function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.name}})})),1)],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"知识库:",prop:"knowledge_base_names"}},[a("el-select",{staticStyle:{width:"55%"},attrs:{multiple:"",placeholder:"请选择知识库",clearable:"",filterable:""},on:{change:e.handleEditKnowledgeBaseChange},model:{value:e.editForm.knowledge_base_names,callback:function(t){e.$set(e.editForm,"knowledge_base_names",t)},expression:"editForm.knowledge_base_names"}},e._l(e.kneList,(function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.id}})})),1)],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"文档目录:",prop:"document_directories"}},[a("el-select",{staticStyle:{width:"55%"},attrs:{placeholder:"请选择文档目录",disabled:!(e.editForm.knowledge_base_names&&e.editForm.knowledge_base_names.length),clearable:"",filterable:""},on:{change:e.handleEditDirectoryChange},model:{value:e.editForm.document_directories,callback:function(t){e.$set(e.editForm,"document_directories",t)},expression:"editForm.document_directories"}},e._l(e.editDirectoryList,(function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.id}})})),1)],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"文 档:",prop:"documents"}},[a("el-select",{staticStyle:{width:"55%"},attrs:{multiple:"",placeholder:"请选择文档",disabled:""==e.editForm.document_directories,clearable:"",filterable:""},on:{change:e.handleEditDocumentChange},model:{value:e.editForm.documents,callback:function(t){e.$set(e.editForm,"documents",t)},expression:"editForm.documents"}},[a("el-option",{attrs:{label:"全部",value:"all"}}),e._l(e.editDocumentList,(function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.id}})}))],2)],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"应用图标:"}},[a("el-upload",{staticClass:"avatar-uploader",attrs:{action:e.uploadUrl,method:"post",data:e.params,"show-file-list":!1,"on-success":e.onUploadEditSuccess}},[null!=e.editForm.aiagent_icon&&""!=e.editForm.aiagent_icon?a("img",{staticClass:"avatar",attrs:{src:e.editForm.aiagent_icon}}):a("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"描 述:"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{placeholder:"请输入描述",type:"textarea"},model:{value:e.editForm.role_description,callback:function(t){e.$set(e.editForm,"role_description",t)},expression:"editForm.role_description"}})],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"温度:",prop:"temperature"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{min:0,max:1,step:.1},model:{value:e.editForm.temperature,callback:function(t){e.$set(e.editForm,"temperature",t)},expression:"editForm.temperature"}}),a("el-input-number",{attrs:{min:0,max:1},model:{value:e.editForm.temperature,callback:function(t){e.$set(e.editForm,"temperature",t)},expression:"editForm.temperature"}})],1),a("div",{staticClass:"hint"},[e._v("控制生成文本的随机性,0为最保守,1为最创新")])])],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"最大token数:",prop:"max_tokens"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{min:1,max:4096,step:1},model:{value:e.editForm.max_tokens,callback:function(t){e.$set(e.editForm,"max_tokens",t)},expression:"editForm.max_tokens"}}),a("el-input-number",{attrs:{min:0,max:4096,step:1},model:{value:e.editForm.max_tokens,callback:function(t){e.$set(e.editForm,"max_tokens",t)},expression:"editForm.max_tokens"}})],1),a("div",{staticClass:"hint"},[e._v("限制生成文本的最大长度")])])],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"核采样参数:",prop:"top_p"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{min:0,max:1,step:.1},model:{value:e.editForm.top_p,callback:function(t){e.$set(e.editForm,"top_p",t)},expression:"editForm.top_p"}}),a("el-input-number",{attrs:{min:0,max:1,step:.1},model:{value:e.editForm.top_p,callback:function(t){e.$set(e.editForm,"top_p",t)},expression:"editForm.top_p"}})],1),a("div",{staticClass:"hint"},[e._v("控制词汇多样性,1为考虑所有可能性")])])],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"重复内容惩罚:",prop:"frequency_penalty"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{min:-2,max:2,step:.1},model:{value:e.editForm.frequency_penalty,callback:function(t){e.$set(e.editForm,"frequency_penalty",t)},expression:"editForm.frequency_penalty"}}),a("el-input-number",{attrs:{min:-2,max:2,step:.1},model:{value:e.editForm.frequency_penalty,callback:function(t){e.$set(e.editForm,"frequency_penalty",t)},expression:"editForm.frequency_penalty"}})],1),a("div",{staticClass:"hint"},[e._v("防止重复,正值减少重复,负值增加重复")])])],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"新话题偏好:",prop:"presence_penalty"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{min:-2,max:2,step:.1},model:{value:e.editForm.presence_penalty,callback:function(t){e.$set(e.editForm,"presence_penalty",t)},expression:"editForm.presence_penalty"}}),a("el-input-number",{attrs:{min:-2,max:2,step:.1},model:{value:e.editForm.presence_penalty,callback:function(t){e.$set(e.editForm,"presence_penalty",t)},expression:"editForm.presence_penalty"}})],1),a("div",{staticClass:"hint"},[e._v("正值鼓励新话题,负值保持话题一致性")])])],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"响应格式:",prop:"response_format"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{placeholder:"text"},model:{value:e.editForm.response_format,callback:function(t){e.$set(e.editForm,"response_format",t)},expression:"editForm.response_format"}}),a("div",{staticClass:"hint"},[e._v("指定AI响应的格式,如text, json等")])],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"上下文窗口:",prop:"context_window"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{min:1,max:4096},model:{value:e.editForm.context_window,callback:function(t){e.$set(e.editForm,"context_window",t)},expression:"editForm.context_window"}}),a("el-input-number",{attrs:{min:1,max:4096,step:1},model:{value:e.editForm.presence_penalty,callback:function(t){e.$set(e.editForm,"presence_penalty",t)},expression:"editForm.presence_penalty"}})],1),a("div",{staticClass:"hint"},[e._v("AI考虑的上下文token数量")])])],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"语言:",prop:"language"}},[a("el-select",{staticStyle:{width:"55%"},model:{value:e.editForm.language,callback:function(t){e.$set(e.editForm,"language",t)},expression:"editForm.language"}},[a("el-option",{attrs:{label:"中文",value:"zh"}}),a("el-option",{attrs:{label:"English",value:"en"}}),a("el-option",{attrs:{label:"日本語",value:"ja"}}),a("el-option",{attrs:{label:"한국어",value:"ko"}}),a("el-option",{attrs:{label:"Français",value:"fr"}}),a("el-option",{attrs:{label:"Deutsch",value:"de"}})],1),a("div",{staticClass:"hint"},[e._v("选择AI响应的主要语言")])],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"请求超时:",prop:"timeout"}},[a("el-input-number",{attrs:{min:1,max:60},model:{value:e.editForm.timeout,callback:function(t){e.$set(e.editForm,"timeout",t)},expression:"editForm.timeout"}}),a("div",{staticClass:"hint"},[e._v("设置请求的最大等待时间(秒)")])],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"角色名称:",prop:"role_name"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{placeholder:"例如: 客服专员"},model:{value:e.editForm.role_name,callback:function(t){e.$set(e.editForm,"role_name",t)},expression:"editForm.role_name"}}),a("div",{staticClass:"hint"},[e._v("为AI助手设定一个角色名称")])],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"角色权限:",prop:"role_permissions"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{placeholder:'["回答产品问题", "处理退换货请求", "升级复杂问题"]'},model:{value:e.editForm.role_permissions,callback:function(t){e.$set(e.editForm,"role_permissions",t)},expression:"editForm.role_permissions"}}),a("div",{staticClass:"hint"},[e._v("输入JSON数组,列出AI助手的具体权限")])],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"自定义变量:",prop:"custom_variables"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{placeholder:'{"custom_greeting": "很高兴为您服务!", "company_name": "ABC公司"}'},model:{value:e.editForm.custom_variables,callback:function(t){e.$set(e.editForm,"custom_variables",t)},expression:"editForm.custom_variables"}}),a("div",{staticClass:"hint"},[e._v(" 输入JSON对象,定义可在提示模板中使用的自定义变量 ")])],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"自定义提示模板:",prop:"custom_prompt"}},[a("el-input",{staticStyle:{width:"100%"},attrs:{type:"textarea",rows:12,placeholder:"使用以下上下文来回答问题。如果你不知道答案,就说你不知道,不要试图编造答案。\n 上下文: {context}\n 人类: {question}\n AI助手: 让我根据提供的上下文来回答你的问题。{custom_greeting}"},model:{value:e.editForm.custom_prompt,callback:function(t){e.$set(e.editForm,"custom_prompt",t)},expression:"editForm.custom_prompt"}}),a("div",{staticClass:"hint"},[e._v(" 自定义AI助手的回答模板,可使用变量如{context}, {question}等 ")])],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"是否启用API_key:",prop:"generate_new_api_key"}},[a("el-switch",{attrs:{"active-color":"#13ce66","inactive-color":"#ff4949"},model:{value:e.editForm.generate_new_api_key,callback:function(t){e.$set(e.editForm,"generate_new_api_key",t)},expression:"editForm.generate_new_api_key"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"是否设为默认:",prop:"is_default"}},[a("el-switch",{attrs:{"active-color":"#13ce66","inactive-color":"#ff4949"},model:{value:e.editForm.is_default,callback:function(t){e.$set(e.editForm,"is_default",t)},expression:"editForm.is_default"}})],1)],1)],1)],1)],1):a("div",{staticClass:"center"},[a("el-form",{ref:"viewFormRef",staticStyle:{margin:"20px 50px"},attrs:{model:e.viewForm,rules:e.rules,"label-width":"120px","label-position":"top"}},[a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"应用名称:",prop:"chat_name"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{disabled:"",placeholder:"请输入应用名称"},model:{value:e.viewForm.chat_name,callback:function(t){e.$set(e.viewForm,"chat_name",t)},expression:"viewForm.chat_name"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"应用类型:",prop:"application_type"}},[a("el-select",{staticStyle:{width:"55%"},attrs:{disabled:"",placeholder:"应用类型",clearable:""},model:{value:e.viewForm.application_type,callback:function(t){e.$set(e.viewForm,"application_type",t)},expression:"viewForm.application_type"}},e._l(e.appTypeList,(function(e,t){return a("el-option",{key:t,attrs:{label:e.label,value:e.value}})})),1)],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"模型名称:",prop:"model_name"}},[a("el-select",{staticStyle:{width:"55%"},attrs:{disabled:"",placeholder:"请输入选择",clearable:""},model:{value:e.viewForm.model_name,callback:function(t){e.$set(e.viewForm,"model_name",t)},expression:"viewForm.model_name"}},e._l(e.modelNameList,(function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.name}})})),1)],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"知识库:",prop:"knowledge_base_names"}},[a("el-select",{staticStyle:{width:"55%"},attrs:{disabled:"",multiple:"",placeholder:"请选择知识库",clearable:"",filterable:""},on:{change:e.handleEditKnowledgeBaseChange},model:{value:e.viewForm.knowledge_base_names,callback:function(t){e.$set(e.viewForm,"knowledge_base_names",t)},expression:"viewForm.knowledge_base_names"}},e._l(e.kneList,(function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.id}})})),1)],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"文档目录:",prop:"document_directories"}},[a("el-select",{staticStyle:{width:"55%"},attrs:{placeholder:"请选择文档目录",disabled:"",clearable:"",filterable:""},on:{change:e.handleEditDirectoryChange},model:{value:e.viewForm.document_directories,callback:function(t){e.$set(e.viewForm,"document_directories",t)},expression:"viewForm.document_directories"}},e._l(e.editDirectoryList,(function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.id}})})),1)],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"文 档:",prop:"documents"}},[a("el-select",{staticStyle:{width:"55%"},attrs:{multiple:"",placeholder:"请选择文档",disabled:"",clearable:"",filterable:""},model:{value:e.viewForm.documents,callback:function(t){e.$set(e.viewForm,"documents",t)},expression:"viewForm.documents"}},e._l(e.editDocumentList,(function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.id}})})),1)],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"应用图标:"}},[a("el-upload",{staticClass:"avatar-uploader",attrs:{disabled:"",action:e.uploadUrl,method:"post",data:e.params,"show-file-list":!1,"on-success":e.onUploadEditSuccess}},[null!=e.viewForm.aiagent_icon&&""!=e.viewForm.aiagent_icon?a("img",{staticClass:"avatar",attrs:{src:e.viewForm.aiagent_icon}}):a("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"描 述:"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{disabled:"",placeholder:"请输入描述",type:"textarea"},model:{value:e.viewForm.role_description,callback:function(t){e.$set(e.viewForm,"role_description",t)},expression:"viewForm.role_description"}})],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"温度:",prop:"temperature"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{disabled:"",min:0,max:1,step:.1},model:{value:e.viewForm.temperature,callback:function(t){e.$set(e.viewForm,"temperature",t)},expression:"viewForm.temperature"}}),a("el-input-number",{attrs:{disabled:"",min:0,max:1},model:{value:e.viewForm.temperature,callback:function(t){e.$set(e.viewForm,"temperature",t)},expression:"viewForm.temperature"}})],1),a("div",{staticClass:"hint"},[e._v("控制生成文本的随机性,0为最保守,1为最创新")])])],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"最大token数:",prop:"max_tokens"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{disabled:"",min:1,max:4096,step:1},model:{value:e.viewForm.max_tokens,callback:function(t){e.$set(e.viewForm,"max_tokens",t)},expression:"viewForm.max_tokens"}}),a("el-input-number",{attrs:{disabled:"",min:0,max:4096,step:1},model:{value:e.viewForm.max_tokens,callback:function(t){e.$set(e.viewForm,"max_tokens",t)},expression:"viewForm.max_tokens"}})],1),a("div",{staticClass:"hint"},[e._v("限制生成文本的最大长度")])])],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"核采样参数:",prop:"top_p"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{disabled:"",min:0,max:1,step:.1},model:{value:e.viewForm.top_p,callback:function(t){e.$set(e.viewForm,"top_p",t)},expression:"viewForm.top_p"}}),a("el-input-number",{attrs:{disabled:"",min:0,max:1,step:.1},model:{value:e.viewForm.top_p,callback:function(t){e.$set(e.viewForm,"top_p",t)},expression:"viewForm.top_p"}})],1),a("div",{staticClass:"hint"},[e._v("控制词汇多样性,1为考虑所有可能性")])])],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"重复内容惩罚:",prop:"frequency_penalty"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{disabled:"",min:-2,max:2,step:.1},model:{value:e.viewForm.frequency_penalty,callback:function(t){e.$set(e.viewForm,"frequency_penalty",t)},expression:"viewForm.frequency_penalty"}}),a("el-input-number",{attrs:{disabled:"",min:-2,max:2,step:.1},model:{value:e.viewForm.frequency_penalty,callback:function(t){e.$set(e.viewForm,"frequency_penalty",t)},expression:"viewForm.frequency_penalty"}})],1),a("div",{staticClass:"hint"},[e._v("防止重复,正值减少重复,负值增加重复")])])],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"新话题偏好:",prop:"presence_penalty"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{disabled:"",min:-2,max:2,step:.1},model:{value:e.viewForm.presence_penalty,callback:function(t){e.$set(e.viewForm,"presence_penalty",t)},expression:"viewForm.presence_penalty"}}),a("el-input-number",{attrs:{disabled:"",min:-2,max:2,step:.1},model:{value:e.viewForm.presence_penalty,callback:function(t){e.$set(e.viewForm,"presence_penalty",t)},expression:"viewForm.presence_penalty"}})],1),a("div",{staticClass:"hint"},[e._v("正值鼓励新话题,负值保持话题一致性")])])],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"响应格式:",prop:"response_format"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{disabled:"",placeholder:"text"},model:{value:e.viewForm.response_format,callback:function(t){e.$set(e.viewForm,"response_format",t)},expression:"viewForm.response_format"}}),a("div",{staticClass:"hint"},[e._v("指定AI响应的格式,如text, json等")])],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"上下文窗口:",prop:"context_window"}},[a("div",{staticStyle:{display:"flex","justify-content":"space-around"}},[a("el-slider",{staticStyle:{width:"60%"},attrs:{disabled:"",min:1,max:4096},model:{value:e.viewForm.context_window,callback:function(t){e.$set(e.viewForm,"context_window",t)},expression:"viewForm.context_window"}}),a("el-input-number",{attrs:{disabled:"",min:1,max:4096,step:1},model:{value:e.viewForm.presence_penalty,callback:function(t){e.$set(e.viewForm,"presence_penalty",t)},expression:"viewForm.presence_penalty"}})],1),a("div",{staticClass:"hint"},[e._v("AI考虑的上下文token数量")])])],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"语言:",prop:"language"}},[a("el-select",{staticStyle:{width:"55%"},attrs:{disabled:""},model:{value:e.viewForm.language,callback:function(t){e.$set(e.viewForm,"language",t)},expression:"viewForm.language"}},[a("el-option",{attrs:{label:"中文",value:"zh"}}),a("el-option",{attrs:{label:"English",value:"en"}}),a("el-option",{attrs:{label:"日本語",value:"ja"}}),a("el-option",{attrs:{label:"한국어",value:"ko"}}),a("el-option",{attrs:{label:"Français",value:"fr"}}),a("el-option",{attrs:{label:"Deutsch",value:"de"}})],1),a("div",{staticClass:"hint"},[e._v("选择AI响应的主要语言")])],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"请求超时:",prop:"timeout"}},[a("el-input-number",{attrs:{disabled:"",min:1,max:60},model:{value:e.viewForm.timeout,callback:function(t){e.$set(e.viewForm,"timeout",t)},expression:"viewForm.timeout"}}),a("div",{staticClass:"hint"},[e._v("设置请求的最大等待时间(秒)")])],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"角色名称:",prop:"role_name"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{disabled:"",placeholder:"例如: 客服专员"},model:{value:e.viewForm.role_name,callback:function(t){e.$set(e.viewForm,"role_name",t)},expression:"viewForm.role_name"}}),a("div",{staticClass:"hint"},[e._v("为AI助手设定一个角色名称")])],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"角色权限:",prop:"role_permissions"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{disabled:"",placeholder:'["回答产品问题", "处理退换货请求", "升级复杂问题"]'},model:{value:e.viewForm.role_permissions,callback:function(t){e.$set(e.viewForm,"role_permissions",t)},expression:"viewForm.role_permissions"}}),a("div",{staticClass:"hint"},[e._v("输入JSON数组,列出AI助手的具体权限")])],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"自定义变量:",prop:"custom_variables"}},[a("el-input",{staticStyle:{width:"55%"},attrs:{disabled:"",placeholder:'{"custom_greeting": "很高兴为您服务!", "company_name": "ABC公司"}'},model:{value:e.viewForm.custom_variables,callback:function(t){e.$set(e.viewForm,"custom_variables",t)},expression:"viewForm.custom_variables"}}),a("div",{staticClass:"hint"},[e._v(" 输入JSON对象,定义可在提示模板中使用的自定义变量 ")])],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"自定义提示模板:",prop:"custom_prompt"}},[a("el-input",{staticStyle:{width:"100%"},attrs:{disabled:"",type:"textarea",rows:12,placeholder:"使用以下上下文来回答问题。如果你不知道答案,就说你不知道,不要试图编造答案。\n 上下文: {context}\n 人类: {question}\n AI助手: 让我根据提供的上下文来回答你的问题。{custom_greeting}"},model:{value:e.viewForm.custom_prompt,callback:function(t){e.$set(e.viewForm,"custom_prompt",t)},expression:"viewForm.custom_prompt"}}),a("div",{staticClass:"hint"},[e._v(" 自定义AI助手的回答模板,可使用变量如{context}, {question}等 ")])],1)],1)],1),a("el-row",{attrs:{gutter:24}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"是否启用API_key:",prop:"generate_new_api_key"}},[a("el-switch",{attrs:{disabled:"","active-color":"#13ce66","inactive-color":"#ff4949"},model:{value:e.viewForm.generate_new_api_key,callback:function(t){e.$set(e.viewForm,"generate_new_api_key",t)},expression:"viewForm.generate_new_api_key"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"是否设为默认:",prop:"is_default"}},[a("el-switch",{attrs:{disabled:"","active-color":"#13ce66","inactive-color":"#ff4949"},model:{value:e.viewForm.is_default,callback:function(t){e.$set(e.viewForm,"is_default",t)},expression:"viewForm.is_default"}})],1)],1)],1)],1)],1),a("div",{staticClass:"footer"},[a("el-button",{on:{click:e.cancelApplication}},[e._v("取 消")]),"add"==e.type?a("el-button",{attrs:{type:"primary"},on:{click:e.generateApplication}},[e._v("生成应用")]):"edit"==e.type?a("el-button",{attrs:{type:"primary"},on:{click:e.submitEdit}},[e._v("确认修改")]):e._e()],1)])},o=[],i=a("ade3"),s=a("b85c"),l=a("2909"),n=a("c7eb"),c=a("5530"),m=a("1da1"),d=(a("99af"),a("4de4"),a("7db0"),a("caad"),a("a15b"),a("d81d"),a("fb6a"),a("b0c0"),a("e9c4"),a("b64b"),a("d3b7"),a("6062"),a("2532"),a("3ca3"),a("159b"),a("ddb0"),a("bc3a")),p=a.n(d),u=a("db6a"),_={props:{},components:{},data:function(){return{AIform:{chat_name:"",modelLibrary:"ollama",model_type:"chat",model_name:"",knowledge_base_names:[],document_directories:[],documents:[],temperature:.7,max_tokens:150,top_p:1,frequency_penalty:0,presence_penalty:0,response_format:"text",context_window:2048,user_id:"user123",session_id:"session456",language:"en",timeout:30,role_name:"Admin",role_description:"",role_permissions:'["回答产品问题", "处理退换货请求", "升级复杂问题"]',custom_variables:'{"custom_greeting": "很高兴为您服务!", "company_name": "ABC公司"}',custom_prompt:"使用以下上下文来回答问题。如果你不知道答案,就说你不知道,不要试图编造答案。上下文: {context} 人类: {question}AI助手: 让我根据提供的上下文来回答你的问题。{custom_greeting}",application_type:"",is_default:!1,generate_new_api_key:!0,aiagent_icon:""},modelList:[],modelTypeList:[],modelNameList:[],kneList:[],directoryList:[],documentList:[],bucket_id:"",rules:{chat_name:[{required:!0,message:"请填写应名称",trigger:"blur"}],model_name:[{required:!0,message:"请选择模型名称",trigger:"change"}],knowledge_base_names:[{required:!0,message:"请选择至少一个知识库",trigger:"change"}],documents:[{required:!0,message:"请选择至少一个文档",trigger:"change"}],role_permissions:[{required:!0,message:"请输入角色权限",trigger:"blur"},{validator:function(e,t,a){try{JSON.parse(t),a()}catch(r){a(new Error("请输入有效的 JSON 数组"))}},trigger:"blur"}],custom_variables:[{required:!0,message:"请输入自定义变量",trigger:"blur"},{validator:function(e,t,a){try{JSON.parse(t),a()}catch(r){a(new Error("请输入有效的 JSON 对象"))}},trigger:"blur"}]},appTypeList:[],id:"",editForm:{chat_name:"",modelLibrary:"ollama",model_type:"chat",model_name:"",knowledge_base_names:[],document_directories:[],documents:[],temperature:.7,max_tokens:150,top_p:1,frequency_penalty:0,presence_penalty:0,response_format:"text",context_window:2048,user_id:"user123",session_id:"session456",language:"en",timeout:30,role_name:"Admin",role_description:"",role_permissions:'["回答产品问题", "处理退换货请求", "升级复杂问题"]',custom_variables:'{"custom_greeting": "很高兴为您服务!", "company_name": "ABC公司"}',custom_prompt:"使用以下上下文来回答问题。如果你不知道答案,就说你不知道,不要试图编造答案。上下文: {context} 人类: {question}AI助手: 让我根据提供的上下文来回答你的问题。{custom_greeting}",application_type:"",is_default:!1,generate_new_api_key:!0},editDirectoryList:[],editDocumentList:[],type:"",viewForm:{chat_name:"",modelLibrary:"ollama",model_type:"chat",model_name:"",knowledge_base_names:[],document_directories:[],documents:[],temperature:.7,max_tokens:150,top_p:1,frequency_penalty:0,presence_penalty:0,response_format:"text",context_window:2048,user_id:"user123",session_id:"session456",language:"en",timeout:30,role_name:"Admin",role_description:"",role_permissions:"",custom_variables:"",custom_prompt:"使用以下上下文来回答问题。如果你不知道答案,就说你不知道,不要试图编造答案。上下文: {context} 人类: {question}AI助手: 让我根据提供的上下文来回答你的问题。{custom_greeting}",application_type:"",is_default:!1,generate_new_api_key:!0,aiagent_icon:""},params:{token:""},uploadUrl:""}},computed:{getKnowledgeBaseNames:function(){var e=this,t=this.AIform.knowledge_base_names.map((function(t){var a;return(null===(a=e.kneList.find((function(e){return e.id===t})))||void 0===a?void 0:a.name)||t}));return t.length<=2?t.join(", "):"".concat(t[0],", ").concat(t[1]," 等").concat(t.length,"个")},getDocumentNames:function(){var e=this,t=this.AIform.documents.map((function(t){var a;return(null===(a=e.documentList.find((function(e){return e.id===t})))||void 0===a?void 0:a.name)||t}));return t.length<=2?t.join(", "):"".concat(t[0],", ").concat(t[1]," 等").concat(t.length,"个")},isDocumentSelectDisabled:function(){return!this.AIform.knowledge_base_names.length||""==this.AIform.document_directories}},watch:{},created:function(){var e=this;e.uploadUrl="http://58.246.234.210:8084/upload/file",e.params.token=e.$store.getters.token},mounted:function(){this.init(),this.type=this.$route.query.type,this.id=this.$route.query.id,"view"==this.type&&this.initView()},methods:Object(i["a"])(Object(i["a"])(Object(i["a"])(Object(i["a"])(Object(i["a"])(Object(i["a"])(Object(i["a"])(Object(i["a"])({onUploadEditSuccess:function(e){this.editForm.aiagent_icon=e.data.fileUrl},handleEditDocumentChange:function(e){e.includes("all")?this.editForm.documents=["all"]:e.length>10&&(this.editForm.documents=e.slice(0,10),this.$message.warning("最多只能选择10个文档"))},submitEdit:function(){var e=this;this.$refs.editFormRef.validate(function(){var t=Object(m["a"])(Object(n["a"])().mark((function t(a){var r,o,i,s;return Object(n["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(!a){t.next=27;break}if(t.prev=1,r=Object(c["a"])({},e.editForm),o=e.validateAndParseJSON("role_permissions","角色权限格式无效"),o){t.next=6;break}return t.abrupt("return");case 6:if(r.role_permissions=o,i=e.validateAndParseJSON("custom_variables","自定义变量格式无效"),i){t.next=10;break}return t.abrupt("return");case 10:return r.custom_variables=i,r.documents.includes("all")||0===r.documents.length?r.documents=[]:r.documents=e.safeGetNamesByIds(r.documents,e.editDocumentList),r.document_directories=e.safeGetNamesByIds(e.editForm.document_directories,e.editDirectoryList),0===r.document_directories.length&&(r.document_directories=["全部"]),console.log("Converted form for edit:",r),t.next=17,p.a.post("".concat("http://58.246.234.210:8084","/chatbot/configuration/update/"),r,{headers:{"Content-Type":"application/json"}});case 17:s=t.sent,200===s.status?(e.$message.success("应用更新成功"),e.$router.push({path:"/knowledge/chatPage/index"})):e.$message.error(s.data.message||"应用更新失败"),t.next=25;break;case 21:t.prev=21,t.t0=t["catch"](1),console.error("Error updating application:",t.t0),e.$message.error("应用更新失败,请稍后重试");case 25:t.next=29;break;case 27:return e.$message.error("请填写所有必填字段"),t.abrupt("return",!1);case 29:case"end":return t.stop()}}),t,null,[[1,21]])})));return function(e){return t.apply(this,arguments)}}())},handleEditKnowledgeBaseChange:function(e){this.editForm.document_directories=[],this.editForm.documents=[],this.editDocumentList=[],this.loadEditDirectoryList(e)},handleEditDirectoryChange:function(e){this.editForm.documents=[],this.loadEditDocumentList(e)},loadEditDirectoryList:function(e){var t=this;return Object(m["a"])(Object(n["a"])().mark((function a(){var r,o,i;return Object(n["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:return t.editDirectoryList=[],r=0,o=0,i=e.map(function(){var e=Object(m["a"])(Object(n["a"])().mark((function e(a){var i,s;return Object(n["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return i={page:1,pageSize:9999,kb_id:a},e.prev=1,e.next=4,Object(u["C"])(i);case 4:s=e.sent,s.data&&(t.editDirectoryList=Object(l["a"])(new Set([].concat(Object(l["a"])(t.editDirectoryList),Object(l["a"])(s.data.dataList)))),s.data.dataList.forEach((function(e){"other"===e.id?o+=e.document_count||0:r+=e.document_count||0}))),e.next=11;break;case 8:e.prev=8,e.t0=e["catch"](1),console.error("Error loading directory list for kb_id ".concat(a,":"),e.t0);case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}()),a.next=6,Promise.all(i);case 6:return t.editDirectoryList.unshift({id:"001",name:"全部",document_count:r+o}),a.abrupt("return",t.editDirectoryList);case 8:case"end":return a.stop()}}),a)})))()},loadEditDocumentList:function(e){var t=this,a=e,r=(this.directoryList.find((function(t){return t.id==e})),this.kneList.find((function(e){return e.id===t.editForm.knowledge_base_names[0]}))),o={page:1,pageSize:9999,bucket_id:r.id,doc_type_id:"001"===a?"":this.getDirectoryIdByName(a)};return Object(u["o"])(o).then((function(e){return t.editDocumentList=e.data.documents,t.editDocumentList}))},getDirectoryIdByName:function(e){var t=this.editDirectoryList.find((function(t){return t.name===e}));return t?t.id:null},onUploadAddSuccess:function(e){this.AIform.aiagent_icon=e.data.fileUrl},resetForm:function(){this.$refs.AIformRef&&this.$refs.AIformRef.resetFields(),this.AIform={chat_name:"",modelLibrary:"ollama",model_type:"chat",model_name:"",knowledge_base_names:[],document_directories:[],documents:[],temperature:.7,max_tokens:150,top_p:1,frequency_penalty:0,presence_penalty:0,response_format:"",context_window:2048,user_id:"",session_id:"",language:"en",timeout:30,role_name:"Admin",role_description:"",role_permissions:'["回答产品问题", "处理退换货请求", "升级复杂问题"]',custom_variables:'{"custom_greeting": "很高兴为您服务!", "company_name": "ABC公司"}',custom_prompt:"使用以下上下文来回答问题。如果你不知道答案,就说你不知道,不要试图编造答案。上下文: {context} 人类: {question}AI助手: 让我根据提供的上下文来回答你的问题。{custom_greeting}",application_type:"",is_default:!1,generate_new_api_key:!0,aiagent_icon:""}},cancelApplication:function(){var e=this;"view"==this.type?(this.resetForm(),this.$router.push({path:"/knowledge/chatPage/index"})):this.$confirm("确认取消?未保存的更改将会丢失。").then((function(t){e.resetForm(),e.$router.push({path:"/knowledge/chatPage/index"})})).catch((function(e){}))},handleDocumentChange:function(e){e.includes("all")?this.AIform.documents=["all"]:e.length>10&&(this.AIform.documents=e.slice(0,10),this.$message.warning("最多只能选择10个文档"))},validateAndParseJSON:function(e,t){try{return JSON.parse(this.AIform[e])}catch(a){return this.$message.error("".concat(t,": ").concat(a.message)),null}},generateApplication:function(){var e=this;this.$refs.AIformRef.validate(function(){var t=Object(m["a"])(Object(n["a"])().mark((function t(a){var r,o,i,s;return Object(n["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(!a){t.next=27;break}if(t.prev=1,r=Object(c["a"])({},e.AIform),o=e.validateAndParseJSON("role_permissions","角色权限格式无效"),o){t.next=6;break}return t.abrupt("return");case 6:if(r.role_permissions=o,i=e.validateAndParseJSON("custom_variables","自定义变量格式无效"),i){t.next=10;break}return t.abrupt("return");case 10:return r.custom_variables=i,r.documents.includes("all")||0===r.documents.length?r.documents=[]:r.documents=e.safeGetNamesByIds(r.documents,e.documentList),r.document_directories=e.safeGetNamesByIds(e.AIform.document_directories,e.directoryList),0===r.document_directories.length&&(r.document_directories=["全部"]),console.log("Converted form:",r),t.next=17,p.a.post("".concat("http://58.246.234.210:8084","/chatbot/configCreart/"),r,{headers:{"Content-Type":"application/json"}});case 17:s=t.sent,200===s.status?(e.$message.success("应用生成成功"),e.resetForm(),e.$router.push({path:"/knowledge/chatPage/index"})):e.$message.error(s.data.message||"应用生成失败"),t.next=25;break;case 21:t.prev=21,t.t0=t["catch"](1),console.error("Error generating application:",t.t0),e.$message.error("应用生成失败,请稍后重试");case 25:t.next=29;break;case 27:return e.$message.error("请填写所有必填字段"),t.abrupt("return",!1);case 29:case"end":return t.stop()}}),t,null,[[1,21]])})));return function(e){return t.apply(this,arguments)}}())},safeGetNamesByIds:function(e,t){return Array.isArray(e)?e.map((function(e){if("001"===e)return"全部";var a=t.find((function(t){return t.id===e}));return a?a.name:""})).filter((function(e){return""!==e})):(console.warn("Expected an array of ids, but received:",e),[])},handleKnowledgeBaseChange:function(e){this.AIform.document_directories=[],this.AIform.documents=[],this.documentList=[],this.bucket_id=e[0],this.loadDirectoryList(e)},handleDirectoryChange:function(e){this.AIform.documents=[],this.loadDocumentList(e)},loadDirectoryList:function(e){var t=this;return Object(m["a"])(Object(n["a"])().mark((function a(){var r,o,i,c,m;return Object(n["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:t.directoryList=[],0,0,r=Object(s["a"])(e),a.prev=4,r.s();case 6:if((o=r.n()).done){a.next=21;break}return i=o.value,c={page:1,pageSize:9999,kb_id:i},a.prev=9,a.next=12,Object(u["C"])(c);case 12:m=a.sent,m.data&&(t.directoryList=Object(l["a"])(new Set([].concat(Object(l["a"])(t.directoryList),Object(l["a"])(m.data.dataList)))),console.log(m.data.dataList),m.data.dataList.forEach((function(e){"other"===e.id?e.document_count||0:e.document_count||0}))),a.next=19;break;case 16:a.prev=16,a.t0=a["catch"](9),console.error("Error loading directory list for kb_id ".concat(i,":"),a.t0);case 19:a.next=6;break;case 21:a.next=26;break;case 23:a.prev=23,a.t1=a["catch"](4),r.e(a.t1);case 26:return a.prev=26,r.f(),a.finish(26);case 29:t.directoryList.unshift({id:"001",name:"全部"});case 30:case"end":return a.stop()}}),a,null,[[4,23,26,29],[9,16]])})))()}},"handleDirectoryChange",(function(e){this.AIform.documents=[],this.loadDocumentList(e)})),"loadDocumentList",(function(e){var t=this,a=this.directoryList.find((function(t){return t.id==e})),r={page:1,pageSize:9999,bucket_id:"001"==e?this.bucket_id:a.kb_id,doc_type_id:"001"==e?"":e};Object(u["o"])(r).then((function(e){t.documentList=e.data.documents}))})),"init",(function(){var e=this;Object(u["w"])({model_type:"model"}).then((function(t){e.modelNameList=t.data})),Object(u["u"])({user_id:this.$store.state.user.id}).then((function(t){e.kneList=t.data,"edit"==e.$route.query.type&&e.initEdit()})),Object(u["h"])().then((function(t){e.knowledgeBases=t.data,console.log(t)})),Object(u["d"])().then((function(t){200===t.status&&(e.appTypeList=t.data.application_types)}))})),"initEdit",(function(){var e=this;return Object(m["a"])(Object(n["a"])().mark((function t(){var a;return Object(n["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.editForm=JSON.parse(JSON.stringify(e.$route.query.card)),e.handleJsonFields(),a=e.loadEditDirectoryList(e.editForm.knowledge_base_names),t.next=5,a;case 5:e.handleDirectoryAndDocumentSelection();case 6:case"end":return t.stop()}}),t)})))()})),"handleDirectoryAndDocumentSelection",(function(){var e=this;return Object(m["a"])(Object(n["a"])().mark((function t(){var a,r;return Object(n["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(e.editForm.document_directories&&0!==e.editForm.document_directories.length){t.next=2;break}return t.abrupt("return");case 2:if(a=e.editForm.document_directories[0],r=e.editDirectoryList.find((function(e){return e.name===a})),r){t.next=6;break}return t.abrupt("return");case 6:return e.editForm.document_directories=r.id,t.next=9,e.$nextTick();case 9:return t.next=11,e.loadEditDocumentList(r.id);case 11:e.handleDocumentSelection();case 12:case"end":return t.stop()}}),t)})))()})),"handleDocumentSelection",(function(){var e=this;this.editForm.documents&&0!==this.editForm.documents.length?this.editForm.documents.includes("全部")?this.editForm.documents=["all"]:this.editForm.documents=this.editDocumentList.filter((function(t){return e.editForm.documents.includes(t.name)})).map((function(e){return e.id})):this.editForm.documents=["all"]})),"handleJsonFields",(function(){if(this.editForm.role_permissions){if("string"!==typeof this.editForm.role_permissions)try{this.editForm.role_permissions=JSON.stringify(this.editForm.role_permissions)}catch(e){console.error("Error stringifying role_permissions:",e),this.editForm.role_permissions=""}}else this.editForm.role_permissions="";this.editForm.custom_variables?this.editForm.custom_variables=JSON.stringify(this.editForm.custom_variables):this.editForm.custom_variables=""})),"initView",(function(){var e=this;if(this.viewForm=JSON.parse(JSON.stringify(this.$route.query.card)),this.viewForm.knowledge_base_names=this.viewForm.knowledge_base_names.map((function(t){var a=e.kneList.find((function(e){return e.name===t}));return a?a.id:t})),this.viewForm.role_permissions){if("string"!==typeof this.viewForm.role_permissions)try{this.viewForm.role_permissions=JSON.stringify(this.viewForm.role_permissions)}catch(t){console.error("Error stringifying role_permissions:",t),this.viewForm.role_permissions=""}}else this.viewForm.role_permissions="";this.viewForm.custom_variables?this.viewForm.custom_variables=JSON.stringify(this.viewForm.custom_variables):this.viewForm.custom_variables="",!this.viewForm.documents||0===this.viewForm.documents.length||this.viewForm.documents.includes("全部")?this.viewForm.documents=["全部"]:this.viewForm.documents=this.viewForm.documents.map((function(t){var a=e.editDocumentList.find((function(e){return e.name===t}));return a?a.id:t})),this.loadEditDirectoryList(this.viewForm.knowledge_base_names)}))},f=_,v=(a("30db"),a("2877")),b=Object(v["a"])(f,r,o,!1,null,"5f200d82",null);t["default"]=b.exports},"5c85":function(e,t,a){}}]);