st-comp 0.0.250 → 0.0.252

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.
@@ -1 +1 @@
1
- "use strict";const r=require("./index-5befc414.cjs");require("./base-ef747d02.cjs");require("vue");require("./el-button-974ff9e9.cjs");require("./index-33f80550.cjs");require("./index-f1c702f6.cjs");require("./use-global-config-c80f33a4.cjs");require("./use-form-common-props-d3ed62c6.cjs");require("./index-9780a537.cjs");require("./index-bb833443.cjs");require("./index-37b8d3c6.cjs");require("./index-eea0bcb3.cjs");require("./el-tag-6d8e653e.cjs");require("./index-28e03bad.cjs");require("./el-select-a11f33e8.cjs");require("./el-popper-2d3914e4.cjs");require("./index-e8eeea22.cjs");require("./el-scrollbar-bc3f790d.cjs");require("./index-6b99def3.cjs");require("./castArray-35947698.cjs");require("./index-7dce9f59.cjs");require("./scroll-b108dabd.cjs");require("./debounce-62f5b6e8.cjs");require("./vnode-b906ae6d.cjs");require("./el-input-fa18ef84.cjs");require("./typescript-b63f8e83.cjs");require("./el-tooltip-0ea8fbf8.cjs");require("./index-8901a38c.cjs");require("./VarietySelect-5c845562.cjs");require("./el-autocomplete-b59eb529.cjs");require("./_plugin-vue_export-helper-f246444f.cjs");require("./el-message-0ea8fbf8.cjs");require("./index-6ca95c8a.cjs");require("./config-provider-2ae47cc8.cjs");const i={install(e){e.component("st-monacoEditor",r.MonacoEditor)}};module.exports=i;
1
+ "use strict";const r=require("./index-40f05e2c.cjs");require("./base-ef747d02.cjs");require("vue");require("./el-button-974ff9e9.cjs");require("./index-33f80550.cjs");require("./index-f1c702f6.cjs");require("./use-global-config-c80f33a4.cjs");require("./use-form-common-props-d3ed62c6.cjs");require("./index-9780a537.cjs");require("./index-bb833443.cjs");require("./index-37b8d3c6.cjs");require("./index-eea0bcb3.cjs");require("./el-tag-6d8e653e.cjs");require("./index-28e03bad.cjs");require("./el-select-a11f33e8.cjs");require("./el-popper-2d3914e4.cjs");require("./index-e8eeea22.cjs");require("./el-scrollbar-bc3f790d.cjs");require("./index-6b99def3.cjs");require("./castArray-35947698.cjs");require("./index-7dce9f59.cjs");require("./scroll-b108dabd.cjs");require("./debounce-62f5b6e8.cjs");require("./vnode-b906ae6d.cjs");require("./el-input-fa18ef84.cjs");require("./typescript-b63f8e83.cjs");require("./el-tooltip-0ea8fbf8.cjs");require("./index-8901a38c.cjs");require("./VarietySelect-5c845562.cjs");require("./el-autocomplete-b59eb529.cjs");require("./_plugin-vue_export-helper-f246444f.cjs");require("./el-message-0ea8fbf8.cjs");require("./index-6ca95c8a.cjs");require("./config-provider-2ae47cc8.cjs");const i={install(e){e.component("st-monacoEditor",r.MonacoEditor)}};module.exports=i;
@@ -1,4 +1,4 @@
1
- import { M as t } from "./index-8f9d0d17.js";
1
+ import { M as t } from "./index-8a54ceeb.js";
2
2
  import "./base-29f73b05.js";
3
3
  import "vue";
4
4
  import "./el-button-e2c63c08.js";
