import{aa as i,ab as E}from"./_applist-tangy-colts-beg-36.js";import{_ as t}from"./main-tangy-colts-beg.js";import{h as a,s}from"./machine.-tangy-colts-beg-869.js";import{f as l}from"./machineh-tangy-colts-beg-167.js";import{h as p,c as d}from"./openrout-tangy-colts-beg-719.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(o,e){return this.cache.has(o)?this.cache.get(o):(this.cache.set(o,e),e)}};const N=i(({helpers:o})=>({states:{components:[d(o),{componentName:o.componentName.select,helperText:t("Select the AI model to use for generating the completion."),id:"model-id",label:t("Model"),onChange:"HANDLE_MODEL_CHANGE",onRefetch:"REFETCH_MODELS",optionFilterProp:"label",options:[],path:"model",placeholder:t("Select a Model"),render:"IF_CONNECTION_SELECTED",required:!0,showSearch:!0,value:void 0},{componentName:o.componentName.switch,id:"show-advance-feature",label:t("Show Advance Feature"),onChange:"SET_FEATURE",path:"advance-feature",render:"IF_MODEL_SELECTED",size:"small",value:!1},{componentName:o.componentName.mixInput,helperText:t("Controls randomness: 0 is focused and deterministic, 1 is more creative. Range: 0-2"),id:"temperature",label:t("Temperature"),onChange:"SET_TEMPERATURE",path:"temperature",render:"IF_ADVANCE_FEATURE_SELECTED",required:!1,value:[]},{componentName:o.componentName.mixInput,helperText:t("Nucleus sampling: consider only tokens with top_p probability mass. Range: 0-1"),id:"top-p",label:t("Top P"),onChange:"SET_TOP_P",path:"top_p",render:"IF_ADVANCE_FEATURE_SELECTED",required:!1,value:[]},{componentName:o.componentName.mixInput,helperText:t("Penalty for repeated tokens. Positive values discourage repetition. Range: -2 to 2"),id:"frequency-penalty",label:t("Frequency Penalty"),onChange:"SET_FREQUENCY_PENALTY",path:"frequency_penalty",render:"IF_ADVANCE_FEATURE_SELECTED",required:!1,value:[]},{componentName:o.componentName.mixInput,helperText:t("Penalty for new topics. Positive values encourage new topics. Range: -2 to 2"),id:"presence-penalty",label:t("Presence Penalty"),onChange:"SET_PRESENCE_PENALTY",path:"presence_penalty",render:"IF_ADVANCE_FEATURE_SELECTED",required:!1,value:[]},{allowClear:!0,componentName:o.componentName.select,helperText:t("Choose the response format. JSON mode forces the model to return valid JSON."),id:"response-format",label:t("Response Format"),onChange:"HANDLE_RESPONSE_FORMAT",options:[{label:t("Text"),value:"text"},{label:t("JSON Object"),value:"json_object"}],path:"response_format.type",render:"IF_ADVANCE_FEATURE_SELECTED",required:!1,value:"text"},{componentName:o.componentName.mixInput,helperText:t("Random seed for deterministic sampling. Use the same seed to get consistent results."),id:"seed",label:t("Seed"),onChange:"SET_SEED",path:"seed",render:"IF_ADVANCE_FEATURE_SELECTED",required:!1,value:[]}]},actions:{CONNECTION_ADD_CHANGE:p,HANDLE_MODEL_CHANGE:a("modelId"),HANDLE_RESPONSE_FORMAT:a("responseFormat"),IF_CONNECTION_SELECTED:({$:e})=>{var n;return E((n=e.getComponent("connection-id"))==null?void 0:n.value)},IF_MODEL_SELECTED:({$:e})=>{var n;return E((n=e.getComponent("model-id"))==null?void 0:n.value)},REFETCH_MODELS:({$:e})=>l(e),SET_FEATURE:a("showAdvanceFeature"),SET_FREQUENCY_PENALTY:a("frequencyPenalty"),SET_PRESENCE_PENALTY:a("presencePenalty"),SET_SEED:a("seed"),SET_TEMPERATURE:a("temperature"),SET_TOP_P:a("topP"),IF_MEMORY_KEY_SWITCH:({$:e})=>{var n,r;return E((n=e.getComponent("connection-id"))==null?void 0:n.value)&&((r=e.getComponent("memory-key-switch"))==null?void 0:r.value)===!0},IF_ADVANCE_FEATURE_SELECTED:({$:e})=>{var n,r;return E((n=e.getComponent("connection-id"))==null?void 0:n.value)&&((r=e.getComponent("show-advance-feature"))==null?void 0:r.value)===!0},SET_CONNECTION:({$:e,e:n})=>{a("connectionId")({$:e,e:n}),l(e)},ON_MACHINE_LOAD:({$:e})=>{s(e,[{db:"connectionId",id:"connection-id"},{db:"modelId",id:"model-id"},{db:"temperature",id:"temperature"},{db:"topP",id:"top-p"},{db:"frequencyPenalty",id:"frequency-penalty"},{db:"presencePenalty",id:"presence-penalty"},{db:"responseFormat",id:"response-format"},{db:"seed",id:"seed"},{db:"showAdvanceFeature",id:"show-advance-feature"}]),l(e)}}}));export{N as default};
