ai-client-sdk 3.0.4 → 3.0.6
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/README.md +5 -5
- package/dist/ai-client-sdk.mjs +660 -660
- package/dist/ai-client-sdk.umd.js +4 -4
- package/dist/view/event.d.ts +1 -0
- package/dist/view/template.d.ts +1 -0
- package/package.json +2 -2
|
@@ -59,20 +59,20 @@
|
|
|
59
59
|
depsCount: ${u},
|
|
60
60
|
deps: ${c}}`};const i={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(l){const[u,c]=s(l);a(l,u),o(l,c)}};function s({schema:l}){const u={},c={};for(const f in l){if(f==="__proto__")continue;const h=Array.isArray(l[f])?u:c;h[f]=l[f]}return[u,c]}function a(l,u=l.schema){const{gen:c,data:f,it:h}=l;if(Object.keys(u).length===0)return;const d=c.let("missing");for(const g in u){const T=u[g];if(T.length===0)continue;const y=(0,r.propertyInData)(c,f,g,h.opts.ownProperties);l.setParams({property:g,depsCount:T.length,deps:T.join(", ")}),h.allErrors?c.if(y,()=>{for(const m of T)(0,r.checkReportMissingProp)(l,m)}):(c.if((0,t._)`${y} && (${(0,r.checkMissingProp)(l,T,d)})`),(0,r.reportMissingProp)(l,d),c.else())}}e.validatePropertyDeps=a;function o(l,u=l.schema){const{gen:c,data:f,keyword:h,it:d}=l,g=c.name("valid");for(const T in u)(0,n.alwaysValidSchema)(d,u[T])||(c.if((0,r.propertyInData)(c,f,T,d.opts.ownProperties),()=>{const y=l.subschema({keyword:h,schemaProp:T},g);l.mergeValidEvaluated(y,g)},()=>c.var(g,!0)),l.ok(g))}e.validateSchemaDeps=o,e.default=i})(ia)),ia}var Jr={},Hu;function Eb(){if(Hu)return Jr;Hu=1,Object.defineProperty(Jr,"__esModule",{value:!0});const e=he(),t=me(),r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:i})=>(0,e._)`{propertyName: ${i.propertyName}}`},code(i){const{gen:s,schema:a,data:o,it:l}=i;if((0,t.alwaysValidSchema)(l,a))return;const u=s.name("valid");s.forIn("key",o,c=>{i.setParams({propertyName:c}),i.subschema({keyword:"propertyNames",data:c,dataTypes:["string"],propertyName:c,compositeRule:!0},u),s.if((0,e.not)(u),()=>{i.error(!0),l.allErrors||s.break()})}),i.ok(u)}};return Jr.default=r,Jr}var Xr={},Bu;function Vu(){if(Bu)return Xr;Bu=1,Object.defineProperty(Xr,"__esModule",{value:!0});const e=yt(),t=he(),n=Ut(),r=me(),s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:a})=>(0,t._)`{additionalProperty: ${a.additionalProperty}}`},code(a){const{gen:o,schema:l,parentSchema:u,data:c,errsCount:f,it:h}=a;if(!f)throw new Error("ajv implementation error");const{allErrors:d,opts:g}=h;if(h.props=!0,g.removeAdditional!=="all"&&(0,r.alwaysValidSchema)(h,l))return;const T=(0,e.allSchemaProperties)(u.properties),y=(0,e.allSchemaProperties)(u.patternProperties);m(),a.ok((0,t._)`${f} === ${n.default.errors}`);function m(){o.forIn("key",c,w=>{!T.length&&!y.length?S(w):o.if(p(w),()=>S(w))})}function p(w){let x;if(T.length>8){const N=(0,r.schemaRefOrVal)(h,u.properties,"properties");x=(0,e.isOwnProperty)(o,N,w)}else T.length?x=(0,t.or)(...T.map(N=>(0,t._)`${w} === ${N}`)):x=t.nil;return y.length&&(x=(0,t.or)(x,...y.map(N=>(0,t._)`${(0,e.usePattern)(a,N)}.test(${w})`))),(0,t.not)(x)}function b(w){o.code((0,t._)`delete ${c}[${w}]`)}function S(w){if(g.removeAdditional==="all"||g.removeAdditional&&l===!1){b(w);return}if(l===!1){a.setParams({additionalProperty:w}),a.error(),d||o.break();return}if(typeof l=="object"&&!(0,r.alwaysValidSchema)(h,l)){const x=o.name("valid");g.removeAdditional==="failing"?(v(w,x,!1),o.if((0,t.not)(x),()=>{a.reset(),b(w)})):(v(w,x),d||o.if((0,t.not)(x),()=>o.break()))}}function v(w,x,N){const F={keyword:"additionalProperties",dataProp:w,dataPropType:r.Type.Str};N===!1&&Object.assign(F,{compositeRule:!0,createErrors:!1,allErrors:!1}),a.subschema(F,x)}}};return Xr.default=s,Xr}var Qr={},Wu;function Sb(){if(Wu)return Qr;Wu=1,Object.defineProperty(Qr,"__esModule",{value:!0});const e=xr(),t=yt(),n=me(),r=Vu(),i={keyword:"properties",type:"object",schemaType:"object",code(s){const{gen:a,schema:o,parentSchema:l,data:u,it:c}=s;c.opts.removeAdditional==="all"&&l.additionalProperties===void 0&&r.default.code(new e.KeywordCxt(c,r.default,"additionalProperties"));const f=(0,t.allSchemaProperties)(o);for(const y of f)c.definedProperties.add(y);c.opts.unevaluated&&f.length&&c.props!==!0&&(c.props=n.mergeEvaluated.props(a,(0,n.toHash)(f),c.props));const h=f.filter(y=>!(0,n.alwaysValidSchema)(c,o[y]));if(h.length===0)return;const d=a.name("valid");for(const y of h)g(y)?T(y):(a.if((0,t.propertyInData)(a,u,y,c.opts.ownProperties)),T(y),c.allErrors||a.else().var(d,!0),a.endIf()),s.it.definedProperties.add(y),s.ok(d);function g(y){return c.opts.useDefaults&&!c.compositeRule&&o[y].default!==void 0}function T(y){s.subschema({keyword:"properties",schemaProp:y,dataProp:y},d)}}};return Qr.default=i,Qr}var ei={},Yu;function xb(){if(Yu)return ei;Yu=1,Object.defineProperty(ei,"__esModule",{value:!0});const e=yt(),t=he(),n=me(),r=me(),i={keyword:"patternProperties",type:"object",schemaType:"object",code(s){const{gen:a,schema:o,data:l,parentSchema:u,it:c}=s,{opts:f}=c,h=(0,e.allSchemaProperties)(o),d=h.filter(S=>(0,n.alwaysValidSchema)(c,o[S]));if(h.length===0||d.length===h.length&&(!c.opts.unevaluated||c.props===!0))return;const g=f.strictSchema&&!f.allowMatchingProperties&&u.properties,T=a.name("valid");c.props!==!0&&!(c.props instanceof t.Name)&&(c.props=(0,r.evaluatedPropsToName)(a,c.props));const{props:y}=c;m();function m(){for(const S of h)g&&p(S),c.allErrors?b(S):(a.var(T,!0),b(S),a.if(T))}function p(S){for(const v in g)new RegExp(S).test(v)&&(0,n.checkStrictMode)(c,`property ${v} matches pattern ${S} (use allowMatchingProperties)`)}function b(S){a.forIn("key",l,v=>{a.if((0,t._)`${(0,e.usePattern)(s,S)}.test(${v})`,()=>{const w=d.includes(S);w||s.subschema({keyword:"patternProperties",schemaProp:S,dataProp:v,dataPropType:r.Type.Str},T),c.opts.unevaluated&&y!==!0?a.assign((0,t._)`${y}[${v}]`,!0):!w&&!c.allErrors&&a.if((0,t.not)(T),()=>a.break())})})}}};return ei.default=i,ei}var ti={},Gu;function Pb(){if(Gu)return ti;Gu=1,Object.defineProperty(ti,"__esModule",{value:!0});const e=me(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){const{gen:r,schema:i,it:s}=n;if((0,e.alwaysValidSchema)(s,i)){n.fail();return}const a=r.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),n.failResult(a,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};return ti.default=t,ti}var ni={},Ku;function Ab(){if(Ku)return ni;Ku=1,Object.defineProperty(ni,"__esModule",{value:!0});const t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:yt().validateUnion,error:{message:"must match a schema in anyOf"}};return ni.default=t,ni}var ri={},Zu;function Db(){if(Zu)return ri;Zu=1,Object.defineProperty(ri,"__esModule",{value:!0});const e=he(),t=me(),r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:i})=>(0,e._)`{passingSchemas: ${i.passing}}`},code(i){const{gen:s,schema:a,parentSchema:o,it:l}=i;if(!Array.isArray(a))throw new Error("ajv implementation error");if(l.opts.discriminator&&o.discriminator)return;const u=a,c=s.let("valid",!1),f=s.let("passing",null),h=s.name("_valid");i.setParams({passing:f}),s.block(d),i.result(c,()=>i.reset(),()=>i.error(!0));function d(){u.forEach((g,T)=>{let y;(0,t.alwaysValidSchema)(l,g)?s.var(h,!0):y=i.subschema({keyword:"oneOf",schemaProp:T,compositeRule:!0},h),T>0&&s.if((0,e._)`${h} && ${c}`).assign(c,!1).assign(f,(0,e._)`[${f}, ${T}]`).else(),s.if(h,()=>{s.assign(c,!0),s.assign(f,T),y&&i.mergeEvaluated(y,e.Name)})})}}};return ri.default=r,ri}var ii={},Ju;function $b(){if(Ju)return ii;Ju=1,Object.defineProperty(ii,"__esModule",{value:!0});const e=me(),t={keyword:"allOf",schemaType:"array",code(n){const{gen:r,schema:i,it:s}=n;if(!Array.isArray(i))throw new Error("ajv implementation error");const a=r.name("valid");i.forEach((o,l)=>{if((0,e.alwaysValidSchema)(s,o))return;const u=n.subschema({keyword:"allOf",schemaProp:l},a);n.ok(a),n.mergeEvaluated(u)})}};return ii.default=t,ii}var si={},Xu;function Cb(){if(Xu)return si;Xu=1,Object.defineProperty(si,"__esModule",{value:!0});const e=he(),t=me(),r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:s})=>(0,e.str)`must match "${s.ifClause}" schema`,params:({params:s})=>(0,e._)`{failingKeyword: ${s.ifClause}}`},code(s){const{gen:a,parentSchema:o,it:l}=s;o.then===void 0&&o.else===void 0&&(0,t.checkStrictMode)(l,'"if" without "then" and "else" is ignored');const u=i(l,"then"),c=i(l,"else");if(!u&&!c)return;const f=a.let("valid",!0),h=a.name("_valid");if(d(),s.reset(),u&&c){const T=a.let("ifClause");s.setParams({ifClause:T}),a.if(h,g("then",T),g("else",T))}else u?a.if(h,g("then")):a.if((0,e.not)(h),g("else"));s.pass(f,()=>s.error(!0));function d(){const T=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},h);s.mergeEvaluated(T)}function g(T,y){return()=>{const m=s.subschema({keyword:T},h);a.assign(f,h),s.mergeValidEvaluated(m,f),y?a.assign(y,(0,e._)`${T}`):s.setParams({ifClause:T})}}}};function i(s,a){const o=s.schema[a];return o!==void 0&&!(0,t.alwaysValidSchema)(s,o)}return si.default=r,si}var ai={},Qu;function Ob(){if(Qu)return ai;Qu=1,Object.defineProperty(ai,"__esModule",{value:!0});const e=me(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:r,it:i}){r.if===void 0&&(0,e.checkStrictMode)(i,`"${n}" without "if" is ignored`)}};return ai.default=t,ai}var ec;function Rb(){if(ec)return Yr;ec=1,Object.defineProperty(Yr,"__esModule",{value:!0});const e=Iu(),t=_b(),n=Fu(),r=vb(),i=Tb(),s=kb(),a=Eb(),o=Vu(),l=Sb(),u=xb(),c=Pb(),f=Ab(),h=Db(),d=$b(),g=Cb(),T=Ob();function y(m=!1){const p=[c.default,f.default,h.default,d.default,g.default,T.default,a.default,o.default,s.default,l.default,u.default];return m?p.push(t.default,r.default):p.push(e.default,n.default),p.push(i.default),p}return Yr.default=y,Yr}var oi={},li={},tc;function Nb(){if(tc)return li;tc=1,Object.defineProperty(li,"__esModule",{value:!0});const e=he(),n={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:r})=>(0,e.str)`must match format "${r}"`,params:({schemaCode:r})=>(0,e._)`{format: ${r}}`},code(r,i){const{gen:s,data:a,$data:o,schema:l,schemaCode:u,it:c}=r,{opts:f,errSchemaPath:h,schemaEnv:d,self:g}=c;if(!f.validateFormats)return;o?T():y();function T(){const m=s.scopeValue("formats",{ref:g.formats,code:f.code.formats}),p=s.const("fDef",(0,e._)`${m}[${u}]`),b=s.let("fType"),S=s.let("format");s.if((0,e._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>s.assign(b,(0,e._)`${p}.type || "string"`).assign(S,(0,e._)`${p}.validate`),()=>s.assign(b,(0,e._)`"string"`).assign(S,p)),r.fail$data((0,e.or)(v(),w()));function v(){return f.strictSchema===!1?e.nil:(0,e._)`${u} && !${S}`}function w(){const x=d.$async?(0,e._)`(${p}.async ? await ${S}(${a}) : ${S}(${a}))`:(0,e._)`${S}(${a})`,N=(0,e._)`(typeof ${S} == "function" ? ${x} : ${S}.test(${a}))`;return(0,e._)`${S} && ${S} !== true && ${b} === ${i} && !${N}`}}function y(){const m=g.formats[l];if(!m){v();return}if(m===!0)return;const[p,b,S]=w(m);p===i&&r.pass(x());function v(){if(f.strictSchema===!1){g.logger.warn(N());return}throw new Error(N());function N(){return`unknown format "${l}" ignored in schema at path "${h}"`}}function w(N){const F=N instanceof RegExp?(0,e.regexpCode)(N):f.code.formats?(0,e._)`${f.code.formats}${(0,e.getProperty)(l)}`:void 0,A=s.scopeValue("formats",{key:l,ref:N,code:F});return typeof N=="object"&&!(N instanceof RegExp)?[N.type||"string",N.validate,(0,e._)`${A}.validate`]:["string",N,A]}function x(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!d.$async)throw new Error("async format in sync schema");return(0,e._)`await ${S}(${a})`}return typeof b=="function"?(0,e._)`${S}(${a})`:(0,e._)`${S}.test(${a})`}}}};return li.default=n,li}var nc;function Mb(){if(nc)return oi;nc=1,Object.defineProperty(oi,"__esModule",{value:!0});const t=[Nb().default];return oi.default=t,oi}var Xt={},rc;function Ib(){return rc||(rc=1,Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.contentVocabulary=Xt.metadataVocabulary=void 0,Xt.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Xt.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),Xt}var ic;function Lb(){if(ic)return Cr;ic=1,Object.defineProperty(Cr,"__esModule",{value:!0});const e=ob(),t=wb(),n=Rb(),r=Mb(),i=Ib(),s=[e.default,t.default,(0,n.default)(),r.default,i.metadataVocabulary,i.contentVocabulary];return Cr.default=s,Cr}var ui={},Hn={},sc;function Fb(){if(sc)return Hn;sc=1,Object.defineProperty(Hn,"__esModule",{value:!0}),Hn.DiscrError=void 0;var e;return(function(t){t.Tag="tag",t.Mapping="mapping"})(e||(Hn.DiscrError=e={})),Hn}var ac;function jb(){if(ac)return ui;ac=1,Object.defineProperty(ui,"__esModule",{value:!0});const e=he(),t=Fb(),n=ea(),r=Dr(),i=me(),a={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:o,tagName:l}})=>o===t.DiscrError.Tag?`tag "${l}" must be string`:`value of tag "${l}" must be in oneOf`,params:({params:{discrError:o,tag:l,tagName:u}})=>(0,e._)`{error: ${o}, tag: ${u}, tagValue: ${l}}`},code(o){const{gen:l,data:u,schema:c,parentSchema:f,it:h}=o,{oneOf:d}=f;if(!h.opts.discriminator)throw new Error("discriminator: requires discriminator option");const g=c.propertyName;if(typeof g!="string")throw new Error("discriminator: requires propertyName");if(c.mapping)throw new Error("discriminator: mapping is not supported");if(!d)throw new Error("discriminator: requires oneOf keyword");const T=l.let("valid",!1),y=l.const("tag",(0,e._)`${u}${(0,e.getProperty)(g)}`);l.if((0,e._)`typeof ${y} == "string"`,()=>m(),()=>o.error(!1,{discrError:t.DiscrError.Tag,tag:y,tagName:g})),o.ok(T);function m(){const S=b();l.if(!1);for(const v in S)l.elseIf((0,e._)`${y} === ${v}`),l.assign(T,p(S[v]));l.else(),o.error(!1,{discrError:t.DiscrError.Mapping,tag:y,tagName:g}),l.endIf()}function p(S){const v=l.name("valid"),w=o.subschema({keyword:"oneOf",schemaProp:S},v);return o.mergeEvaluated(w,e.Name),v}function b(){var S;const v={},w=N(f);let x=!0;for(let O=0;O<d.length;O++){let U=d[O];if(U?.$ref&&!(0,i.schemaHasRulesButRef)(U,h.self.RULES)){const H=U.$ref;if(U=n.resolveRef.call(h.self,h.schemaEnv.root,h.baseId,H),U instanceof n.SchemaEnv&&(U=U.schema),U===void 0)throw new r.default(h.opts.uriResolver,h.baseId,H)}const K=(S=U?.properties)===null||S===void 0?void 0:S[g];if(typeof K!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${g}"`);x=x&&(w||N(U)),F(K,O)}if(!x)throw new Error(`discriminator: "${g}" must be required`);return v;function N({required:O}){return Array.isArray(O)&&O.includes(g)}function F(O,U){if(O.const)A(O.const,U);else if(O.enum)for(const K of O.enum)A(K,U);else throw new Error(`discriminator: "properties/${g}" must have "const" or "enum"`)}function A(O,U){if(typeof O!="string"||O in v)throw new Error(`discriminator: "${g}" values must be unique strings`);v[O]=U}}}};return ui.default=a,ui}const zb={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0};var oc;function Ub(){return oc||(oc=1,(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;const n=ib(),r=Lb(),i=jb(),s=zb,a=["/properties"],o="http://json-schema.org/draft-07/schema";class l extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(g=>this.addVocabulary(g)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const g=this.opts.$data?this.$dataMetaSchema(s,a):s;this.addMetaSchema(g,o,!1),this.refs["http://json-schema.org/schema"]=o}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}}t.Ajv=l,e.exports=t=l,e.exports.Ajv=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var u=xr();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var c=he();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return c._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return c.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return c.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return c.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return c.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return c.CodeGen}});var f=Qs();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var h=Dr();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})})(_r,_r.exports)),_r.exports}var qb=Ub();const Hb=Xn(qb);var lc=typeof global=="object"&&global&&global.Object===Object&&global,Bb=typeof self=="object"&&self&&self.Object===Object&&self,gn=lc||Bb||Function("return this")(),ci=gn.Symbol,uc=Object.prototype,Vb=uc.hasOwnProperty,Wb=uc.toString,Bn=ci?ci.toStringTag:void 0;function Yb(e){var t=Vb.call(e,Bn),n=e[Bn];try{e[Bn]=void 0;var r=!0}catch{}var i=Wb.call(e);return r&&(t?e[Bn]=n:delete e[Bn]),i}var Gb=Object.prototype,Kb=Gb.toString;function Zb(e){return Kb.call(e)}var Jb="[object Null]",Xb="[object Undefined]",cc=ci?ci.toStringTag:void 0;function fi(e){return e==null?e===void 0?Xb:Jb:cc&&cc in Object(e)?Yb(e):Zb(e)}function Vn(e){return e!=null&&typeof e=="object"}var sa=Array.isArray;function Qt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function fc(e){return e}var Qb="[object AsyncFunction]",e1="[object Function]",t1="[object GeneratorFunction]",n1="[object Proxy]";function aa(e){if(!Qt(e))return!1;var t=fi(e);return t==e1||t==t1||t==Qb||t==n1}var oa=gn["__core-js_shared__"],dc=(function(){var e=/[^.]+$/.exec(oa&&oa.keys&&oa.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function r1(e){return!!dc&&dc in e}var i1=Function.prototype,s1=i1.toString;function a1(e){if(e!=null){try{return s1.call(e)}catch{}try{return e+""}catch{}}return""}var o1=/[\\^$.*+?()[\]{}|]/g,l1=/^\[object .+?Constructor\]$/,u1=Function.prototype,c1=Object.prototype,f1=u1.toString,d1=c1.hasOwnProperty,h1=RegExp("^"+f1.call(d1).replace(o1,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p1(e){if(!Qt(e)||r1(e))return!1;var t=aa(e)?h1:l1;return t.test(a1(e))}function m1(e,t){return e?.[t]}function la(e,t){var n=m1(e,t);return p1(n)?n:void 0}var hc=Object.create,g1=(function(){function e(){}return function(t){if(!Qt(t))return{};if(hc)return hc(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})();function y1(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function b1(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var w1=800,_1=16,v1=Date.now;function T1(e){var t=0,n=0;return function(){var r=v1(),i=_1-(r-n);if(n=r,i>0){if(++t>=w1)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function k1(e){return function(){return e}}var di=(function(){try{var e=la(Object,"defineProperty");return e({},"",{}),e}catch{}})(),E1=di?function(e,t){return di(e,"toString",{configurable:!0,enumerable:!1,value:k1(t),writable:!0})}:fc,S1=T1(E1),x1=9007199254740991,P1=/^(?:0|[1-9]\d*)$/;function pc(e,t){var n=typeof e;return t=t??x1,!!t&&(n=="number"||n!="symbol"&&P1.test(e))&&e>-1&&e%1==0&&e<t}function ua(e,t,n){t=="__proto__"&&di?di(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function hi(e,t){return e===t||e!==e&&t!==t}var A1=Object.prototype,D1=A1.hasOwnProperty;function $1(e,t,n){var r=e[t];(!(D1.call(e,t)&&hi(r,n))||n===void 0&&!(t in e))&&ua(e,t,n)}function C1(e,t,n,r){var i=!n;n||(n={});for(var s=-1,a=t.length;++s<a;){var o=t[s],l=void 0;l===void 0&&(l=e[o]),i?ua(n,o,l):$1(n,o,l)}return n}var mc=Math.max;function O1(e,t,n){return t=mc(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=mc(r.length-t,0),a=Array(s);++i<s;)a[i]=r[t+i];i=-1;for(var o=Array(t+1);++i<t;)o[i]=r[i];return o[t]=n(a),y1(e,this,o)}}function R1(e,t){return S1(O1(e,t,fc),e+"")}var N1=9007199254740991;function gc(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=N1}function ca(e){return e!=null&&gc(e.length)&&!aa(e)}function M1(e,t,n){if(!Qt(n))return!1;var r=typeof t;return(r=="number"?ca(n)&&pc(t,n.length):r=="string"&&t in n)?hi(n[t],e):!1}function I1(e){return R1(function(t,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(s=e.length>3&&typeof s=="function"?(i--,s):void 0,a&&M1(n[0],n[1],a)&&(s=i<3?void 0:s,i=1),t=Object(t);++r<i;){var o=n[r];o&&e(t,o,r,s)}return t})}var L1=Object.prototype;function yc(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||L1;return e===n}function F1(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var j1="[object Arguments]";function bc(e){return Vn(e)&&fi(e)==j1}var wc=Object.prototype,z1=wc.hasOwnProperty,U1=wc.propertyIsEnumerable,fa=bc((function(){return arguments})())?bc:function(e){return Vn(e)&&z1.call(e,"callee")&&!U1.call(e,"callee")};function q1(){return!1}var _c=typeof $e=="object"&&$e&&!$e.nodeType&&$e,vc=_c&&typeof module=="object"&&module&&!module.nodeType&&module,H1=vc&&vc.exports===_c,Tc=H1?gn.Buffer:void 0,B1=Tc?Tc.isBuffer:void 0,kc=B1||q1,V1="[object Arguments]",W1="[object Array]",Y1="[object Boolean]",G1="[object Date]",K1="[object Error]",Z1="[object Function]",J1="[object Map]",X1="[object Number]",Q1="[object Object]",ew="[object RegExp]",tw="[object Set]",nw="[object String]",rw="[object WeakMap]",iw="[object ArrayBuffer]",sw="[object DataView]",aw="[object Float32Array]",ow="[object Float64Array]",lw="[object Int8Array]",uw="[object Int16Array]",cw="[object Int32Array]",fw="[object Uint8Array]",dw="[object Uint8ClampedArray]",hw="[object Uint16Array]",pw="[object Uint32Array]",ve={};ve[aw]=ve[ow]=ve[lw]=ve[uw]=ve[cw]=ve[fw]=ve[dw]=ve[hw]=ve[pw]=!0,ve[V1]=ve[W1]=ve[iw]=ve[Y1]=ve[sw]=ve[G1]=ve[K1]=ve[Z1]=ve[J1]=ve[X1]=ve[Q1]=ve[ew]=ve[tw]=ve[nw]=ve[rw]=!1;function mw(e){return Vn(e)&&gc(e.length)&&!!ve[fi(e)]}function gw(e){return function(t){return e(t)}}var Ec=typeof $e=="object"&&$e&&!$e.nodeType&&$e,Wn=Ec&&typeof module=="object"&&module&&!module.nodeType&&module,yw=Wn&&Wn.exports===Ec,da=yw&&lc.process,Sc=(function(){try{var e=Wn&&Wn.require&&Wn.require("util").types;return e||da&&da.binding&&da.binding("util")}catch{}})(),xc=Sc&&Sc.isTypedArray,Pc=xc?gw(xc):mw;function bw(e,t){var n=sa(e),r=!n&&fa(e),i=!n&&!r&&kc(e),s=!n&&!r&&!i&&Pc(e),a=n||r||i||s,o=a?F1(e.length,String):[],l=o.length;for(var u in e)a&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||pc(u,l))||o.push(u);return o}function ww(e,t){return function(n){return e(t(n))}}function _w(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var vw=Object.prototype,Tw=vw.hasOwnProperty;function kw(e){if(!Qt(e))return _w(e);var t=yc(e),n=[];for(var r in e)r=="constructor"&&(t||!Tw.call(e,r))||n.push(r);return n}function Ac(e){return ca(e)?bw(e):kw(e)}var Yn=la(Object,"create");function Ew(){this.__data__=Yn?Yn(null):{},this.size=0}function Sw(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var xw="__lodash_hash_undefined__",Pw=Object.prototype,Aw=Pw.hasOwnProperty;function Dw(e){var t=this.__data__;if(Yn){var n=t[e];return n===xw?void 0:n}return Aw.call(t,e)?t[e]:void 0}var $w=Object.prototype,Cw=$w.hasOwnProperty;function Ow(e){var t=this.__data__;return Yn?t[e]!==void 0:Cw.call(t,e)}var Rw="__lodash_hash_undefined__";function Nw(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Yn&&t===void 0?Rw:t,this}function en(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}en.prototype.clear=Ew,en.prototype.delete=Sw,en.prototype.get=Dw,en.prototype.has=Ow,en.prototype.set=Nw;function Mw(){this.__data__=[],this.size=0}function pi(e,t){for(var n=e.length;n--;)if(hi(e[n][0],t))return n;return-1}var Iw=Array.prototype,Lw=Iw.splice;function Fw(e){var t=this.__data__,n=pi(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Lw.call(t,n,1),--this.size,!0}function jw(e){var t=this.__data__,n=pi(t,e);return n<0?void 0:t[n][1]}function zw(e){return pi(this.__data__,e)>-1}function Uw(e,t){var n=this.__data__,r=pi(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Rt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Rt.prototype.clear=Mw,Rt.prototype.delete=Fw,Rt.prototype.get=jw,Rt.prototype.has=zw,Rt.prototype.set=Uw;var Dc=la(gn,"Map");function qw(){this.size=0,this.__data__={hash:new en,map:new(Dc||Rt),string:new en}}function Hw(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function mi(e,t){var n=e.__data__;return Hw(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Bw(e){var t=mi(this,e).delete(e);return this.size-=t?1:0,t}function Vw(e){return mi(this,e).get(e)}function Ww(e){return mi(this,e).has(e)}function Yw(e,t){var n=mi(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function yn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}yn.prototype.clear=qw,yn.prototype.delete=Bw,yn.prototype.get=Vw,yn.prototype.has=Ww,yn.prototype.set=Yw;var $c=ww(Object.getPrototypeOf,Object),Gw="[object Object]",Kw=Function.prototype,Zw=Object.prototype,Cc=Kw.toString,Jw=Zw.hasOwnProperty,Xw=Cc.call(Object);function Qw(e){if(!Vn(e)||fi(e)!=Gw)return!1;var t=$c(e);if(t===null)return!0;var n=Jw.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Cc.call(n)==Xw}function e_(){this.__data__=new Rt,this.size=0}function t_(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function n_(e){return this.__data__.get(e)}function r_(e){return this.__data__.has(e)}var i_=200;function s_(e,t){var n=this.__data__;if(n instanceof Rt){var r=n.__data__;if(!Dc||r.length<i_-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new yn(r)}return n.set(e,t),this.size=n.size,this}function bn(e){var t=this.__data__=new Rt(e);this.size=t.size}bn.prototype.clear=e_,bn.prototype.delete=t_,bn.prototype.get=n_,bn.prototype.has=r_,bn.prototype.set=s_;var Oc=typeof $e=="object"&&$e&&!$e.nodeType&&$e,Rc=Oc&&typeof module=="object"&&module&&!module.nodeType&&module,a_=Rc&&Rc.exports===Oc,Nc=a_?gn.Buffer:void 0;Nc&&Nc.allocUnsafe;function o_(e,t){return e.slice()}var Mc=gn.Uint8Array;function l_(e){var t=new e.constructor(e.byteLength);return new Mc(t).set(new Mc(e)),t}function u_(e,t){var n=l_(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function c_(e){return typeof e.constructor=="function"&&!yc(e)?g1($c(e)):{}}function f_(e){return function(t,n,r){for(var i=-1,s=Object(t),a=r(t),o=a.length;o--;){var l=a[++i];if(n(s[l],l,s)===!1)break}return t}}var d_=f_();function ha(e,t,n){(n!==void 0&&!hi(e[t],n)||n===void 0&&!(t in e))&&ua(e,t,n)}function h_(e){return Vn(e)&&ca(e)}function pa(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function p_(e){return C1(e,Ac(e))}function m_(e,t,n,r,i,s,a){var o=pa(e,n),l=pa(t,n),u=a.get(l);if(u){ha(e,n,u);return}var c=s?s(o,l,n+"",e,t,a):void 0,f=c===void 0;if(f){var h=sa(l),d=!h&&kc(l),g=!h&&!d&&Pc(l);c=l,h||d||g?sa(o)?c=o:h_(o)?c=b1(o):d?(f=!1,c=o_(l)):g?(f=!1,c=u_(l)):c=[]:Qw(l)||fa(l)?(c=o,fa(o)?c=p_(o):(!Qt(o)||aa(o))&&(c=c_(l))):f=!1}f&&(a.set(l,c),i(c,l,r,s,a),a.delete(l)),ha(e,n,c)}function Ic(e,t,n,r,i){e!==t&&d_(t,function(s,a){if(i||(i=new bn),Qt(s))m_(e,t,a,n,Ic,r,i);else{var o=r?r(pa(e,a),s,a+"",e,t,i):void 0;o===void 0&&(o=s),ha(e,a,o)}},Ac)}var g_=I1(function(e,t,n,r){Ic(e,t,n,r)});let bt=null;function ma(){bt&&(bt.abort(),bt=null)}class y_{tools=Object.create(null);ajv=new Hb({allErrors:!0,strict:!1,allowUnionTypes:!0});validatorCache=Object.create(null);register(t,n){if(this.tools[t.function.name])throw new Error(`${t.function.name} 已存在`);this.tools[t.function.name]={def:t,handler:n}}getDefinition(t){return this.tools[t]?.def}getHandler(t){return this.tools[t]?.handler}remove(t){delete this.tools[t],delete this.validatorCache[t]}get definitions(){return Object.values(this.tools).map(t=>t.def)}getDefinitions(t){return t.length?t.map(n=>this.getDefinition(n)).filter(n=>!!n):null}getValidator(t,n){return this.validatorCache[t]||(this.validatorCache[t]=this.ajv.compile(n)),this.validatorCache[t]}validate(t,n){const r=this.tools[t];if(!r)throw new Error(`${t} 未注册`);const i=r.def.function.parameters,s=this.getValidator(t,i);if(!s(n)){const a=this.ajv.errorsText(s.errors,{separator:", "});throw new Error(`参数验证失败: ${a}`)}return!0}async call(t,n){this.validate(t,n);const r=this.getHandler(t);if(!r)throw new Error(`${t} 没有 handler`);return r(n)}}class b_ extends y_{model="";url="";messages=[];maxRounds=4;defaultParams={tools:[],roundsLeft:this.maxRounds};constructor(t){super();const{model:n,url:r,systemMessageContent:i,maxRounds:s}=t;this.model=n,this.url=r,typeof s=="number"&&(this.maxRounds=s),i&&(this.messages[0]={role:"system",content:i})}pushMessage(t){t&&this.messages.push(t)}pushMessages(t){if(t.length)for(const n of t)this.pushMessage(n)}merge(t,n,r=[]){return g_({},t,n,(i,s,a)=>{if(r.includes(a))return(typeof i=="string"?i:"")+(typeof s=="string"?s:"")})}async invoke(t=this.defaultParams){const{tools:n=[],roundsLeft:r=this.maxRounds}=t;ma(),bt=new AbortController;try{const i=await fetch(this.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:this.model,messages:this.messages,tools:this.getDefinitions(n),stream:!1}),signal:bt.signal});if(bt.signal.aborted)throw new DOMException("请求已被取消","AbortError");const a=(await i.json())?.choices?.[0]?.message;if(!a)return;a.role===null&&(a.role="assistant");const{content:o,role:l,tool_calls:u}=a;if(!u?.length)return a;o&&(ot.pushLoadingMessage(),requestAnimationFrame(()=>ot.updateLoadingMessageContent(o)),ot.finishLoadingMessage()),this.messages.push({content:o,role:l,tool_calls:u});const c=u.map(async f=>{const{function:{name:h,arguments:d},id:g}=f,T=await this.call(h,JSON.parse(d));this.messages.push({content:T,role:"tool",tool_call_id:g})});if(await Promise.all(c),r-1>0)return ot.pushLoadingMessage(),await this.invoke({tools:[],roundsLeft:r-1})}finally{bt=null}}async*invokeStream(t=this.defaultParams){const{tools:n=[],roundsLeft:r=this.maxRounds}=t;ma(),bt=new AbortController;try{const i=await fetch(this.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:this.model,messages:this.messages,tools:this.getDefinitions(n),stream:!0}),signal:bt.signal});if(bt.signal.aborted)throw new DOMException("请求已被取消","AbortError");const s=i.body?.getReader();if(!s)throw new Error("Failed to get response reader");let a=null;const o=new TextDecoder;let l="";for(;;){const{done:g,value:T}=await s.read();if(g)break;const m=o.decode(T,{stream:!0}).split(`
|
|
61
61
|
|
|
62
|
-
`).filter(p=>p.trim()!=="");for(const p of m){if(p==="data: [DONE]")break;const b=p.trim().replace(/^data: /,"");try{const S=JSON.parse(l+b);a=this.merge(a,S,["content","arguments"]),yield S,l=""}catch(S){console.log("JSON 解析失败,等待下一个数据块继续拼接",{error:S,jsonStr:b}),l+=b}}}const u=a?.choices?.[0]?.delta;if(!u)return;u.role===null&&(u.role="assistant");const{content:c,role:f,tool_calls:h}=u;if(!h?.length)return u;this.messages.push({content:c,role:f,tool_calls:h});const d=h.map(async g=>{const{function:{name:T,arguments:y},id:m}=g,p=await this.call(T,JSON.parse(y));this.messages.push({content:p,role:"tool",tool_call_id:m})});if(await Promise.all(d),r-1>0)return this.invokeStream({tools:[],roundsLeft:r-1})}finally{bt=null}}}const w_=e=>{const t=document.createElement("div");return t.textContent=e,t.innerHTML},Lc=async()=>{if(Kt.value)try{const e=w_(Kt.value);Vs.chatting(),Kt.clear();const t={role:"user",content:e};ot.pushMessage(t),await ga.emit("send",t)}finally{Vs.default(),Kt.focus()}},__=()=>{ma(),Vs.default(),Kt.focus()},v_=async()=>{ot.clear(),G0.show("
|
|
62
|
+
`).filter(p=>p.trim()!=="");for(const p of m){if(p==="data: [DONE]")break;const b=p.trim().replace(/^data: /,"");try{const S=JSON.parse(l+b);a=this.merge(a,S,["content","arguments"]),yield S,l=""}catch(S){console.log("JSON 解析失败,等待下一个数据块继续拼接",{error:S,jsonStr:b}),l+=b}}}const u=a?.choices?.[0]?.delta;if(!u)return;u.role===null&&(u.role="assistant");const{content:c,role:f,tool_calls:h}=u;if(!h?.length)return u;this.messages.push({content:c,role:f,tool_calls:h});const d=h.map(async g=>{const{function:{name:T,arguments:y},id:m}=g,p=await this.call(T,JSON.parse(y));this.messages.push({content:p,role:"tool",tool_call_id:m})});if(await Promise.all(d),r-1>0)return this.invokeStream({tools:[],roundsLeft:r-1})}finally{bt=null}}}const w_=e=>{const t=document.createElement("div");return t.textContent=e,t.innerHTML},Lc=async()=>{if(Kt.value)try{const e=w_(Kt.value);Vs.chatting(),Kt.clear();const t={role:"user",content:e};ot.pushMessage(t),await ga.emit("send",t)}finally{Vs.default(),Kt.focus()}},__=()=>{ma(),Vs.default(),Kt.focus()},v_=async()=>{ot.clear(),G0.show("新对话已创建"),Kt.focus(),await ga.emit("create")};function T_(){const{submitIcon:e,createButton:t,messagesContainer:n,userInputContainer:r,userInput:i,stopIcon:s}=Ye();r.addEventListener("click",a=>{!e.contains(a.target)&&!s.contains(a.target)&&Kt.focus()}),i.addEventListener("keydown",a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),Lc())}),e.addEventListener("click",Lc),s.addEventListener("click",__),t.addEventListener("click",v_),n.addEventListener("click",function(a){const o=a.target,l=o.closest('[data-action="copy"]'),u=o.closest(".reasoning-header");if(l&&!l.classList.contains("copied")){a.stopPropagation();const c=l.closest(".message");if(!c)return;const f=c.querySelector(".content-container");if(!f)return;const h=f.textContent;if(!h)return;l.classList.add("copied"),navigator.clipboard.writeText(h).catch(d=>{console.error("Failed to copy text: ",d)}).finally(()=>{setTimeout(()=>{l.classList.remove("copied")},1500)})}if(u){const c=u.parentElement;c&&c.classList.toggle("collapse")}})}class k_{events={send:[],create:[]};on=(t,n)=>{this.events[t].push(n)};emit=async(t,...n)=>{for(const r of this.events[t])try{await r(...n)}catch(i){console.error(`Error in event listener for ${t}:`,i)}}}const ga=new k_,E_=e=>{W0(e),T_(),ot.setPaddingBottom()},S_=["button{outline:0;border:0;display:flex;justify-content:center;align-items:center;cursor:pointer}button.icon{padding:4px}button.text{padding:0 12px;height:28px}button.square{border-radius:6px}button.circle{border-radius:50%}button.primary{background-color:#0000000a}button.plain{background-color:transparent}button.error{background-color:#ff4d4f;color:#fff}button.primary:hover{background-color:#0000000f}button.plain:hover{background-color:#0000000a}button.error:hover{background-color:#ff7875}button[data-action=copy] .copied-text{display:none}button[data-action=copy].copied .copied-text{display:block}button[data-action=copy].copied svg{display:none}",".tooltip{position:relative}.tooltip .tooltip-text{visibility:hidden;opacity:0;background-color:#000000b3;color:#fff;border-radius:4px;padding:4px 8px;position:absolute;z-index:1;white-space:nowrap;font-size:12px;transition:opacity .3s}.tooltip .tooltip-text.top-left{bottom:115%;right:0}.tooltip .tooltip-text.top-right{bottom:115%;left:0}.tooltip .tooltip-text.bottom-left{top:115%;right:0}.tooltip .tooltip-text.bottom-right{top:115%;left:0}.tooltip:hover .tooltip-text{visibility:visible;opacity:1}",".alert{position:absolute;left:50%;transform:translate(-50%);background-color:#fff;border-radius:8px;box-shadow:0 6px 16px #00000014,0 3px 6px -4px #0000001f,0 9px 28px 8px #0000000d;z-index:1000;pointer-events:all;padding:9px 12px;animation:slide 3s ease-in-out forwards;font-size:12px;white-space:nowrap}@keyframes slide{0%{top:0;opacity:0}10%{top:50px;opacity:1}75%{top:50px;opacity:1}to{top:0;opacity:0}}",'.loading-dots{font-weight:700;margin-left:3px}.loading-dots:after{content:"";animation:typing 1.5s infinite}@keyframes typing{0%{content:"."}33%{content:".."}66%{content:"..."}to{content:"."}}',".app-container{height:100%;display:flex;flex-direction:column;background:#fff}.bottom-container{margin:12px}.action-bar{margin-bottom:12px;display:flex;align-items:center;gap:12px}.user-input-container{padding:12px;border-radius:16px;border:1px solid rgba(114,118,139,.16);box-shadow:0 10px 30px #0003;display:flex;flex-direction:column}.user-input{border:0;resize:none;width:100%;font-size:14px;line-height:1.5}.button-wrap{display:flex;justify-content:flex-end;align-items:center;gap:12px}.messages-container{flex:1;padding-top:12px;padding-left:12px;padding-right:12px;overflow-x:hidden;overflow-y:auto}.message{max-width:80%;margin-bottom:12px;font-size:14px;line-height:1.5}.body-container{padding:0 14px;border-radius:8px;overflow-x:auto;color:#000}.message.user{margin-left:auto}.message.user .body-container{background:#e3f2fd}.message.assistant{margin-right:auto}.message.assistant .body-container{background:#f1f1f1}.button-container{display:flex;margin-top:4px}.button-container button{height:26px;display:flex;align-items:center}.message.user .button-container{justify-content:flex-end}.message.assistant .button-container{justify-content:flex-start}.submit-icon,.stop-icon{width:28px;height:28px;display:flex;justify-content:center;align-items:center;background-color:#000;border-radius:50%;color:#fff}.content-container{word-wrap:break-word}.message.assistant table{border-collapse:collapse;margin-block-start:1em;margin-block-end:1em}.message.assistant table th,.message.assistant table td{border:1px solid #ccc;padding:8px}.message.assistant table th{background-color:#e0e0e0}.message.assistant .reasoning-container{padding:0 14px;border-radius:8px;overflow-x:auto;color:#6b7280;background-color:#f9fafb;font-size:12px;margin-bottom:8px}.message.assistant .reasoning-container .reasoning-header{display:flex;align-items:center;gap:4px;padding-top:8px;margin-bottom:8px;cursor:pointer}.message.assistant .reasoning-container .reasoning-header svg{transform:rotate(90deg);transition:transform .3s}.message.assistant .reasoning-container.collapse .reasoning-header svg{transform:rotate(0);transition:transform .3s}.message.assistant .reasoning-container.collapse .reasoning-content{height:0;overflow:hidden}","*{box-sizing:border-box}textarea{padding:0}textarea:focus-visible,select:focus-visible{outline:0}.flex{display:flex}:host{position:relative}"].join(`
|
|
63
63
|
`),Fc=document.createElement("template");Fc.innerHTML=`
|
|
64
64
|
<style>${S_}</style>
|
|
65
65
|
<div class="app-container">
|
|
66
66
|
<div class="messages-container" id="messages-container"></div>
|
|
67
67
|
<div class="bottom-container">
|
|
68
68
|
<div class="action-bar">
|
|
69
|
-
<button class="icon square plain tooltip" id="create-button" type="button" aria-label="
|
|
69
|
+
<button class="icon square plain tooltip" id="create-button" type="button" aria-label="新对话">
|
|
70
70
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 1024 1024"><path d="M597.333 128v85.333H170.667v571.094l75.221-59.094h607.445V426.667h85.334V768A42.667 42.667 0 0 1 896 810.667H275.413L85.333 960V170.667A42.667 42.667 0 0 1 128 128h469.333zm213.334 0V0H896v128h128v85.333H896v128h-85.333v-128h-128V128h128z"/></svg>
|
|
71
|
-
<span class="tooltip-text bottom-right"
|
|
71
|
+
<span class="tooltip-text bottom-right">新对话</span>
|
|
72
72
|
</button>
|
|
73
73
|
</div>
|
|
74
74
|
<div class="user-input-container" id="user-input-container">
|
|
75
|
-
<textarea class="user-input" id="user-input" placeholder="
|
|
75
|
+
<textarea class="user-input" id="user-input" placeholder="发消息..."></textarea>
|
|
76
76
|
<div class="button-wrap">
|
|
77
77
|
<button class="icon square plain tooltip" id="submit-icon" type="button" aria-label="发送">
|
|
78
78
|
<div class="submit-icon">
|
package/dist/view/event.d.ts
CHANGED
package/dist/view/template.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-client-sdk",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "开发 AI 应用的 SDK
|
|
3
|
+
"version": "3.0.6",
|
|
4
|
+
"description": "开发 AI 应用的 SDK,适配任意前端框架,兼容多种大模型、对话界面、Function Calling、Agent、工作流等。",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Hughe5",
|
|
7
7
|
"email": "2100921003@qq.com",
|