@@ -1,4 +1,6 @@
1
- "use strict";const l=require("./base-ef747d02.cjs"),b=require("./el-dialog-1b185570.cjs");require("./el-overlay-ea65cb05.cjs");const x=require("./el-button-974ff9e9.cjs"),T=require("./el-input-fa18ef84.cjs"),e=require("vue"),E=require("./dayjs.min-2c20abe6.cjs"),g=require("./index-33f80550.cjs"),z=require("./_plugin-vue_export-helper-f246444f.cjs"),V=require("./index-6ca95c8a.cjs"),N=require("./use-form-common-props-d3ed62c6.cjs");require("./index-28e03bad.cjs");require("./index-9780a537.cjs");require("./index-bb833443.cjs");require("./index-f1c702f6.cjs");require("./vnode-b906ae6d.cjs");require("./scroll-b108dabd.cjs");require("./use-global-config-c80f33a4.cjs");require("./index-37b8d3c6.cjs");require("./index-eea0bcb3.cjs");require("./typescript-b63f8e83.cjs");require("./index-7dce9f59.cjs");require("./config-provider-2ae47cc8.cjs");const C=l.buildProps({size:{type:[Number,String],values:N.componentSizes,default:"",validator:s=>l.isNumber(s)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:N.iconPropType},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:l.definePropType(String),default:"cover"}}),I={error:s=>s instanceof Event},A=e.defineComponent({name:"ElAvatar"}),H=e.defineComponent({...A,props:C,emits:I,setup(s,{emit:v}){const i=s,a=l.useNamespace("avatar"),o=e.ref(!1),n=e.computed(()=>{const{size:t,icon:p,shape:y}=i,r=[a.b()];return l.isString(t)&&r.push(a.m(t)),p&&r.push(a.m("icon")),y&&r.push(a.m(y)),r}),d=e.computed(()=>{const{size:t}=i;return l.isNumber(t)?a.cssVarBlock({size:l.addUnit(t)||""}):void 0}),_=e.computed(()=>({objectFit:i.fit}));e.watch(()=>i.src,()=>o.value=!1);function m(t){o.value=!0,v("error",t)}return(t,p)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(e.unref(n)),style:e.normalizeStyle(e.unref(d))},[(t.src||t.srcSet)&&!o.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.src,alt:t.alt,srcset:t.srcSet,style:e.normalizeStyle(e.unref(_)),onError:m},null,44,["src","alt","srcset"])):t.icon?(e.openBlock(),e.createBlock(e.unref(g.ElIcon),{key:1},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.icon)))]),_:1})):e.renderSlot(t.$slots,"default",{key:2})],6))}});var $=l._export_sfc(H,[["__file","avatar.vue"]]);const M=l.withInstall($);const j=async({appId:s,apiKey:v,value:i})=>{var a;try{const o=await fetch(`https://dashscope.aliyuncs.com/api/v1/apps/${s}/completion`,{method:"POST",headers:{Authorization:`Bearer ${v}`,"Content-Type":"application/json"},body:JSON.stringify({input:{prompt:i},parameters:{incremental_output:!1}})});if(!o.ok)throw new Error(`HTTP ${o.status}: ${o.statusText}`);const n=await o.json();return(a=n==null?void 0:n.output)==null?void 0:a.text}catch(o){throw o.name==="AbortError"?new Error("请求超时"):o}};const w=s=>(e.pushScopeId("data-v-e461ef4d"),s=s(),e.popScopeId(),s),P={class:"chat-container"},L={class:"avatar"},D={class:"message-content"},K={class:"message-text"},R={class:"message-time"},F={key:0,class:"message-item assistant"},O={class:"avatar"},U=w(()=>e.createElementVNode("div",{class:"message-content"},[e.createElementVNode("div",{class:"typing-indicator"},[e.createElementVNode("span"),e.createElementVNode("span"),e.createElementVNode("span")])],-1)),J={class:"input-area"},W={class:"input-actions"},G=w(()=>e.createElementVNode("div",{class:"input-hint"},[e.createElementVNode("span",null,"Ctrl + Enter 发送")],-1)),Q={__name:"index",props:{defaultMessage:{type:String,default:`你好呀!我是你的品种池AI助手,会根据您的自然语言去进行品种的条件查询
1
+ "use strict";const v=require("./base-ef747d02.cjs"),A=require("./el-dialog-1b185570.cjs");require("./el-overlay-ea65cb05.cjs");const C=require("./el-button-974ff9e9.cjs"),z=require("./el-input-fa18ef84.cjs"),e=require("vue"),w=require("./dayjs.min-2c20abe6.cjs"),k=require("./index-33f80550.cjs"),T=require("./_plugin-vue_export-helper-f246444f.cjs"),b=require("./index-6ca95c8a.cjs"),q=require("./use-form-common-props-d3ed62c6.cjs");require("./index-28e03bad.cjs");require("./index-9780a537.cjs");require("./index-bb833443.cjs");require("./index-f1c702f6.cjs");require("./vnode-b906ae6d.cjs");require("./scroll-b108dabd.cjs");require("./use-global-config-c80f33a4.cjs");require("./index-37b8d3c6.cjs");require("./index-eea0bcb3.cjs");require("./typescript-b63f8e83.cjs");require("./index-7dce9f59.cjs");require("./config-provider-2ae47cc8.cjs");const H=v.buildProps({size:{type:[Number,String],values:q.componentSizes,default:"",validator:s=>v.isNumber(s)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:q.iconPropType},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:v.definePropType(String),default:"cover"}}),M={error:s=>s instanceof Event},D=e.defineComponent({name:"ElAvatar"}),j=e.defineComponent({...D,props:H,emits:M,setup(s,{emit:_}){const p=s,n=v.useNamespace("avatar"),c=e.ref(!1),a=e.computed(()=>{const{size:t,icon:f,shape:l}=p,i=[n.b()];return v.isString(t)&&i.push(n.m(t)),f&&i.push(n.m("icon")),l&&i.push(n.m(l)),i}),o=e.computed(()=>{const{size:t}=p;return v.isNumber(t)?n.cssVarBlock({size:v.addUnit(t)||""}):void 0}),u=e.computed(()=>({objectFit:p.fit}));e.watch(()=>p.src,()=>c.value=!1);function r(t){c.value=!0,_("error",t)}return(t,f)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(e.unref(a)),style:e.normalizeStyle(e.unref(o))},[(t.src||t.srcSet)&&!c.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.src,alt:t.alt,srcset:t.srcSet,style:e.normalizeStyle(e.unref(u)),onError:r},null,44,["src","alt","srcset"])):t.icon?(e.openBlock(),e.createBlock(e.unref(k.ElIcon),{key:1},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.icon)))]),_:1})):e.renderSlot(t.$slots,"default",{key:2})],6))}});var O=v._export_sfc(j,[["__file","avatar.vue"]]);const P=v.withInstall(O);const $=async({appId:s,apiKey:_,value:p,callback:n})=>{var c;try{const a=await fetch(`https://dashscope.aliyuncs.com/api/v1/apps/${s}/completion`,{method:"POST",body:JSON.stringify({input:{prompt:p},parameters:{incremental_output:"true"},debug:{}}),headers:{Authorization:`Bearer ${_}`,"Content-Type":"application/json","X-DashScope-SSE":"enable"}});if(!a.ok)throw new Error(`HTTP ${a.status}`);const o=a.body.getReader(),u=new TextDecoder;let r="";for(;;){const{done:t,value:f}=await o.read();if(t){r.trim()&&R(r,n),n("finish","");break}r+=u.decode(f,{stream:!0});let l;for(;(l=r.indexOf(`
2
+ `))!==-1;){const i=r.substring(0,l).trim();if(r=r.substring(l+1),i.startsWith("data:")){const E=i.substring(5).trim();if(E&&E!=="[DONE]")try{const d=JSON.parse(E),g=(c=d==null?void 0:d.output)==null?void 0:c.text;g&&n&&n("message",g)}catch{console.debug("等待完整数据...")}}}}}catch(a){console.error("流式请求失败:",a),n("error",a.message)}};function R(s,_){var n;const p=s.split(`
3
+ `);for(const c of p)if(c.startsWith("data:")){const a=c.substring(5).trim();if(a&&a!=="[DONE]")try{const o=JSON.parse(a),u=(n=o==null?void 0:o.output)==null?void 0:n.text;u&&_&&_("message",u)}catch{}}}const x=s=>(e.pushScopeId("data-v-46407344"),s=s(),e.popScopeId(),s),L={class:"chat-container"},K={class:"avatar"},F={class:"message-content"},J={class:"message-text"},U={class:"message-time"},W={key:0,class:"message-item assistant"},X={class:"avatar"},G=x(()=>e.createElementVNode("div",{class:"message-content"},[e.createElementVNode("div",{class:"typing-indicator"},[e.createElementVNode("span"),e.createElementVNode("span"),e.createElementVNode("span")])],-1)),Q={class:"input-area"},Y={class:"input-actions"},Z=x(()=>e.createElementVNode("div",{class:"input-hint"},[e.createElementVNode("span",null,"Ctrl + Enter 发送")],-1)),ee={__name:"index",props:{defaultMessage:{type:String,default:`你好呀!我是你的品种池AI助手,会根据您的自然语言去进行品种的条件查询
2
4
 
3
5
  示例:
4
- 科创板里总市值大于1000W的, 帮我按照总市值升序进行排序`}},emits:["callBack"],setup(s,{expose:v,emit:i}){const a=i,o=s,n=e.ref(!1),d=e.ref(!1),_=e.ref(!1),m=e.ref(null),t=e.ref([]),p=e.ref(""),y=async()=>{const h=p.value.trim();if(!h)return V.ElMessage.warning("请输入消息内容");if(d.value)return;t.value.push({role:"user",time:E.dayjs().format("HH:mm"),content:h}),p.value="",await r(),d.value=!0,_.value=!0;let c="{}";try{c=await j({appId:"9e54d112acfe4531bd1fc4fee8827fef",apiKey:"sk-d995eb26a4334bdeb2ccb4cbfaf51de8",value:h}),t.value.push({role:"assistant",time:E.dayjs().format("HH:mm"),content:c}),await r()}catch(f){V.ElMessage.error(`AI响应异常: ${f}`),console.error("AI响应异常:",f)}finally{d.value=!1,_.value=!1}a("callBack",JSON.parse(c))},r=async()=>{await e.nextTick(),m.value&&(m.value.scrollTop=m.value.scrollHeight)};return e.onMounted(()=>{t.value.push({role:"assistant",time:E.dayjs().format("HH:mm"),content:o.defaultMessage})}),e.watch(()=>t.value,()=>{r()},{deep:!0}),v({open:h=>{n.value=!0,e.nextTick(()=>{r()})}}),(h,c)=>{const f=M,k=T.ElInput,S=x.ElButton,q=b.ElDialog;return e.openBlock(),e.createBlock(q,{class:"ai-dialog",modelValue:n.value,"onUpdate:modelValue":c[1]||(c[1]=u=>n.value=u),title:"✨ 品种池参数解析AI助手",width:"500px",center:"",draggable:"",overflow:"",modal:!1,"modal-penetrable":!0},{default:e.withCtx(()=>[e.createElementVNode("div",P,[e.createElementVNode("div",{ref_key:"messageListRef",ref:m,class:"message-list"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,(u,B)=>(e.openBlock(),e.createElementBlock("div",{key:B,class:e.normalizeClass(["message-item",u.role])},[e.createElementVNode("div",L,[e.createVNode(f,{size:32,icon:u.role==="user"?e.unref(g.user_filled_default):e.unref(g.service_default)},null,8,["icon"])]),e.createElementVNode("div",D,[e.createElementVNode("div",K,e.toDisplayString(u.content),1),e.createElementVNode("div",R,e.toDisplayString(u.time),1)])],2))),128)),_.value?(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("div",O,[e.createVNode(f,{size:32,icon:e.unref(g.service_default)},null,8,["icon"])]),U])):e.createCommentVNode("",!0)],512),e.createElementVNode("div",J,[e.createVNode(k,{class:"message-input",modelValue:p.value,"onUpdate:modelValue":c[0]||(c[0]=u=>p.value=u),type:"textarea",rows:4,autosize:{minRows:2,maxRows:4},placeholder:"输入您想查询的品种条件...",onKeydown:e.withKeys(e.withModifiers(y,["ctrl"]),["enter"])},null,8,["modelValue","onKeydown"]),e.createElementVNode("div",W,[G,e.createVNode(S,{class:"send-btn",type:"primary",icon:e.unref(g.promotion_default),loading:d.value,onClick:y,round:""},{default:e.withCtx(()=>[e.createTextVNode(" 发送 ")]),_:1},8,["icon","loading"])])])])]),_:1},8,["modelValue"])}}},X=z._export_sfc(Q,[["__scopeId","data-v-e461ef4d"]]),Y={install(s){s.component("st-varietyAiHelper",X)}};module.exports=Y;
6
+ 帮我查A股科创板下品种转价差上证50并且总市值大于1千万, 按照总市值升序进行排序`}},emits:["callBack"],setup(s,{expose:_,emit:p}){const n=p,c=s,a=e.ref(!1),o=e.ref(!1),u=e.ref(!1),r=e.ref(null),t=e.ref([]),f=e.ref(""),l=e.ref(null),i=e.ref(-1),E=async()=>{const g=f.value.trim();if(!g)return b.ElMessage.warning("请输入消息内容");if(o.value)return;t.value.push({role:"user",time:w.dayjs().format("HH:mm"),content:g}),f.value="",await d();const y={role:"assistant",time:w.dayjs().format("HH:mm"),content:""};t.value.push(y),i.value=t.value.length-1,l.value=y,await d(),o.value=!0,u.value=!0;let h="";try{await $({appId:"9e54d112acfe4531bd1fc4fee8827fef",apiKey:"sk-d995eb26a4334bdeb2ccb4cbfaf51de8",value:g,callback:(V,N)=>{if(V==="message")h+=N,l.value&&(l.value.content=h,d());else if(V==="finish"){u.value=!1,o.value=!1,console.log(h);try{const m=JSON.parse(h);n("callBack",m)}catch{n("callBack",h)}l.value=null,i.value=-1}}})}catch(S){b.ElMessage.error(`AI响应异常: ${S}`),console.error("AI响应异常:",S),i.value!==-1&&(t.value.splice(i.value,1),l.value=null,i.value=-1),t.value.push({role:"assistant",time:w.dayjs().format("HH:mm"),content:"抱歉,AI服务响应异常,请稍后重试。"}),await d(),o.value=!1,u.value=!1}},d=async()=>{await e.nextTick(),r.value&&(r.value.scrollTop=r.value.scrollHeight)};return e.onMounted(()=>{t.value.push({role:"assistant",time:w.dayjs().format("HH:mm"),content:c.defaultMessage})}),e.watch(()=>t.value,()=>{d()},{deep:!0}),_({open:g=>{a.value=!0,e.nextTick(()=>{d()})}}),(g,y)=>{const h=P,S=z.ElInput,B=C.ElButton,V=A.ElDialog;return e.openBlock(),e.createBlock(V,{class:"ai-dialog",modelValue:a.value,"onUpdate:modelValue":y[1]||(y[1]=N=>a.value=N),title:"✨ 品种池参数解析AI助手",width:"500px",center:"",draggable:"",overflow:"",modal:!1,"modal-penetrable":!0},{default:e.withCtx(()=>{var N;return[e.createElementVNode("div",L,[e.createElementVNode("div",{ref_key:"messageListRef",ref:r,class:"message-list"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,(m,I)=>(e.openBlock(),e.createElementBlock("div",{key:I,class:e.normalizeClass(["message-item",m.role])},[m.content?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",K,[e.createVNode(h,{size:32,icon:m.role==="user"?e.unref(k.user_filled_default):e.unref(k.service_default)},null,8,["icon"])]),e.createElementVNode("div",F,[e.createElementVNode("div",J,e.toDisplayString(m.content),1),e.createElementVNode("div",U,e.toDisplayString(m.time),1)])],64)):e.createCommentVNode("",!0)],2))),128)),u.value&&!((N=l.value)!=null&&N.content)?(e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("div",X,[e.createVNode(h,{size:32,icon:e.unref(k.service_default)},null,8,["icon"])]),G])):e.createCommentVNode("",!0)],512),e.createElementVNode("div",Q,[e.createVNode(S,{class:"message-input",modelValue:f.value,"onUpdate:modelValue":y[0]||(y[0]=m=>f.value=m),type:"textarea",rows:4,autosize:{minRows:2,maxRows:4},placeholder:"输入您想查询的品种条件...",onKeydown:e.withKeys(e.withModifiers(E,["ctrl"]),["enter"])},null,8,["modelValue","onKeydown"]),e.createElementVNode("div",Y,[Z,e.createVNode(B,{class:"send-btn",type:"primary",icon:e.unref(k.promotion_default),loading:o.value,onClick:E,round:""},{default:e.withCtx(()=>[e.createTextVNode(" 发送 ")]),_:1},8,["icon","loading"])])])])]}),_:1},8,["modelValue"])}}},te=T._export_sfc(ee,[["__scopeId","data-v-46407344"]]),se={install(s){s.component("st-varietyAiHelper",te)}};module.exports=se;
@@ -1,14 +1,14 @@
1
- import { b as j, p as N, e as D, u as O, c as U, n as F, _ as J, w as q } from "./base-29f73b05.js";
2
- import { E as W } from "./el-dialog-eedcfd3e.js";
1
+ import { b as F, p as $, e as W, u as q, c as X, n as G, _ as Q, w as Y } from "./base-29f73b05.js";
2
+ import { E as Z } from "./el-dialog-eedcfd3e.js";
3
3
  import "./el-overlay-1ee0338d.js";
4
- import { E as G } from "./el-button-e2c63c08.js";
5
- import { E as Q } from "./el-input-d47281da.js";
6
- import { defineComponent as C, ref as f, computed as b, watch as $, openBlock as p, createElementBlock as S, normalizeClass as M, unref as u, normalizeStyle as I, createBlock as T, withCtx as x, resolveDynamicComponent as X, renderSlot as Y, onMounted as Z, nextTick as z, createElementVNode as t, Fragment as ee, renderList as te, createVNode as E, toDisplayString as V, createCommentVNode as se, withKeys as ae, withModifiers as oe, createTextVNode as ne, pushScopeId as re, popScopeId as ie } from "vue";
7
- import { d as k } from "./dayjs.min-8313b006.js";
8
- import { E as le, u as ce, s as B, p as pe } from "./index-c2b9bbfd.js";
9
- import { _ as ue } from "./_plugin-vue_export-helper-dad06003.js";
10
- import { E as H } from "./index-f30561d3.js";
11
- import { k as de, i as me } from "./use-form-common-props-cb0ca65c.js";
4
+ import { E as ee } from "./el-button-e2c63c08.js";
5
+ import { E as te } from "./el-input-d47281da.js";
6
+ import { defineComponent as L, ref as v, computed as T, watch as K, openBlock as _, createElementBlock as k, normalizeClass as j, unref as S, normalizeStyle as V, createBlock as z, withCtx as B, resolveDynamicComponent as se, renderSlot as ae, onMounted as oe, nextTick as C, createElementVNode as o, Fragment as M, renderList as ne, createVNode as I, toDisplayString as O, createCommentVNode as D, withKeys as re, withModifiers as ie, createTextVNode as le, pushScopeId as ce, popScopeId as ue } from "vue";
7
+ import { d as N } from "./dayjs.min-8313b006.js";
8
+ import { E as pe, u as de, s as P, p as me } from "./index-c2b9bbfd.js";
9
+ import { _ as fe } from "./_plugin-vue_export-helper-dad06003.js";
10
+ import { E as R } from "./index-f30561d3.js";
11
+ import { k as ve, i as _e } from "./use-form-common-props-cb0ca65c.js";
12
12
  import "./index-0f79095c.js";
13
13
  import "./index-8391a3df.js";
14
14
  import "./index-de24705f.js";
@@ -21,12 +21,12 @@ import "./index-657047bb.js";
21
21
  import "./typescript-7ae59c4c.js";
22
22
  import "./index-c71e37dc.js";
23
23
  import "./config-provider-7860903c.js";
24
- const fe = j({
24
+ const ge = F({
25
25
  size: {
26
26
  type: [Number, String],
27
- values: de,
27
+ values: ve,
28
28
  default: "",
29
- validator: (s) => N(s)
29
+ validator: (t) => $(t)
30
30
  },
31
31
  shape: {
32
32
  type: String,
@@ -34,7 +34,7 @@ const fe = j({
34
34
  default: "circle"
35
35
  },
36
36
  icon: {
37
- type: me
37
+ type: _e
38
38
  },
39
39
  src: {
40
40
  type: String,
@@ -43,92 +43,129 @@ const fe = j({
43
43
  alt: String,
44
44
  srcSet: String,
45
45
  fit: {
46
- type: D(String),
46
+ type: W(String),
47
47
  default: "cover"
48
48
  }
49
- }), ve = {
50
- error: (s) => s instanceof Event
51
- }, _e = C({
49
+ }), he = {
50
+ error: (t) => t instanceof Event
51
+ }, ye = L({
52
52
  name: "ElAvatar"
53
- }), ye = /* @__PURE__ */ C({
54
- ..._e,
55
- props: fe,
56
- emits: ve,
57
- setup(s, { emit: y }) {
58
- const i = s, o = O("avatar"), a = f(!1), n = b(() => {
59
- const { size: e, icon: m, shape: g } = i, r = [o.b()];
60
- return U(e) && r.push(o.m(e)), m && r.push(o.m("icon")), g && r.push(o.m(g)), r;
61
- }), d = b(() => {
62
- const { size: e } = i;
63
- return N(e) ? o.cssVarBlock({
64
- size: F(e) || ""
53
+ }), Se = /* @__PURE__ */ L({
54
+ ...ye,
55
+ props: ge,
56
+ emits: he,
57
+ setup(t, { emit: g }) {
58
+ const d = t, s = q("avatar"), c = v(!1), a = T(() => {
59
+ const { size: e, icon: f, shape: i } = d, l = [s.b()];
60
+ return X(e) && l.push(s.m(e)), f && l.push(s.m("icon")), i && l.push(s.m(i)), l;
61
+ }), n = T(() => {
62
+ const { size: e } = d;
63
+ return $(e) ? s.cssVarBlock({
64
+ size: G(e) || ""
65
65
  }) : void 0;
66
- }), h = b(() => ({
67
- objectFit: i.fit
66
+ }), u = T(() => ({
67
+ objectFit: d.fit
68
68
  }));
69
- $(() => i.src, () => a.value = !1);
70
- function v(e) {
71
- a.value = !0, y("error", e);
69
+ K(() => d.src, () => c.value = !1);
70
+ function r(e) {
71
+ c.value = !0, g("error", e);
72
72
  }
73
- return (e, m) => (p(), S("span", {
74
- class: M(u(n)),
75
- style: I(u(d))
73
+ return (e, f) => (_(), k("span", {
74
+ class: j(S(a)),
75
+ style: V(S(n))
76
76
  }, [
77
- (e.src || e.srcSet) && !a.value ? (p(), S("img", {
77
+ (e.src || e.srcSet) && !c.value ? (_(), k("img", {
78
78
  key: 0,
79
79
  src: e.src,
80
80
  alt: e.alt,
81
81
  srcset: e.srcSet,
82
- style: I(u(h)),
83
- onError: v
84
- }, null, 44, ["src", "alt", "srcset"])) : e.icon ? (p(), T(u(le), { key: 1 }, {
85
- default: x(() => [
86
- (p(), T(X(e.icon)))
82
+ style: V(S(u)),
83
+ onError: r
84
+ }, null, 44, ["src", "alt", "srcset"])) : e.icon ? (_(), z(S(pe), { key: 1 }, {
85
+ default: B(() => [
86
+ (_(), z(se(e.icon)))
87
87
  ]),
88
88
  _: 1
89
- })) : Y(e.$slots, "default", { key: 2 })
89
+ })) : ae(e.$slots, "default", { key: 2 })
90
90
  ], 6));
91
91
  }
92
92
  });
93
- var he = /* @__PURE__ */ J(ye, [["__file", "avatar.vue"]]);
94
- const ge = q(he);
95
- const we = async ({ appId: s, apiKey: y, value: i }) => {
96
- var o;
93
+ var we = /* @__PURE__ */ Q(Se, [["__file", "avatar.vue"]]);
94
+ const be = Y(we);
95
+ const Ee = async ({ appId: t, apiKey: g, value: d, callback: s }) => {
96
+ var c;
97
97
  try {
98
- const a = await fetch(`https://dashscope.aliyuncs.com/api/v1/apps/${s}/completion`, {
98
+ const a = await fetch(`https://dashscope.aliyuncs.com/api/v1/apps/${t}/completion`, {
99
99
  method: "POST",
100
- headers: {
101
- Authorization: `Bearer ${y}`,
102
- "Content-Type": "application/json"
103
- },
104
100
  body: JSON.stringify({
105
- input: { prompt: i },
106
- parameters: {
107
- incremental_output: !1
108
- // 非流式
109
- }
110
- })
101
+ input: { prompt: d },
102
+ parameters: { incremental_output: "true" },
103
+ debug: {}
104
+ }),
105
+ headers: {
106
+ Authorization: `Bearer ${g}`,
107
+ "Content-Type": "application/json",
108
+ "X-DashScope-SSE": "enable"
109
+ }
111
110
  });
112
111
  if (!a.ok)
113
- throw new Error(`HTTP ${a.status}: ${a.statusText}`);
114
- const n = await a.json();
115
- return (o = n == null ? void 0 : n.output) == null ? void 0 : o.text;
112
+ throw new Error(`HTTP ${a.status}`);
113
+ const n = a.body.getReader(), u = new TextDecoder();
114
+ let r = "";
115
+ for (; ; ) {
116
+ const { done: e, value: f } = await n.read();
117
+ if (e) {
118
+ r.trim() && ke(r, s), s("finish", "");
119
+ break;
120
+ }
121
+ r += u.decode(f, { stream: !0 });
122
+ let i;
123
+ for (; (i = r.indexOf(`
124
+ `)) !== -1; ) {
125
+ const l = r.substring(0, i).trim();
126
+ if (r = r.substring(i + 1), l.startsWith("data:")) {
127
+ const b = l.substring(5).trim();
128
+ if (b && b !== "[DONE]")
129
+ try {
130
+ const p = JSON.parse(b), h = (c = p == null ? void 0 : p.output) == null ? void 0 : c.text;
131
+ h && s && s("message", h);
132
+ } catch {
133
+ console.debug("等待完整数据...");
134
+ }
135
+ }
136
+ }
137
+ }
116
138
  } catch (a) {
117
- throw a.name === "AbortError" ? new Error("请求超时") : a;
139
+ console.error("流式请求失败:", a), s("error", a.message);
118
140
  }
119
141
  };
120
- const L = (s) => (re("data-v-e461ef4d"), s = s(), ie(), s), Se = { class: "chat-container" }, Ee = { class: "avatar" }, be = { class: "message-content" }, ke = { class: "message-text" }, Te = { class: "message-time" }, xe = {
142
+ function ke(t, g) {
143
+ var s;
144
+ const d = t.split(`
145
+ `);
146
+ for (const c of d)
147
+ if (c.startsWith("data:")) {
148
+ const a = c.substring(5).trim();
149
+ if (a && a !== "[DONE]")
150
+ try {
151
+ const n = JSON.parse(a), u = (s = n == null ? void 0 : n.output) == null ? void 0 : s.text;
152
+ u && g && g("message", u);
153
+ } catch {
154
+ }
155
+ }
156
+ }
157
+ const J = (t) => (ce("data-v-46407344"), t = t(), ue(), t), xe = { class: "chat-container" }, Ae = { class: "avatar" }, Ie = { class: "message-content" }, Ne = { class: "message-text" }, Te = { class: "message-time" }, ze = {
121
158
  key: 0,
122
159
  class: "message-item assistant"
123
- }, Ae = { class: "avatar" }, Ie = /* @__PURE__ */ L(() => /* @__PURE__ */ t("div", { class: "message-content" }, [
124
- /* @__PURE__ */ t("div", { class: "typing-indicator" }, [
125
- /* @__PURE__ */ t("span"),
126
- /* @__PURE__ */ t("span"),
127
- /* @__PURE__ */ t("span")
160
+ }, Be = { class: "avatar" }, He = /* @__PURE__ */ J(() => /* @__PURE__ */ o("div", { class: "message-content" }, [
161
+ /* @__PURE__ */ o("div", { class: "typing-indicator" }, [
162
+ /* @__PURE__ */ o("span"),
163
+ /* @__PURE__ */ o("span"),
164
+ /* @__PURE__ */ o("span")
128
165
  ])
129
- ], -1)), ze = { class: "input-area" }, Ve = { class: "input-actions" }, Be = /* @__PURE__ */ L(() => /* @__PURE__ */ t("div", { class: "input-hint" }, [
130
- /* @__PURE__ */ t("span", null, "Ctrl + Enter 发送")
131
- ], -1)), He = {
166
+ ], -1)), Ve = { class: "input-area" }, Ce = { class: "input-actions" }, Me = /* @__PURE__ */ J(() => /* @__PURE__ */ o("div", { class: "input-hint" }, [
167
+ /* @__PURE__ */ o("span", null, "Ctrl + Enter 发送")
168
+ ], -1)), Oe = {
132
169
  __name: "index",
133
170
  props: {
134
171
  defaultMessage: {
@@ -136,62 +173,83 @@ const L = (s) => (re("data-v-e461ef4d"), s = s(), ie(), s), Se = { class: "chat-
136
173
  default: `你好呀!我是你的品种池AI助手,会根据您的自然语言去进行品种的条件查询
137
174
 
138
175
  示例:
139
- 科创板里总市值大于1000W的, 帮我按照总市值升序进行排序`
176
+ 帮我查A股科创板下品种转价差上证50并且总市值大于1千万, 按照总市值升序进行排序`
140
177
  }
141
178
  },
142
179
  emits: ["callBack"],
143
- setup(s, { expose: y, emit: i }) {
144
- const o = i, a = s, n = f(!1), d = f(!1), h = f(!1), v = f(null), e = f([]), m = f(""), g = async () => {
145
- const w = m.value.trim();
146
- if (!w)
147
- return H.warning("请输入消息内容");
148
- if (d.value)
180
+ setup(t, { expose: g, emit: d }) {
181
+ const s = d, c = t, a = v(!1), n = v(!1), u = v(!1), r = v(null), e = v([]), f = v(""), i = v(null), l = v(-1), b = async () => {
182
+ const h = f.value.trim();
183
+ if (!h)
184
+ return R.warning("请输入消息内容");
185
+ if (n.value)
149
186
  return;
150
187
  e.value.push({
151
188
  role: "user",
152
- time: k().format("HH:mm"),
153
- content: w
154
- }), m.value = "", await r(), d.value = !0, h.value = !0;
155
- let l = "{}";
189
+ time: N().format("HH:mm"),
190
+ content: h
191
+ }), f.value = "", await p();
192
+ const w = {
193
+ role: "assistant",
194
+ time: N().format("HH:mm"),
195
+ content: ""
196
+ };
197
+ e.value.push(w), l.value = e.value.length - 1, i.value = w, await p(), n.value = !0, u.value = !0;
198
+ let y = "";
156
199
  try {
157
- l = await we({ appId: "9e54d112acfe4531bd1fc4fee8827fef", apiKey: "sk-d995eb26a4334bdeb2ccb4cbfaf51de8", value: w }), e.value.push({
200
+ await Ee({
201
+ appId: "9e54d112acfe4531bd1fc4fee8827fef",
202
+ apiKey: "sk-d995eb26a4334bdeb2ccb4cbfaf51de8",
203
+ value: h,
204
+ callback: (A, E) => {
205
+ if (A === "message")
206
+ y += E, i.value && (i.value.content = y, p());
207
+ else if (A === "finish") {
208
+ u.value = !1, n.value = !1, console.log(y);
209
+ try {
210
+ const m = JSON.parse(y);
211
+ s("callBack", m);
212
+ } catch {
213
+ s("callBack", y);
214
+ }
215
+ i.value = null, l.value = -1;
216
+ }
217
+ }
218
+ });
219
+ } catch (x) {
220
+ R.error(`AI响应异常: ${x}`), console.error("AI响应异常:", x), l.value !== -1 && (e.value.splice(l.value, 1), i.value = null, l.value = -1), e.value.push({
158
221
  role: "assistant",
159
- time: k().format("HH:mm"),
160
- content: l
161
- }), await r();
162
- } catch (_) {
163
- H.error(`AI响应异常: ${_}`), console.error("AI响应异常:", _);
164
- } finally {
165
- d.value = !1, h.value = !1;
222
+ time: N().format("HH:mm"),
223
+ content: "抱歉,AI服务响应异常,请稍后重试。"
224
+ }), await p(), n.value = !1, u.value = !1;
166
225
  }
167
- o("callBack", JSON.parse(l));
168
- }, r = async () => {
169
- await z(), v.value && (v.value.scrollTop = v.value.scrollHeight);
226
+ }, p = async () => {
227
+ await C(), r.value && (r.value.scrollTop = r.value.scrollHeight);
170
228
  };
171
- return Z(() => {
229
+ return oe(() => {
172
230
  e.value.push({
173
231
  role: "assistant",
174
- time: k().format("HH:mm"),
175
- content: a.defaultMessage
232
+ time: N().format("HH:mm"),
233
+ content: c.defaultMessage
176
234
  });
177
- }), $(
235
+ }), K(
178
236
  () => e.value,
179
237
  () => {
180
- r();
238
+ p();
181
239
  },
182
240
  { deep: !0 }
183
- ), y({
184
- open: (w) => {
185
- n.value = !0, z(() => {
186
- r();
241
+ ), g({
242
+ open: (h) => {
243
+ a.value = !0, C(() => {
244
+ p();
187
245
  });
188
246
  }
189
- }), (w, l) => {
190
- const _ = ge, A = Q, P = G, K = W;
191
- return p(), T(K, {
247
+ }), (h, w) => {
248
+ const y = be, x = te, H = ee, A = Z;
249
+ return _(), z(A, {
192
250
  class: "ai-dialog",
193
- modelValue: n.value,
194
- "onUpdate:modelValue": l[1] || (l[1] = (c) => n.value = c),
251
+ modelValue: a.value,
252
+ "onUpdate:modelValue": w[1] || (w[1] = (E) => a.value = E),
195
253
  title: "✨ 品种池参数解析AI助手",
196
254
  width: "500px",
197
255
  center: "",
@@ -200,77 +258,82 @@ const L = (s) => (re("data-v-e461ef4d"), s = s(), ie(), s), Se = { class: "chat-
200
258
  modal: !1,
201
259
  "modal-penetrable": !0
202
260
  }, {
203
- default: x(() => [
204
- t("div", Se, [
205
- t("div", {
206
- ref_key: "messageListRef",
207
- ref: v,
208
- class: "message-list"
209
- }, [
210
- (p(!0), S(ee, null, te(e.value, (c, R) => (p(), S("div", {
211
- key: R,
212
- class: M(["message-item", c.role])
261
+ default: B(() => {
262
+ var E;
263
+ return [
264
+ o("div", xe, [
265
+ o("div", {
266
+ ref_key: "messageListRef",
267
+ ref: r,
268
+ class: "message-list"
213
269
  }, [
214
- t("div", Ee, [
215
- E(_, {
216
- size: 32,
217
- icon: c.role === "user" ? u(ce) : u(B)
218
- }, null, 8, ["icon"])
219
- ]),
220
- t("div", be, [
221
- t("div", ke, V(c.content), 1),
222
- t("div", Te, V(c.time), 1)
223
- ])
224
- ], 2))), 128)),
225
- h.value ? (p(), S("div", xe, [
226
- t("div", Ae, [
227
- E(_, {
228
- size: 32,
229
- icon: u(B)
230
- }, null, 8, ["icon"])
231
- ]),
232
- Ie
233
- ])) : se("", !0)
234
- ], 512),
235
- t("div", ze, [
236
- E(A, {
237
- class: "message-input",
238
- modelValue: m.value,
239
- "onUpdate:modelValue": l[0] || (l[0] = (c) => m.value = c),
240
- type: "textarea",
241
- rows: 4,
242
- autosize: { minRows: 2, maxRows: 4 },
243
- placeholder: "输入您想查询的品种条件...",
244
- onKeydown: ae(oe(g, ["ctrl"]), ["enter"])
245
- }, null, 8, ["modelValue", "onKeydown"]),
246
- t("div", Ve, [
247
- Be,
248
- E(P, {
249
- class: "send-btn",
250
- type: "primary",
251
- icon: u(pe),
252
- loading: d.value,
253
- onClick: g,
254
- round: ""
255
- }, {
256
- default: x(() => [
257
- ne(" 发送 ")
270
+ (_(!0), k(M, null, ne(e.value, (m, U) => (_(), k("div", {
271
+ key: U,
272
+ class: j(["message-item", m.role])
273
+ }, [
274
+ m.content ? (_(), k(M, { key: 0 }, [
275
+ o("div", Ae, [
276
+ I(y, {
277
+ size: 32,
278
+ icon: m.role === "user" ? S(de) : S(P)
279
+ }, null, 8, ["icon"])
280
+ ]),
281
+ o("div", Ie, [
282
+ o("div", Ne, O(m.content), 1),
283
+ o("div", Te, O(m.time), 1)
284
+ ])
285
+ ], 64)) : D("", !0)
286
+ ], 2))), 128)),
287
+ u.value && !((E = i.value) != null && E.content) ? (_(), k("div", ze, [
288
+ o("div", Be, [
289
+ I(y, {
290
+ size: 32,
291
+ icon: S(P)
292
+ }, null, 8, ["icon"])
258
293
  ]),
259
- _: 1
260
- }, 8, ["icon", "loading"])
294
+ He
295
+ ])) : D("", !0)
296
+ ], 512),
297
+ o("div", Ve, [
298
+ I(x, {
299
+ class: "message-input",
300
+ modelValue: f.value,
301
+ "onUpdate:modelValue": w[0] || (w[0] = (m) => f.value = m),
302
+ type: "textarea",
303
+ rows: 4,
304
+ autosize: { minRows: 2, maxRows: 4 },
305
+ placeholder: "输入您想查询的品种条件...",
306
+ onKeydown: re(ie(b, ["ctrl"]), ["enter"])
307
+ }, null, 8, ["modelValue", "onKeydown"]),
308
+ o("div", Ce, [
309
+ Me,
310
+ I(H, {
311
+ class: "send-btn",
312
+ type: "primary",
313
+ icon: S(me),
314
+ loading: n.value,
315
+ onClick: b,
316
+ round: ""
317
+ }, {
318
+ default: B(() => [
319
+ le(" 发送 ")
320
+ ]),
321
+ _: 1
322
+ }, 8, ["icon", "loading"])
323
+ ])
261
324
  ])
262
325
  ])
263
- ])
264
- ]),
326
+ ];
327
+ }),
265
328
  _: 1
266
329
  }, 8, ["modelValue"]);
267
330
  };
268
331
  }
269
- }, Ne = /* @__PURE__ */ ue(He, [["__scopeId", "data-v-e461ef4d"]]), at = {
270
- install(s) {
271
- s.component("st-varietyAiHelper", Ne);
332
+ }, De = /* @__PURE__ */ fe(Oe, [["__scopeId", "data-v-46407344"]]), it = {
333
+ install(t) {
334
+ t.component("st-varietyAiHelper", De);
272
335
  }
273
336
  };
274
337
  export {
275
- at as default
338
+ it as default
276
339
  };