File size: 3,716 Bytes
d8d73ee
1
import{computed as e,createBaseVNode as t,createBlock as n,createTextVNode as r,createVNode as i,defineComponent as a,onMounted as o,openBlock as s,storeToRefs as c,unref as l,useI18n as u,useRouter as d,watch as f,withCtx as p}from"./index-BtAisBe9.js";import"./import-url-browser-BvZvAmFy.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-s07e23Qe.js";import"./types-D50Xq0so.js";import{useProvidersStore as m}from"./stores-mOXXrrXB.js";import"./Button-BUWHo0FI.js";import"./src-bHDRqBSs.js";import{ProviderAdvancedSettings_default as h,ProviderApiKeyInput_default as g,ProviderBaseUrlInput_default as _,ProviderBasicSettings_default as v,ProviderSettingsContainer_default as y,ProviderSettingsLayout_default as b}from"./components-B-QNW1cA.js";import"./composables-DnqWi3UL.js";import"./queue-BZUURX31.js";import"./queues-U6a2FwNq.js";import"./dist-DQi82Mjd.js";import"./webgpu-Cnn5XZ2r.js";import{route_block_default as x}from"./route-block-DNPbw0zT.js";const S=`anthropic`;var C=a({__name:`anthropic`,setup(a){let{t:x}=u(),C=d(),w=m(),{providers:T}=c(w),E=e(()=>w.getProviderMetadata(S)),D=e({get:()=>{var e;return(e=T.value[S])?.apiKey||``},set:e=>{T.value[S]||(T.value[S]={}),T.value[S].apiKey=e}}),O=e({get:()=>{var e;return(e=T.value[S])?.baseUrl||`https://api.anthropic.com/v1/`},set:e=>{T.value[S]||(T.value[S]={}),T.value[S].baseUrl=e}});o(()=>{var e,t;T.value[S]||(T.value[S]={baseUrl:`https://api.anthropic.com/v1/`}),D.value=(e=T.value[S])?.apiKey||``,O.value=(t=T.value[S])?.baseUrl||`https://api.anthropic.com/v1/`}),f([D,O],()=>{T.value[S]={...T.value[S],apiKey:D.value,baseUrl:O.value||`https://api.anthropic.com/v1/`}});function k(){T.value[S]={baseUrl:`https://api.anthropic.com/v1/`}}return(e,a)=>{var o,c;return s(),n(l(b),{"provider-name":(o=E.value)?.localizedName||`Anthropic | Claude`,"provider-icon":(c=E.value)?.icon,"on-back":()=>l(C).back()},{default:p(()=>[a[2]||=t(`div`,{bg:`orange-50 dark:orange-900/20`,"rounded-xl":``,"p-4":``,flex:`~ col gap-3`},[t(`h2`,{"text-xl":``,"font-semibold":``,text:`orange-700 dark:orange-500`},` Before you start `),t(`p`,null,[r(` While Anthropic recently did announce that they are having a beta support for OpenAI SDK compatibility `),t(`a`,{underline:``,href:`https://docs.anthropic.com/en/api/openai-sdk`},`(you can read more here)`),r(`, but due to the implementation details comes with `),t(`a`,{underline:``,href:`https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS`},`CORS`),r(` restrictions which not aligned with the OpenAI SDK, it's currently not possible to use this provider in the browser. `)]),t(`p`,null,[r(` If you do need to use this provider, you will need a dedicated proxy backend like a Serverless Function running on `),t(`a`,{underline:``,href:`https://workers.cloudflare.com/`},`Cloudflare Workers`),r(` or some CORS bypassing services to bypass the CORS restrictions. `)])],-1),i(l(y),null,{default:p(()=>[i(l(v),{title:l(x)(`settings.pages.providers.common.section.basic.title`),description:l(x)(`settings.pages.providers.common.section.basic.description`),"on-reset":k},{default:p(()=>{var e;return[i(l(g),{modelValue:D.value,"onUpdate:modelValue":a[0]||=e=>D.value=e,"provider-name":(e=E.value)?.localizedName||`Anthropic`,placeholder:`sk-...`},null,8,[`modelValue`,`provider-name`])]}),_:1},8,[`title`,`description`]),i(l(h),{title:l(x)(`settings.pages.providers.common.section.advanced.title`)},{default:p(()=>[i(l(_),{modelValue:O.value,"onUpdate:modelValue":a[1]||=e=>O.value=e,placeholder:`https://api.anthropic.com/v1/`},null,8,[`modelValue`])]),_:1},8,[`title`])]),_:1})]),_:1,__:[2]},8,[`provider-name`,`provider-icon`,`on-back`])}}});typeof x==`function`&&x(C);var w=C;export{w as default};