airi / assets /anthropic-DGsccWDp.js
nekomeowww's picture
release: build 9d9b5c427388bcc60fc5831b6027b16fe8f163ed
776b5c9
import"./live2d-zip-loader-CrhJsaag.js";import{d as k,q as x,bE as S,s as U,h as v,l as w,w as V,x as C,o as K,y as u,a as i,b as l,bH as p,e as t}from"./index-Cg3iS_yg.js";import{u as R}from"./providers-BDNQM8C4.js";import{_ as O,a as $}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Dtfi1xLK.js";import{_ as A}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-BdTE6i_T.js";import{_ as I,a as N}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-BbZ7ow8J.js";import{_ as B}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-B34TUPgm.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-f6OmvM5E.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-DmnWC9HI.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-DwAk1Dri.js";import"./Input.vue_vue_type_script_setup_true_lang-OBUHKbfs.js";const e="anthropic",J=k({__name:"anthropic",setup(T){const{t:c}=x(),_=S(),h=R(),{providers:a}=U(h),m=v(()=>h.getProviderMetadata(e)),s=v({get:()=>{var o;return((o=a.value[e])==null?void 0:o.apiKey)||""},set:o=>{a.value[e]||(a.value[e]={}),a.value[e].apiKey=o}}),n=v({get:()=>{var o;return((o=a.value[e])==null?void 0:o.baseUrl)||"https://api.anthropic.com/v1/"},set:o=>{a.value[e]||(a.value[e]={}),a.value[e].baseUrl=o}});w(()=>{var o,r;a.value[e]||(a.value[e]={baseUrl:"https://api.anthropic.com/v1/"}),s.value=((o=a.value[e])==null?void 0:o.apiKey)||"",n.value=((r=a.value[e])==null?void 0:r.baseUrl)||"https://api.anthropic.com/v1/"}),V([s,n],()=>{a.value[e]={...a.value[e],apiKey:s.value,baseUrl:n.value||"https://api.anthropic.com/v1/"}});function g(){a.value[e]={baseUrl:"https://api.anthropic.com/v1/"}}return(o,r)=>{var f,b;return K(),C(t(B),{"provider-name":((f=m.value)==null?void 0:f.localizedName)||"Anthropic | Claude","provider-icon":(b=m.value)==null?void 0:b.icon,"on-back":()=>t(_).back()},{default:u(()=>[r[2]||(r[2]=i("div",{bg:"orange-50 dark:orange-900/20","rounded-xl":"","p-4":"",flex:"~ col gap-3"},[i("h2",{"text-xl":"","font-bold":"",text:"orange-700 dark:orange-500"}," Before you start "),i("p",null,[p(" While Anthropic recently did announce that they are having a beta support for OpenAI SDK compatibility "),i("a",{underline:"",href:"https://docs.anthropic.com/en/api/openai-sdk"},"(you can read more here)"),p(", but due to the implementation details comes with "),i("a",{underline:"",href:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS"},"CORS"),p(" restrictions which not aligned with the OpenAI SDK, it's currently not possible to use this provider in the browser. ")]),i("p",null,[p(" If you do need to use this provider, you will need a dedicated proxy backend like a Serverless Function running on "),i("a",{underline:"",href:"https://workers.cloudflare.com/"},"Cloudflare Workers"),p(" or some CORS bypassing services to bypass the CORS restrictions. ")])],-1)),l(t(I),null,{default:u(()=>[l(t(N),{title:t(c)("settings.pages.providers.common.section.basic.title"),description:t(c)("settings.pages.providers.common.section.basic.description"),"on-reset":g},{default:u(()=>{var d;return[l(t(A),{modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=y=>s.value=y),"provider-name":((d=m.value)==null?void 0:d.localizedName)||"Anthropic",placeholder:"sk-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(O),{title:t(c)("settings.pages.providers.common.section.advanced.title")},{default:u(()=>[l(t($),{modelValue:n.value,"onUpdate:modelValue":r[1]||(r[1]=d=>n.value=d),placeholder:"https://api.anthropic.com/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{J as default};