aiex-cli 0.0.1-beta.15 → 0.0.1-beta.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { C as formatDoctorDiagnosticsJson, S as doctorDiagnosticsTableRows, _ as JsonSchemaDefinitionSchema, a as DEFAULT_PROMPT_CONFIG, b as generateDrizzleSchema, c as AIConfigSchema, d as description, f as name, h as createMigrationConfig, i as writeAIConfig, l as createConfig, m as version, n as getDefaultAIConfig, o as PLACEHOLDER_SCHEMA, p as package_default, r as readAIConfig, s as PLACEHOLDER_TEXT, t as collectDoctorDiagnostics, u as seedConfig, v as parseJsonSchema, y as toSnakeCase } from "./doctor-C98H0Qz4.mjs";
1
+ import { C as formatDoctorDiagnosticsJson, S as doctorDiagnosticsTableRows, _ as JsonSchemaDefinitionSchema, a as DEFAULT_PROMPT_CONFIG, b as generateDrizzleSchema, c as AIConfigSchema, d as description, f as name, h as createMigrationConfig, i as writeAIConfig, l as createConfig, m as version, n as getDefaultAIConfig, o as PLACEHOLDER_SCHEMA, p as package_default, r as readAIConfig, s as PLACEHOLDER_TEXT, t as collectDoctorDiagnostics, u as seedConfig, v as parseJsonSchema, y as toSnakeCase } from "./doctor-1Z6k4yT5.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import process from "node:process";
@@ -13107,13 +13107,21 @@ async function extractStructuredData(input) {
13107
13107
  const inputTokens = text ? Math.ceil(text.length / 2) : void 0;
13108
13108
  const fieldCount = schema.properties ? Object.keys(schema.properties).length : 0;
13109
13109
  const outputTokens = fieldCount > 0 ? fieldCount * 80 : void 0;
13110
- const selected = modelOverride ?? selectModel({
13111
- models: config.provider.models,
13112
- isImage: isImageFile,
13113
- fileName: file,
13114
- inputTokens,
13115
- outputTokens
13116
- });
13110
+ let selected;
13111
+ try {
13112
+ selected = modelOverride ?? selectModel({
13113
+ models: config.provider.models,
13114
+ isImage: isImageFile,
13115
+ fileName: file,
13116
+ inputTokens,
13117
+ outputTokens
13118
+ });
13119
+ } catch (e) {
13120
+ return {
13121
+ success: false,
13122
+ error: e.message
13123
+ };
13124
+ }
13117
13125
  const useStructuredOutput = selected.capabilities.structuredOutput;
13118
13126
  const useTelemetry = !!(config.langfuse?.publicKey && config.langfuse.secretKey);
13119
13127
  try {
@@ -13137,6 +13145,7 @@ async function extractStructuredData(input) {
13137
13145
  }
13138
13146
  const outputSchema = jsonSchema(schemaToExtractionOutputSchema(schema));
13139
13147
  let result;
13148
+ const timeoutMs = (config.provider.timeout ?? 300) * 1e3;
13140
13149
  if (useFileContent) {
13141
13150
  const filePart = await readFilePart(file);
13142
13151
  const fileName = filePart.type === "file" ? filePart.filename : path.basename(file);
@@ -13151,7 +13160,7 @@ async function extractStructuredData(input) {
13151
13160
  role: "user",
13152
13161
  content: contentParts
13153
13162
  }],
13154
- abortSignal: AbortSignal.timeout(12e4),
13163
+ abortSignal: AbortSignal.timeout(timeoutMs),
13155
13164
  maxRetries: 0,
13156
13165
  experimental_telemetry: { isEnabled: useTelemetry }
13157
13166
  };
@@ -13162,7 +13171,7 @@ async function extractStructuredData(input) {
13162
13171
  model: provider.chatModel(selected.name),
13163
13172
  system,
13164
13173
  prompt: user,
13165
- abortSignal: AbortSignal.timeout(6e4),
13174
+ abortSignal: AbortSignal.timeout(timeoutMs),
13166
13175
  maxRetries: 0,
13167
13176
  experimental_telemetry: { isEnabled: useTelemetry }
13168
13177
  };
@@ -411,7 +411,7 @@ function generateDrizzleConfig() {
411
411
  //#endregion
412
412
  //#region package.json
413
413
  var name = "aiex-cli";
414
- var version = "0.0.1-beta.15";
414
+ var version = "0.0.1-beta.17";
415
415
  var description = "JSON Schema → SQLite with AI-powered data extraction";
416
416
  var package_default = {
417
417
  name,
@@ -534,7 +534,8 @@ const AIModelConfigSchema = z.object({
534
534
  const AIProviderConfigSchema = z.object({
535
535
  baseURL: z.string().min(1),
536
536
  apiKey: z.string(),
537
- models: z.array(AIModelConfigSchema).min(1)
537
+ models: z.array(AIModelConfigSchema).min(1),
538
+ timeout: z.number().int().positive().default(300).optional()
538
539
  });
539
540
  const PromptConfigSchema = z.object({
540
541
  systemTemplate: z.string().min(1),
@@ -573,7 +574,8 @@ const DEFAULT_MODELS = [{
573
574
  const DEFAULT_PROVIDER_CONFIG = {
574
575
  baseURL: "https://dashscope.aliyuncs.com/compatible-mode/v1",
575
576
  apiKey: "",
576
- models: [...DEFAULT_MODELS]
577
+ models: [...DEFAULT_MODELS],
578
+ timeout: 300
577
579
  };
578
580
  const DEFAULT_PROMPT_CONFIG = {
579
581
  systemTemplate: `You are a professional data extraction assistant. Your task is to extract structured data from text and return a JSON object based on the data structure definition provided below.
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { C as formatDoctorDiagnosticsJson, S as doctorDiagnosticsTableRows, _ as JsonSchemaDefinitionSchema, b as generateDrizzleSchema, g as generateDrizzleConfig, h as createMigrationConfig, t as collectDoctorDiagnostics, v as parseJsonSchema, x as buildDoctorDiagnostics } from "./doctor-C98H0Qz4.mjs";
1
+ import { C as formatDoctorDiagnosticsJson, S as doctorDiagnosticsTableRows, _ as JsonSchemaDefinitionSchema, b as generateDrizzleSchema, g as generateDrizzleConfig, h as createMigrationConfig, t as collectDoctorDiagnostics, v as parseJsonSchema, x as buildDoctorDiagnostics } from "./doctor-1Z6k4yT5.mjs";
2
2
 
3
3
  export { JsonSchemaDefinitionSchema, buildDoctorDiagnostics, collectDoctorDiagnostics, createMigrationConfig, doctorDiagnosticsTableRows, formatDoctorDiagnosticsJson, generateDrizzleConfig, generateDrizzleSchema, parseJsonSchema };
@@ -322,7 +322,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
322
322
  padding-block: dt('textarea.lg.padding.y');
323
323
  padding-inline: dt('textarea.lg.padding.x');
324
324
  }
325
- `,classes:{root:function(e){var t=e.instance,n=e.props;return[`p-textarea p-component`,{"p-filled":t.$filled,"p-textarea-resizable ":n.autoResize,"p-textarea-sm p-inputfield-sm":n.size===`small`,"p-textarea-lg p-inputfield-lg":n.size===`large`,"p-invalid":t.$invalid,"p-variant-filled":t.$variant===`filled`,"p-textarea-fluid":t.$fluid}]}}}),nt={name:`BaseTextarea`,extends:I,props:{autoResize:Boolean},style:tt,provide:function(){return{$pcTextarea:this,$parentInstance:this}}};function Q(e){"@babel/helpers - typeof";return Q=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Q(e)}function rt(e,t,n){return(t=it(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function it(e){var t=at(e,`string`);return Q(t)==`symbol`?t:t+``}function at(e,t){if(Q(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Q(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var $={name:`Textarea`,extends:nt,inheritAttrs:!1,observer:null,mounted:function(){var e=this;this.autoResize&&(this.observer=new ResizeObserver(function(){requestAnimationFrame(function(){e.resize()})}),this.observer.observe(this.$el))},updated:function(){this.autoResize&&this.resize()},beforeUnmount:function(){this.observer&&this.observer.disconnect()},methods:{resize:function(){if(this.$el.offsetParent){var e=this.$el.style.height,t=parseInt(e)||0,n=this.$el.scrollHeight;t&&n<t?(this.$el.style.height=`auto`,this.$el.style.height=`${this.$el.scrollHeight}px`):(!t||n>t)&&(this.$el.style.height=`${n}px`)}},onInput:function(e){this.autoResize&&this.resize(),this.writeValue(e.target.value,e)}},computed:{attrs:function(){return g(this.ptmi(`root`,{context:{filled:this.$filled,disabled:this.disabled}}),this.formField)},dataP:function(){return u(rt({invalid:this.$invalid,fluid:this.$fluid,filled:this.$variant===`filled`},this.size,this.size))}}},ot=[`value`,`name`,`disabled`,`aria-invalid`,`data-p`];function st(e,t,n,r,i,a){return b(),O(`textarea`,g({class:e.cx(`root`),value:e.d_value,name:e.name,disabled:e.disabled,"aria-invalid":e.invalid||void 0,"data-p":a.dataP,onInput:t[0]||=function(){return a.onInput&&a.onInput.apply(a,arguments)}},a.attrs),null,16,ot)}$.render=st;var ct={key:0,class:`flex items-center justify-center py-8`},lt={key:1,class:`space-y-6`},ut={class:`space-y-3`},dt={class:`flex flex-col gap-1`},ft={class:`flex flex-col gap-1`},pt={class:`space-y-3`},mt={class:`flex items-center gap-2`},ht={key:0,class:`space-y-3 pl-6 border-l-2 border-border`},gt={class:`flex flex-col gap-1`},_t={class:`flex flex-col gap-1`},vt={class:`flex flex-col gap-1`},yt={class:`space-y-2`},bt={class:`text-sm font-mono flex-1`},xt={key:0,class:`flex flex-col gap-2 px-3 py-2 rounded border border-border bg-card`},St={class:`flex items-center gap-2`},Ct={class:`flex items-center gap-4 text-xs`},wt={class:`flex items-center gap-1.5 cursor-pointer`},Tt={class:`flex items-center gap-1.5 cursor-pointer`},Et={key:0,class:`text-muted-foreground ml-auto`},Dt={class:`space-y-3`},Ot={class:`flex flex-col gap-1`},kt={key:0,class:`text-xs text-red-500 mt-1`},At={class:`flex flex-col gap-1`},jt={key:0,class:`text-xs text-red-500 mt-1`},Mt={class:`flex justify-between`},Nt={class:`flex gap-2`},Pt=`You are a professional data extraction assistant. Your task is to extract structured data from text and return a JSON object based on the data structure definition provided below.
325
+ `,classes:{root:function(e){var t=e.instance,n=e.props;return[`p-textarea p-component`,{"p-filled":t.$filled,"p-textarea-resizable ":n.autoResize,"p-textarea-sm p-inputfield-sm":n.size===`small`,"p-textarea-lg p-inputfield-lg":n.size===`large`,"p-invalid":t.$invalid,"p-variant-filled":t.$variant===`filled`,"p-textarea-fluid":t.$fluid}]}}}),nt={name:`BaseTextarea`,extends:I,props:{autoResize:Boolean},style:tt,provide:function(){return{$pcTextarea:this,$parentInstance:this}}};function Q(e){"@babel/helpers - typeof";return Q=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Q(e)}function rt(e,t,n){return(t=it(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function it(e){var t=at(e,`string`);return Q(t)==`symbol`?t:t+``}function at(e,t){if(Q(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Q(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var $={name:`Textarea`,extends:nt,inheritAttrs:!1,observer:null,mounted:function(){var e=this;this.autoResize&&(this.observer=new ResizeObserver(function(){requestAnimationFrame(function(){e.resize()})}),this.observer.observe(this.$el))},updated:function(){this.autoResize&&this.resize()},beforeUnmount:function(){this.observer&&this.observer.disconnect()},methods:{resize:function(){if(this.$el.offsetParent){var e=this.$el.style.height,t=parseInt(e)||0,n=this.$el.scrollHeight;t&&n<t?(this.$el.style.height=`auto`,this.$el.style.height=`${this.$el.scrollHeight}px`):(!t||n>t)&&(this.$el.style.height=`${n}px`)}},onInput:function(e){this.autoResize&&this.resize(),this.writeValue(e.target.value,e)}},computed:{attrs:function(){return g(this.ptmi(`root`,{context:{filled:this.$filled,disabled:this.disabled}}),this.formField)},dataP:function(){return u(rt({invalid:this.$invalid,fluid:this.$fluid,filled:this.$variant===`filled`},this.size,this.size))}}},ot=[`value`,`name`,`disabled`,`aria-invalid`,`data-p`];function st(e,t,n,r,i,a){return b(),O(`textarea`,g({class:e.cx(`root`),value:e.d_value,name:e.name,disabled:e.disabled,"aria-invalid":e.invalid||void 0,"data-p":a.dataP,onInput:t[0]||=function(){return a.onInput&&a.onInput.apply(a,arguments)}},a.attrs),null,16,ot)}$.render=st;var ct={key:0,class:`flex items-center justify-center py-8`},lt={key:1,class:`space-y-6`},ut={class:`space-y-3`},dt={class:`flex flex-col gap-1`},ft={class:`flex flex-col gap-1`},pt={class:`flex flex-col gap-1`},mt={class:`space-y-2`},ht={class:`text-sm font-mono flex-1`},gt={key:0,class:`flex flex-col gap-2 px-3 py-2 rounded border border-border bg-card`},_t={class:`flex items-center gap-2`},vt={class:`flex items-center gap-4 text-xs`},yt={class:`flex items-center gap-1.5 cursor-pointer`},bt={class:`flex items-center gap-1.5 cursor-pointer`},xt={key:0,class:`text-muted-foreground ml-auto`},St={class:`space-y-3`},Ct={class:`flex items-center gap-2`},wt={key:0,class:`space-y-3 pl-6 border-l-2 border-border`},Tt={class:`flex flex-col gap-1`},Et={class:`flex flex-col gap-1`},Dt={class:`flex flex-col gap-1`},Ot={class:`space-y-3`},kt={class:`flex flex-col gap-1`},At={key:0,class:`text-xs text-red-500 mt-1`},jt={class:`flex flex-col gap-1`},Mt={key:0,class:`text-xs text-red-500 mt-1`},Nt={class:`flex justify-between`},Pt={class:`flex gap-2`},Ft=`You are a professional data extraction assistant. Your task is to extract structured data from text and return a JSON object based on the data structure definition provided below.
326
326
 
327
327
  {schema}
328
328
 
@@ -330,5 +330,5 @@ Extraction requirements:
330
330
  1. Extract data strictly according to the field names and types defined in the structure
331
331
  2. If a field's information is missing from the text, set that field to null
332
332
  3. Do not add fields that are not in the structure definition
333
- 4. Maintain data accuracy and completeness`,Ft=`Please extract data from the following text:
334
- {text}`,It=M({__name:`AISettings`,props:{visible:{type:Boolean,default:!1},visibleModifiers:{}},emits:[`update:visible`],setup(e){let t=re(e,`visible`),n=h(!1),r=h(!1),i=h(`https://dashscope.aliyuncs.com/compatible-mode/v1`),a=h(``),o=h([]),c=h(``),l=h(``),u=h(!1),d=h(``),f=h(``),p=h(``),m=h(!1),g=h(``),_=h({vision:!1,structuredOutput:!1}),y=h(`manual`);function A(){y.value=`manual`,_.value={vision:!1,structuredOutput:!1},g.value&&ue(g.value).then(e=>{e&&(_.value={...e},y.value=`registry`)})}function M(){g.value&&(o.value.push({name:g.value,capabilities:{..._.value}}),P())}function N(){P()}function P(){g.value=``,_.value={vision:!1,structuredOutput:!1},y.value=`manual`,m.value=!1}function I(e){o.value.splice(e,1)}let L=j(()=>c.value.includes(`{schema}`)?``:`System prompt must contain the {schema} placeholder`),R=j(()=>l.value.includes(`{text}`)?``:`User prompt must contain the {text} placeholder`),z=j(()=>!L.value&&!R.value&&!n.value&&o.value.length>0);async function B(){n.value=!0;try{let e=await le();i.value=e.provider.baseURL,a.value=e.provider.apiKey,o.value=e.provider.models??[],c.value=e.prompt.systemTemplate,l.value=e.prompt.userTemplate,u.value=!!e.langfuse,d.value=e.langfuse?.publicKey??``,f.value=e.langfuse?.secretKey??``,p.value=e.langfuse?.host??``}catch{a.value=``,o.value=[],c.value=Pt,l.value=Ft}finally{n.value=!1}}async function V(){if(z.value){r.value=!0;try{await se({provider:{baseURL:i.value,apiKey:a.value,models:o.value},prompt:{systemTemplate:c.value,userTemplate:l.value},extraction:{outputDir:`.aiex/extracted`},langfuse:u.value?{publicKey:d.value,secretKey:f.value,host:p.value||void 0}:void 0}),t.value=!1}catch(e){ce.error(e.message||`Failed to save`)}finally{r.value=!1}}}function de(){i.value=`https://dashscope.aliyuncs.com/compatible-mode/v1`,o.value=[{name:`qwen-plus`,capabilities:{vision:!1,structuredOutput:!0}},{name:`qwen-vl-plus`,capabilities:{vision:!0,structuredOutput:!0}}],c.value=Pt,l.value=Ft,u.value=!1,d.value=``,f.value=``,p.value=``}return ae(()=>{B()}),ne(()=>{}),(e,h)=>(b(),T(D(ee),{visible:t.value,"onUpdate:visible":h[13]||=e=>t.value=e,modal:``,header:`AI Settings`,style:{width:`680px`},draggable:!1},{footer:v(()=>[w(`div`,Mt,[x(D(s),{label:`Reset Defaults`,icon:`pi pi-replay`,severity:`secondary`,text:``,onClick:de}),w(`div`,Nt,[x(D(s),{label:`Cancel`,severity:`secondary`,text:``,onClick:h[12]||=e=>t.value=!1}),x(D(s),{label:`Save`,icon:`pi pi-check`,loading:r.value,disabled:!z.value,onClick:V},null,8,[`loading`,`disabled`])])])]),default:v(()=>[n.value?(b(),O(`div`,ct,[...h[14]||=[w(`i`,{class:`pi pi-spin pi-spinner text-xl`},null,-1)]])):(b(),O(`div`,lt,[w(`section`,null,[h[17]||=w(`h3`,{class:`text-sm font-semibold mb-3 text-foreground`},` Provider `,-1),w(`div`,ut,[w(`div`,dt,[h[15]||=w(`label`,{class:`text-xs text-muted-foreground`},`Base URL`,-1),x(D(F),{modelValue:i.value,"onUpdate:modelValue":h[0]||=e=>i.value=e,size:`small`,placeholder:`https://dashscope.aliyuncs.com/compatible-mode/v1`},null,8,[`modelValue`])]),w(`div`,ft,[h[16]||=w(`label`,{class:`text-xs text-muted-foreground`},`API Key`,-1),x(D(Y),{modelValue:a.value,"onUpdate:modelValue":h[1]||=e=>a.value=e,feedback:!1,"toggle-mask":``,size:`small`,placeholder:`sk-xxx`,"input-class":`w-full`},null,8,[`modelValue`])])])]),w(`section`,null,[h[22]||=w(`h3`,{class:`text-sm font-semibold mb-3 text-foreground`},` Langfuse Tracing `,-1),w(`div`,pt,[w(`div`,mt,[x(D(G),{modelValue:u.value,"onUpdate:modelValue":h[2]||=e=>u.value=e,binary:!0,"input-id":`lf-enabled`},null,8,[`modelValue`]),h[18]||=w(`label`,{for:`lf-enabled`,class:`text-sm cursor-pointer`},`Enabled`,-1)]),u.value?(b(),O(`div`,ht,[w(`div`,gt,[h[19]||=w(`label`,{class:`text-xs text-muted-foreground`},`Secret Key`,-1),x(D(Y),{modelValue:f.value,"onUpdate:modelValue":h[3]||=e=>f.value=e,feedback:!1,"toggle-mask":``,size:`small`,placeholder:`sk-lf-...`,"input-class":`w-full`},null,8,[`modelValue`])]),w(`div`,_t,[h[20]||=w(`label`,{class:`text-xs text-muted-foreground`},`Public Key`,-1),x(D(F),{modelValue:d.value,"onUpdate:modelValue":h[4]||=e=>d.value=e,size:`small`,placeholder:`pk-lf-...`},null,8,[`modelValue`])]),w(`div`,vt,[h[21]||=w(`label`,{class:`text-xs text-muted-foreground`},`Host (optional)`,-1),x(D(F),{modelValue:p.value,"onUpdate:modelValue":h[5]||=e=>p.value=e,size:`small`,placeholder:`https://us.cloud.langfuse.com`},null,8,[`modelValue`])])])):k(``,!0)])]),w(`section`,null,[h[24]||=w(`h3`,{class:`text-sm font-semibold mb-3 text-foreground`},` Models `,-1),w(`div`,yt,[(b(!0),O(ie,null,te(o.value,(e,t)=>(b(),O(`div`,{key:t,class:`flex items-center gap-2 px-3 py-2 rounded border border-border bg-card`},[w(`code`,bt,C(e.name),1),w(`span`,{class:S([`inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded`,e.capabilities.structuredOutput?`bg-green-500/10 text-green-600`:`bg-yellow-500/10 text-yellow-600`])},[w(`i`,{class:S([e.capabilities.structuredOutput?`pi pi-check-circle`:`pi pi-exclamation-triangle`,`text-[10px]`])},null,2),E(` `+C(e.capabilities.structuredOutput?`Structured Output`:`Text-only Output`),1)],2),w(`span`,{class:S([`inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded`,e.capabilities.vision?`bg-green-500/10 text-green-600`:`bg-red-500/10 text-red-600`])},[w(`i`,{class:S([e.capabilities.vision?`pi pi-check-circle`:`pi pi-times-circle`,`text-[10px]`])},null,2),E(` `+C(e.capabilities.vision?`Vision Supported`:`Vision Unsupported`),1)],2),x(D(s),{icon:`pi pi-times`,severity:`danger`,text:``,size:`small`,onClick:e=>I(t)},null,8,[`onClick`])]))),128)),m.value?(b(),O(`div`,xt,[w(`div`,St,[x(D(F),{modelValue:g.value,"onUpdate:modelValue":h[6]||=e=>g.value=e,size:`small`,placeholder:`Model name (e.g. gpt-4o)`,class:`flex-1 font-mono`,onInput:A,onKeyup:oe(M,[`enter`])},null,8,[`modelValue`]),x(D(s),{icon:`pi pi-check`,severity:`success`,text:``,size:`small`,disabled:!g.value,onClick:M},null,8,[`disabled`]),x(D(s),{icon:`pi pi-times`,severity:`secondary`,text:``,size:`small`,onClick:N})]),w(`div`,Ct,[w(`label`,wt,[x(D(G),{modelValue:_.value.structuredOutput,"onUpdate:modelValue":h[7]||=e=>_.value.structuredOutput=e,binary:!0,"input-id":`add-so`},null,8,[`modelValue`]),w(`span`,{class:S(_.value.structuredOutput?`text-green-600`:`text-muted-foreground`)},` Structured Output `,2)]),w(`label`,Tt,[x(D(G),{modelValue:_.value.vision,"onUpdate:modelValue":h[8]||=e=>_.value.vision=e,binary:!0,"input-id":`add-vision`},null,8,[`modelValue`]),w(`span`,{class:S(_.value.vision?`text-green-600`:`text-muted-foreground`)},` Vision `,2)]),y.value===`registry`?(b(),O(`span`,Et,[...h[23]||=[w(`i`,{class:`pi pi-database mr-0.5`},null,-1),E(`Registry `,-1)]])):k(``,!0)])])):(b(),T(D(s),{key:1,label:`Add Model`,icon:`pi pi-plus`,severity:`secondary`,text:``,size:`small`,onClick:h[9]||=e=>m.value=!0}))])]),w(`section`,null,[h[28]||=w(`h3`,{class:`text-sm font-semibold mb-3 text-foreground`},` Prompt Templates `,-1),w(`div`,Dt,[w(`div`,Ot,[h[25]||=w(`label`,{class:`text-xs text-muted-foreground`},`System Prompt`,-1),x(D($),{modelValue:c.value,"onUpdate:modelValue":h[10]||=e=>c.value=e,rows:`6`,"auto-resize":``,class:`text-xs font-mono`},null,8,[`modelValue`]),L.value?(b(),O(`p`,kt,C(L.value),1)):k(``,!0)]),w(`div`,At,[h[26]||=w(`label`,{class:`text-xs text-muted-foreground`},`User Prompt`,-1),x(D($),{modelValue:l.value,"onUpdate:modelValue":h[11]||=e=>l.value=e,rows:`6`,"auto-resize":``,class:`text-xs font-mono`},null,8,[`modelValue`]),R.value?(b(),O(`p`,jt,C(R.value),1)):k(``,!0)]),h[27]||=w(`div`,{class:`text-xs text-muted-foreground p-2 rounded border border-border`},[E(` Placeholders: `),w(`code`,{class:`bg-secondary px-1 rounded`},`{schema}`),E(` JSON Schema structure description, `),w(`code`,{class:`bg-secondary px-1 rounded`},`{text}`),E(` text to extract from `)],-1)])])]))]),_:1},8,[`visible`]))}});export{It as default};
333
+ 4. Maintain data accuracy and completeness`,It=`Please extract data from the following text:
334
+ {text}`,Lt=M({__name:`AISettings`,props:{visible:{type:Boolean,default:!1},visibleModifiers:{}},emits:[`update:visible`],setup(e){let t=re(e,`visible`),n=h(!1),r=h(!1),i=h(`https://dashscope.aliyuncs.com/compatible-mode/v1`),a=h(``),o=h(300),c=h([]),l=h(``),u=h(``),d=h(!1),f=h(``),p=h(``),m=h(``),g=h(!1),_=h(``),y=h({vision:!1,structuredOutput:!1}),A=h(`manual`);function M(){A.value=`manual`,y.value={vision:!1,structuredOutput:!1},_.value&&ue(_.value).then(e=>{e&&(y.value={...e},A.value=`registry`)})}function N(){_.value&&(c.value.push({name:_.value,capabilities:{...y.value}}),I())}function P(){I()}function I(){_.value=``,y.value={vision:!1,structuredOutput:!1},A.value=`manual`,g.value=!1}function L(e){c.value.splice(e,1)}let R=j(()=>l.value.includes(`{schema}`)?``:`System prompt must contain the {schema} placeholder`),z=j(()=>u.value.includes(`{text}`)?``:`User prompt must contain the {text} placeholder`),B=j(()=>!R.value&&!z.value&&!n.value&&c.value.length>0);async function V(){n.value=!0;try{let e=await le();i.value=e.provider.baseURL,a.value=e.provider.apiKey,o.value=e.provider.timeout??300,c.value=e.provider.models??[],l.value=e.prompt.systemTemplate,u.value=e.prompt.userTemplate,d.value=!!e.langfuse,f.value=e.langfuse?.publicKey??``,p.value=e.langfuse?.secretKey??``,m.value=e.langfuse?.host??``}catch{a.value=``,c.value=[],l.value=Ft,u.value=It}finally{n.value=!1}}async function de(){if(B.value){r.value=!0;try{await se({provider:{baseURL:i.value,apiKey:a.value,timeout:o.value,models:c.value},prompt:{systemTemplate:l.value,userTemplate:u.value},extraction:{outputDir:`.aiex/extracted`},langfuse:d.value?{publicKey:f.value,secretKey:p.value,host:m.value||void 0}:void 0}),t.value=!1}catch(e){ce.error(e.message||`Failed to save`)}finally{r.value=!1}}}function fe(){i.value=`https://dashscope.aliyuncs.com/compatible-mode/v1`,o.value=300,c.value=[{name:`qwen-plus`,capabilities:{vision:!1,structuredOutput:!0}},{name:`qwen-vl-plus`,capabilities:{vision:!0,structuredOutput:!0}}],l.value=Ft,u.value=It,d.value=!1,f.value=``,p.value=``,m.value=``}return ae(()=>{V()}),ne(()=>{}),(e,h)=>(b(),T(D(ee),{visible:t.value,"onUpdate:visible":h[14]||=e=>t.value=e,modal:``,header:`AI Settings`,style:{width:`680px`},draggable:!1},{footer:v(()=>[w(`div`,Nt,[x(D(s),{label:`Reset Defaults`,icon:`pi pi-replay`,severity:`secondary`,text:``,onClick:fe}),w(`div`,Pt,[x(D(s),{label:`Cancel`,severity:`secondary`,text:``,onClick:h[13]||=e=>t.value=!1}),x(D(s),{label:`Save`,icon:`pi pi-check`,loading:r.value,disabled:!B.value,onClick:de},null,8,[`loading`,`disabled`])])])]),default:v(()=>[n.value?(b(),O(`div`,ct,[...h[15]||=[w(`i`,{class:`pi pi-spin pi-spinner text-xl`},null,-1)]])):(b(),O(`div`,lt,[w(`section`,null,[h[19]||=w(`h3`,{class:`text-sm font-semibold mb-3 text-foreground`},` Provider `,-1),w(`div`,ut,[w(`div`,dt,[h[16]||=w(`label`,{class:`text-xs text-muted-foreground`},`Base URL`,-1),x(D(F),{modelValue:i.value,"onUpdate:modelValue":h[0]||=e=>i.value=e,size:`small`,placeholder:`https://dashscope.aliyuncs.com/compatible-mode/v1`},null,8,[`modelValue`])]),w(`div`,ft,[h[17]||=w(`label`,{class:`text-xs text-muted-foreground`},`API Key`,-1),x(D(Y),{modelValue:a.value,"onUpdate:modelValue":h[1]||=e=>a.value=e,feedback:!1,"toggle-mask":``,size:`small`,placeholder:`sk-xxx`,"input-class":`w-full`},null,8,[`modelValue`])]),w(`div`,pt,[h[18]||=w(`label`,{class:`text-xs text-muted-foreground`},`Timeout (seconds)`,-1),x(D(F),{value:String(o.value),type:`number`,size:`small`,placeholder:`300`,min:1,onInput:h[2]||=e=>o.value=Number(e.target.value)||300},null,8,[`value`])])])]),w(`section`,null,[h[21]||=w(`h3`,{class:`text-sm font-semibold mb-3 text-foreground`},` Models `,-1),w(`div`,mt,[(b(!0),O(ie,null,te(c.value,(e,t)=>(b(),O(`div`,{key:t,class:`flex items-center gap-2 px-3 py-2 rounded border border-border bg-card`},[w(`code`,ht,C(e.name),1),w(`span`,{class:S([`inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded`,e.capabilities.structuredOutput?`bg-green-500/10 text-green-600`:`bg-yellow-500/10 text-yellow-600`])},[w(`i`,{class:S([e.capabilities.structuredOutput?`pi pi-check-circle`:`pi pi-exclamation-triangle`,`text-[10px]`])},null,2),E(` `+C(e.capabilities.structuredOutput?`Structured Output`:`Text-only Output`),1)],2),w(`span`,{class:S([`inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded`,e.capabilities.vision?`bg-green-500/10 text-green-600`:`bg-red-500/10 text-red-600`])},[w(`i`,{class:S([e.capabilities.vision?`pi pi-check-circle`:`pi pi-times-circle`,`text-[10px]`])},null,2),E(` `+C(e.capabilities.vision?`Vision Supported`:`Vision Unsupported`),1)],2),x(D(s),{icon:`pi pi-times`,severity:`danger`,text:``,size:`small`,onClick:e=>L(t)},null,8,[`onClick`])]))),128)),g.value?(b(),O(`div`,gt,[w(`div`,_t,[x(D(F),{modelValue:_.value,"onUpdate:modelValue":h[3]||=e=>_.value=e,size:`small`,placeholder:`Model name (e.g. gpt-4o)`,class:`flex-1 font-mono`,onInput:M,onKeyup:oe(N,[`enter`])},null,8,[`modelValue`]),x(D(s),{icon:`pi pi-check`,severity:`success`,text:``,size:`small`,disabled:!_.value,onClick:N},null,8,[`disabled`]),x(D(s),{icon:`pi pi-times`,severity:`secondary`,text:``,size:`small`,onClick:P})]),w(`div`,vt,[w(`label`,yt,[x(D(G),{modelValue:y.value.structuredOutput,"onUpdate:modelValue":h[4]||=e=>y.value.structuredOutput=e,binary:!0,"input-id":`add-so`},null,8,[`modelValue`]),w(`span`,{class:S(y.value.structuredOutput?`text-green-600`:`text-muted-foreground`)},` Structured Output `,2)]),w(`label`,bt,[x(D(G),{modelValue:y.value.vision,"onUpdate:modelValue":h[5]||=e=>y.value.vision=e,binary:!0,"input-id":`add-vision`},null,8,[`modelValue`]),w(`span`,{class:S(y.value.vision?`text-green-600`:`text-muted-foreground`)},` Vision `,2)]),A.value===`registry`?(b(),O(`span`,xt,[...h[20]||=[w(`i`,{class:`pi pi-database mr-0.5`},null,-1),E(`Registry `,-1)]])):k(``,!0)])])):(b(),T(D(s),{key:1,label:`Add Model`,icon:`pi pi-plus`,severity:`secondary`,text:``,size:`small`,onClick:h[6]||=e=>g.value=!0}))])]),w(`section`,null,[h[26]||=w(`h3`,{class:`text-sm font-semibold mb-3 text-foreground`},` Langfuse Tracing `,-1),w(`div`,St,[w(`div`,Ct,[x(D(G),{modelValue:d.value,"onUpdate:modelValue":h[7]||=e=>d.value=e,binary:!0,"input-id":`lf-enabled`},null,8,[`modelValue`]),h[22]||=w(`label`,{for:`lf-enabled`,class:`text-sm cursor-pointer`},`Enabled`,-1)]),d.value?(b(),O(`div`,wt,[w(`div`,Tt,[h[23]||=w(`label`,{class:`text-xs text-muted-foreground`},`Secret Key`,-1),x(D(Y),{modelValue:p.value,"onUpdate:modelValue":h[8]||=e=>p.value=e,feedback:!1,"toggle-mask":``,size:`small`,placeholder:`sk-lf-...`,"input-class":`w-full`},null,8,[`modelValue`])]),w(`div`,Et,[h[24]||=w(`label`,{class:`text-xs text-muted-foreground`},`Public Key`,-1),x(D(F),{modelValue:f.value,"onUpdate:modelValue":h[9]||=e=>f.value=e,size:`small`,placeholder:`pk-lf-...`},null,8,[`modelValue`])]),w(`div`,Dt,[h[25]||=w(`label`,{class:`text-xs text-muted-foreground`},`Host (optional)`,-1),x(D(F),{modelValue:m.value,"onUpdate:modelValue":h[10]||=e=>m.value=e,size:`small`,placeholder:`https://us.cloud.langfuse.com`},null,8,[`modelValue`])])])):k(``,!0)])]),w(`section`,null,[h[30]||=w(`h3`,{class:`text-sm font-semibold mb-3 text-foreground`},` Prompt Templates `,-1),w(`div`,Ot,[w(`div`,kt,[h[27]||=w(`label`,{class:`text-xs text-muted-foreground`},`System Prompt`,-1),x(D($),{modelValue:l.value,"onUpdate:modelValue":h[11]||=e=>l.value=e,rows:`6`,"auto-resize":``,class:`text-xs font-mono`},null,8,[`modelValue`]),R.value?(b(),O(`p`,At,C(R.value),1)):k(``,!0)]),w(`div`,jt,[h[28]||=w(`label`,{class:`text-xs text-muted-foreground`},`User Prompt`,-1),x(D($),{modelValue:u.value,"onUpdate:modelValue":h[12]||=e=>u.value=e,rows:`6`,"auto-resize":``,class:`text-xs font-mono`},null,8,[`modelValue`]),z.value?(b(),O(`p`,Mt,C(z.value),1)):k(``,!0)]),h[29]||=w(`div`,{class:`text-xs text-muted-foreground p-2 rounded border border-border`},[E(` Placeholders: `),w(`code`,{class:`bg-secondary px-1 rounded`},`{schema}`),E(` JSON Schema structure description, `),w(`code`,{class:`bg-secondary px-1 rounded`},`{text}`),E(` text to extract from `)],-1)])])]))]),_:1},8,[`visible`]))}});export{Lt as default};