99AI/public/admin/assets/pdf-DpqOMvmu.js
2024-07-07 22:44:05 +08:00

9 lines
6.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 由 Fantastic-admin 提供技术支持
* Powered by Fantastic-admin
* https://fantastic-admin.github.io
*/
import{_ as C}from"./index.vue_vue_type_script_setup_true_lang-DKdjIYRj.js";import{a as T}from"./config-BQ9gBCXa.js";import{d as k,m as q,r as V,a as K,n as s,g as N,c as D,b as e,w as l,e as m,h as S,E as B,k as U}from"./index-DEc4xym2.js";const E={class:"flex justify-between"},F=m("h2",null,"PDF 分析设置",-1),O=m("div",{style:{width:"250px"}},[m("p",null,"开启后、对话模型将会继承上一次对话的模型、默认开启")],-1),Q=k({__name:"pdf",setup(R){const o=q({openaiBaseUrl:"",openaiBaseKey:"",openaiTimeout:"",openaiBaseModel:"gpt-3.5-turbo",openaiTemperature:1,mjNotSaveImg:0,mjProxyImgUrl:"",systemPreMessage:"",mjNotUseProxy:1,isMjTranslate:0,mjTranslatePrompt:"",isDalleChat:1,isModelInherited:1}),j=V({openaiBaseUrl:[{required:!1,trigger:"blur",message:"请填写openai的请求地址"}],isMjTranslate:[{required:!1,trigger:"blur",message:"是否开启翻译/联想"}],isDalleChat:[{required:!1,trigger:"blur",message:"是否开启连续绘画"}],isModelInherited:[{required:!1,trigger:"blur",message:"是否继承模型"}],openaiTimeout:[{required:!1,trigger:"blur",message:"请填写openai的超时时间单位ms"}],openaiBaseModel:[{required:!1,trigger:"blur",message:"请填写全局模型,用于后台一些静默性赋能操作"}],openaiTemperature:[{required:!1,trigger:"blur",message:"请填写温度"}],mjTranslatePrompt:[{required:!1,trigger:"blur",message:"用于翻译 / 联想的提示词"}]}),h=V();async function M(){const p=await T.queryConfig({keys:["openaiBaseUrl","openaiBaseKey","openaiTimeout","openaiBaseModel","openaiTemperature","mjNotSaveImg","mjProxyImgUrl","systemPreMessage","mjNotUseProxy","isMjTranslate","mjTranslatePrompt","isDalleChat","isModelInherited"]}),{openaiBaseUrl:a="",openaiBaseKey:d="",openaiTimeout:c=300,openaiBaseModel:f="gpt-3.5-turbo",openaiTemperature:u=1,isMjTranslate:n="",mjNotSaveImg:r,mjProxyImgUrl:i,systemPreMessage:_,mjNotUseProxy:g,mjTranslatePrompt:b,isDalleChat:x,isModelInherited:y}=p.data;Object.assign(o,{openaiBaseUrl:a,openaiBaseKey:d,openaiTimeout:c,isMjTranslate:n,openaiTemperature:u,openaiBaseModel:f,mjNotSaveImg:r,mjProxyImgUrl:i,systemPreMessage:_,mjNotUseProxy:g,mjTranslatePrompt:b,isDalleChat:x,isModelInherited:y})}function w(){var p;(p=h.value)==null||p.validate(async a=>{if(a){try{await T.setConfig({settings:P(o)}),B.success("变更配置信息成功")}catch{}M()}else B.error("请填写完整信息")})}function P(p){return Object.keys(p).map(a=>({configKey:a,configVal:p[a]}))}return K(()=>{M()}),(p,a)=>{const d=s("el-alert"),c=C,f=s("el-button"),u=s("el-input"),n=s("el-form-item"),r=s("el-col"),i=s("el-row"),_=s("el-switch"),g=s("QuestionFilled"),b=s("el-icon"),x=s("el-tooltip"),y=s("el-input-number"),v=s("el-form"),I=s("el-card");return N(),D("div",null,[e(c,null,{default:l(()=>[e(d,{closable:!1,"show-icon":"",title:"全局配置说明",description:"系统默认的地址是 https://api.openai.com 、如果你是国内的服务器可能无法访问、您可以使用自己的代理地址、此处的配置为全局配置、我们可以对单张key进行单独设置、当我们对key不进行设置的时候将会走此处的设置、如果此处也没有设置、系统将会走系统内置默认配置",type:"success"})]),_:1}),e(I,{style:{margin:"20px"}},{header:l(()=>[m("div",E,[F,e(f,{class:"button",text:"",onClick:w},{default:l(()=>[S(" 保存设置 ")]),_:1})])]),default:l(()=>[e(v,{ref_key:"formRef",ref:h,rules:j.value,model:o,"label-width":"220px"},{default:l(()=>[e(i,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(n,{label:"请求地址",prop:"openaiBaseUrl","label-width":"120px"},{default:l(()=>[e(u,{modelValue:o.openaiBaseUrl,"onUpdate:modelValue":a[0]||(a[0]=t=>o.openaiBaseUrl=t),placeholder:"默认地址: https://api.openai.com 第三方代理推荐https://api.lightai.io",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(n,{label:"全局key",prop:"openaiBaseKey","label-width":"120px"},{default:l(()=>[e(u,{modelValue:o.openaiBaseKey,"onUpdate:modelValue":a[1]||(a[1]=t=>o.openaiBaseKey=t),placeholder:"请填写模型全局 Key 信息,当模型 Key 为空时调用",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(n,{label:"全局模型",prop:"openaiBaseModel","label-width":"120px"},{default:l(()=>[e(u,{modelValue:o.openaiBaseModel,"onUpdate:modelValue":a[2]||(a[2]=t=>o.openaiBaseModel=t),placeholder:"全局模型配置,用于后台一些静默赋能操作",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(n,{label:"继承对话模型",prop:"isModelInherited","label-width":"120"},{default:l(()=>[e(_,{modelValue:o.isModelInherited,"onUpdate:modelValue":a[3]||(a[3]=t=>o.isModelInherited=t),"active-value":"1","inactive-value":"0"},null,8,["modelValue"]),e(x,{class:"box-item",effect:"dark",placement:"right"},{content:l(()=>[O]),default:l(()=>[e(b,{class:"ml-3 cursor-pointer"},{default:l(()=>[e(g)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(n,{label:"Temperature",prop:"openaiTemperature","label-width":"120px"},{default:l(()=>[e(y,{modelValue:o.openaiTemperature,"onUpdate:modelValue":a[4]||(a[4]=t=>o.openaiTemperature=t),"controls-position":"right",min:0,max:2,step:.1,placeholder:"模型 Temperature 设置默认1",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(n,{label:"超时时间",prop:"openaiTimeout","label-width":"120px"},{default:l(()=>[e(u,{modelValue:o.openaiTimeout,"onUpdate:modelValue":a[5]||(a[5]=t=>o.openaiTimeout=t),placeholder:"openai超时时间设置、默认300s 单位s",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(n,{label:"全局头部预设",prop:"systemPreMessage","label-width":"120px"},{default:l(()=>[e(u,{modelValue:o.systemPreMessage,"onUpdate:modelValue":a[6]||(a[6]=t=>o.systemPreMessage=t),type:"textarea",rows:8,placeholder:"请填写模型全局头部预设信息!",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof U=="function"&&U(Q);export{Q as default};