chunk-16a60d86.84671d9b.js 60 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-16a60d86"],{"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:""}},[a("el-radio",{attrs:{label:"1"},model:{value:e.radio,callback:function(t){e.radio=t},expression:"radio"}},[e._v("目录")]),a("el-radio",{attrs:{label:"2"},model:{value:e.radio,callback:function(t){e.radio=t},expression:"radio"}},[e._v("文档")])],1)],1),"1"==e.radio?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:"",remote:"","remote-method":e.remoteSearch,loading:e.loading},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){return a("el-option",{key:"doc-"+e.id,attrs:{label:e.name,value:e.id}})}))],2),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:"应用图标:"}},[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:0,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:0,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:0,max:1,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:0,max:1,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:1e4},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:1e4,step:1},model:{value:e.AIform.context_window,callback:function(t){e.$set(e.AIform,"context_window",t)},expression:"AIform.context_window"}})],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:""}},[a("el-radio",{attrs:{label:"1"},model:{value:e.editForm.radio,callback:function(t){e.$set(e.editForm,"radio",t)},expression:"editForm.radio"}},[e._v("目录")]),a("el-radio",{attrs:{label:"2"},model:{value:e.editForm.radio,callback:function(t){e.$set(e.editForm,"radio",t)},expression:"editForm.radio"}},[e._v("文档")])],1)],1),"1"==e.editForm.radio?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.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.knowledge_base_names.length,clearable:"",filterable:"",remote:"","remote-method":e.remoteEditSearch,loading:e.editLoading},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){return a("el-option",{key:"edit-doc-"+e.id,attrs:{label:e.name,value:e.id}})}))],2),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:"应用图标:"}},[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:0,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:0,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:0,max:1,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:0,max:1,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:1e4},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:1e4,step:1},model:{value:e.editForm.context_window,callback:function(t){e.$set(e.editForm,"context_window",t)},expression:"editForm.context_window"}})],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:""}},[a("el-radio",{attrs:{label:"1",disabled:""},model:{value:e.viewForm.radio,callback:function(t){e.$set(e.viewForm,"radio",t)},expression:"viewForm.radio"}},[e._v("目录")]),a("el-radio",{attrs:{label:"2",disabled:""},model:{value:e.viewForm.radio,callback:function(t){e.$set(e.viewForm,"radio",t)},expression:"viewForm.radio"}},[e._v("文档")])],1)],1),"1"==e.viewForm.radio?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:0,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:0,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:0,max:1,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:0,max:1,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:1e4},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:1e4,step:1},model:{value:e.viewForm.context_window,callback:function(t){e.$set(e.viewForm,"context_window",t)},expression:"viewForm.context_window"}})],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"),n=a("c7eb"),l=a("5530"),c=a("1da1"),m=a("2909"),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")),u=a.n(d),p=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,radio:"1",tempDocuments:[],tempDirectories:[]},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:"",radio:"1"},params:{token:""},uploadUrl:"",radio:"1",loading:!1,editLoading:!1}},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"1"===this.radio?!this.AIform.knowledge_base_names.length||""==this.AIform.document_directories:!this.AIform.knowledge_base_names.length}},watch:{"editForm.radio":{handler:function(e,t){"1"===e?(this.editForm.tempDocuments=Object(m["a"])(this.editForm.documents||[]),this.editForm.tempDirectories.length>0&&(this.editForm.document_directories=Object(m["a"])(this.editForm.tempDirectories))):(this.editForm.tempDirectories=Object(m["a"])(this.editForm.document_directories||[]),this.editForm.tempDocuments.length>0&&(this.editForm.documents=Object(m["a"])(this.editForm.tempDocuments)))}}},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"])({remoteEditSearch:function(e){var t=this;if(""!==e){this.editLoading=!0;var a={kb_id:this.editForm.knowledge_base_names,keyword:e,limit:10};"1"===this.editForm.radio&&this.editForm.document_directories&&(a.doc_type_id=this.editForm.document_directories),Object(p["K"])(a).then((function(e){t.editDocumentList=e.data.items||[]})).catch((function(e){console.error("搜索文档失败:",e),t.$message.error("搜索文档失败")})).finally((function(){t.editLoading=!1}))}else"1"===this.editForm.radio?this.editForm.document_directories&&this.loadEditDocumentList(this.editForm.document_directories):this.editForm.knowledge_base_names.length},loadAllEditDocuments:function(e){var t=this;this.editLoading=!0;var a={page:1,pageSize:9999,bucket_id:e,doc_type_id:""};Object(p["p"])(a).then((function(e){t.editDocumentList=e.data.documents})).finally((function(){t.editLoading=!1}))},remoteSearch:function(e){var t=this;if(""!==e){this.loading=!0;var a={kb_id:this.AIform.knowledge_base_names,keyword:e,limit:10};"1"===this.radio&&this.AIform.document_directories&&(a.doc_type_id=this.AIform.document_directories),Object(p["K"])(a).then((function(e){t.documentList=e.data.items||[]})).catch((function(e){console.error("搜索文档失败:",e),t.$message.error("搜索文档失败")})).finally((function(){t.loading=!1}))}else"1"===this.radio?this.AIform.document_directories&&this.loadDocumentList(this.AIform.document_directories):this.AIform.knowledge_base_names.length},loadAllDocuments:function(e){var t=this;this.loading=!0;var a={page:1,pageSize:9999,bucket_id:e,doc_type_id:""};Object(p["p"])(a).then((function(e){t.documentList=e.data.documents})).finally((function(){t.loading=!1}))},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个文档")):this.editForm.documents=e},submitEdit:function(){var e=this;this.$refs.editFormRef.validate(function(){var t=Object(c["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=28;break}if(t.prev=1,r=Object(l["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,"1"===r.radio?(e.editForm.document_directories&&"001"!==e.editForm.document_directories?r.document_directories=e.safeGetNamesByIds([e.editForm.document_directories],e.editDirectoryList):r.document_directories=[],r.documents=[]):(r.document_directories=[],e.editForm.documents.length?r.documents=e.editDocumentList.filter((function(t){return e.editForm.documents.includes(t.id)})).map((function(e){return e.name})):r.documents=[]),delete r.tempDocuments,delete r.tempDirectories,delete r.radio,console.log("Converted form for edit:",r),t.next=18,u.a.post("".concat("http://58.246.234.210:8084","/chatbot/configuration/update/"),r,{headers:{"Content-Type":"application/json"}});case 18:s=t.sent,200===s.status?(e.$message.success("应用更新成功"),e.$router.push({path:"/knowledge/chatPage/index"})):e.$message.error(s.data.message||"应用更新失败"),t.next=26;break;case 22:t.prev=22,t.t0=t["catch"](1),console.error("Error updating application:",t.t0),e.$message.error("应用更新失败,请稍后重试");case 26:t.next=30;break;case 28:return e.$message.error("请填写所有必填字段"),t.abrupt("return",!1);case 30:case"end":return t.stop()}}),t,null,[[1,22]])})));return function(e){return t.apply(this,arguments)}}())},handleEditKnowledgeBaseChange:function(e){e&&e.length>0&&("1"===this.editForm.radio?(this.editForm.document_directories=[],this.editForm.documents=[]):(this.editForm.documents=[],this.loadAllEditDocuments(e[0])),this.editDocumentList=[],this.loadEditDirectoryList(e))},handleEditDirectoryChange:function(e){"1"===this.editForm.radio&&(this.editForm.documents=[],this.loadEditDocumentList(e))},loadEditDirectoryList:function(e){var t=this;return Object(c["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(c["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(p["E"])(i);case 4:s=e.sent,s.data&&(t.editDirectoryList=Object(m["a"])(new Set([].concat(Object(m["a"])(t.editDirectoryList),Object(m["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(p["p"])(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=[]: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(c["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=25;break}if(t.prev=1,r=Object(l["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,"1"===e.radio?(e.AIform.document_directories&&"001"!==e.AIform.document_directories?r.document_directories=e.safeGetNamesByIds([e.AIform.document_directories],e.directoryList):r.document_directories=[],r.documents=[]):(r.document_directories=[],!e.AIform.documents.length||e.AIform.documents.includes("all")?r.documents=[]:r.documents=e.safeGetNamesByIds(e.AIform.documents,e.documentList)),console.log("Converted form:",r),t.next=15,u.a.post("".concat("http://58.246.234.210:8084","/chatbot/configCreart/"),r,{headers:{"Content-Type":"application/json"}});case 15: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=23;break;case 19:t.prev=19,t.t0=t["catch"](1),console.error("Error generating application:",t.t0),e.$message.error("应用生成失败,请稍后重试");case 23:t.next=27;break;case 25:return e.$message.error("请填写所有必填字段"),t.abrupt("return",!1);case 27:case"end":return t.stop()}}),t,null,[[1,19]])})));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(c["a"])(Object(n["a"])().mark((function a(){var r,o,i,l,c;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,l={page:1,pageSize:9999,kb_id:i},a.prev=9,a.next=12,Object(p["E"])(l);case 12:c=a.sent,c.data&&(t.directoryList=Object(m["a"])(new Set([].concat(Object(m["a"])(t.directoryList),Object(m["a"])(c.data.dataList)))),console.log(c.data.dataList),c.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;this.loading=!0;var a={page:1,pageSize:9999,bucket_id:this.bucket_id,doc_type_id:"001"===e?"":e};Object(p["p"])(a).then((function(e){t.documentList=e.data.documents})).finally((function(){t.loading=!1}))})),"init",(function(){var e=this;Object(p["w"])().then((function(t){e.modelNameList=t.data.models})),Object(p["u"])({user_id:this.$store.state.user.id}).then((function(t){e.kneList=t.data,"edit"==e.$route.query.type&&e.initEdit()})),Object(p["g"])().then((function(t){e.knowledgeBases=t.data,console.log(t)})),Object(p["c"])().then((function(t){200===t.status&&(e.appTypeList=t.data.application_types)}))})),"initEdit",(function(){var e=this;return Object(c["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:if(t.prev=0,e.editForm=JSON.parse(JSON.stringify(e.$route.query.card)),e.editForm=Object(l["a"])(Object(l["a"])({},e.editForm),{},{document_directories:e.editForm.document_directories||[],documents:e.editForm.documents||[],radio:"1"}),e.handleJsonFields(),Array.isArray(e.editForm.document_directories)?0===e.editForm.document_directories.length&&(e.editForm.radio="2",e.editForm.documents&&0!==e.editForm.documents.length||(e.editForm.documents=["all"])):(e.editForm.radio="2",e.editForm.documents&&0!==e.editForm.documents.length||(e.editForm.documents=["all"])),e.editForm.tempDocuments=Array.isArray(e.editForm.documents)?Object(m["a"])(e.editForm.documents):[],e.editForm.tempDirectories=Array.isArray(e.editForm.document_directories)?Object(m["a"])(e.editForm.document_directories):[],!(e.editForm.knowledge_base_names&&e.editForm.knowledge_base_names.length>0)){t.next=11;break}return a=e.loadEditDirectoryList(e.editForm.knowledge_base_names),t.next=11,a;case 11:return t.next=13,e.handleDirectoryAndDocumentSelection();case 13:t.next=19;break;case 15:t.prev=15,t.t0=t["catch"](0),console.error("Error in initEdit:",t.t0),e.$message.error("初始化编辑表单时出错");case 19:case"end":return t.stop()}}),t,null,[[0,15]])})))()})),"handleDirectoryAndDocumentSelection",(function(){var e=this;return Object(c["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(1!==e.editForm.document_directories.length||"全部"!==e.editForm.document_directories[0]){t.next=4;break}return e.editForm.document_directories="001",e.editForm.documents&&0!==e.editForm.documents.length&&!e.editForm.documents.includes("全部")||(e.editForm.documents=["all"]),t.abrupt("return");case 4:if(a=e.editForm.document_directories[0],r=e.editDirectoryList.find((function(e){return e.name===a})),r){t.next=8;break}return t.abrupt("return");case 8:return e.editForm.document_directories=r.id,t.next=11,e.$nextTick();case 11:return t.next=13,e.loadEditDocumentList(r.id);case 13:e.handleDocumentSelection();case 14: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;try{if(this.viewForm=JSON.parse(JSON.stringify(this.$route.query.card)),this.viewForm=Object(l["a"])(Object(l["a"])({},this.viewForm),{},{document_directories:this.viewForm.document_directories||[],documents:this.viewForm.documents||[],radio:"1"}),Array.isArray(this.viewForm.document_directories)?0===this.viewForm.document_directories.length&&(this.viewForm.radio="2"):this.viewForm.radio="2",Array.isArray(this.viewForm.documents)&&0===this.viewForm.documents.length&&"2"!==this.viewForm.radio&&(this.viewForm.radio="1"),this.viewForm.knowledge_base_names&&Array.isArray(this.viewForm.knowledge_base_names)?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.knowledge_base_names=[],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&&Array.isArray(this.viewForm.documents)&&0!==this.viewForm.documents.length&&!this.viewForm.documents.includes("全部")||(this.viewForm.documents=["全部"]),this.viewForm.knowledge_base_names&&this.viewForm.knowledge_base_names.length>0&&this.loadEditDirectoryList(this.viewForm.knowledge_base_names)}catch(t){console.error("Error in initView:",t),this.$message.error("初始化查看表单时出错")}}))},f=_,v=(a("8a73"),a("2877")),h=Object(v["a"])(f,r,o,!1,null,"c0880ef0",null);t["default"]=h.exports},"8a73":function(e,t,a){"use strict";a("9898")},9898:function(e,t,a){}}]);