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.
- package/es/MonacoEditor.cjs +1 -1
- package/es/MonacoEditor.js +1 -1
- package/es/VarietyAiHelper.cjs +4 -2
- package/es/VarietyAiHelper.js +234 -171
- package/es/VarietySearch.cjs +1 -1
- package/es/VarietySearch.js +1 -1
- package/es/aiTools.js +81 -8
- package/es/{index-5befc414.cjs → index-40f05e2c.cjs} +2 -2
- package/es/{index-8f9d0d17.js → index-8a54ceeb.js} +2 -2
- package/es/{python-27ece6fa.cjs → python-02c3937a.cjs} +1 -1
- package/es/{python-656db04f.js → python-99011a53.js} +1 -1
- package/es/style.css +1 -1
- package/lib/aiTools.js +81 -8
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +50 -48
- package/lib/{index-b51777a3.js → index-d57eff69.js} +755 -692
- package/lib/{python-ac4949ec.js → python-fe790c5a.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/VarietyAiHelper/index.vue +91 -26
- package/public/aiTools.js +81 -8
- package/src/pages/VarietySearch/index.vue +0 -1
package/es/MonacoEditor.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const r=require("./index-
|
|
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;
|
package/es/MonacoEditor.js
CHANGED
package/es/VarietyAiHelper.cjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
"use strict";const
|
|
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
|
-
|
|
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;
|
package/es/VarietyAiHelper.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { b as
|
|
2
|
-
import { E as
|
|
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
|
|
5
|
-
import { E as
|
|
6
|
-
import { defineComponent as
|
|
7
|
-
import { d as
|
|
8
|
-
import { E as
|
|
9
|
-
import { _ as
|
|
10
|
-
import { E as
|
|
11
|
-
import { k as
|
|
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
|
|
24
|
+
const ge = F({
|
|
25
25
|
size: {
|
|
26
26
|
type: [Number, String],
|
|
27
|
-
values:
|
|
27
|
+
values: ve,
|
|
28
28
|
default: "",
|
|
29
|
-
validator: (
|
|
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:
|
|
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:
|
|
46
|
+
type: W(String),
|
|
47
47
|
default: "cover"
|
|
48
48
|
}
|
|
49
|
-
}),
|
|
50
|
-
error: (
|
|
51
|
-
},
|
|
49
|
+
}), he = {
|
|
50
|
+
error: (t) => t instanceof Event
|
|
51
|
+
}, ye = L({
|
|
52
52
|
name: "ElAvatar"
|
|
53
|
-
}),
|
|
54
|
-
...
|
|
55
|
-
props:
|
|
56
|
-
emits:
|
|
57
|
-
setup(
|
|
58
|
-
const
|
|
59
|
-
const { size: e, icon:
|
|
60
|
-
return
|
|
61
|
-
}),
|
|
62
|
-
const { size: e } =
|
|
63
|
-
return
|
|
64
|
-
size:
|
|
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
|
-
}),
|
|
67
|
-
objectFit:
|
|
66
|
+
}), u = T(() => ({
|
|
67
|
+
objectFit: d.fit
|
|
68
68
|
}));
|
|
69
|
-
|
|
70
|
-
function
|
|
71
|
-
|
|
69
|
+
K(() => d.src, () => c.value = !1);
|
|
70
|
+
function r(e) {
|
|
71
|
+
c.value = !0, g("error", e);
|
|
72
72
|
}
|
|
73
|
-
return (e,
|
|
74
|
-
class:
|
|
75
|
-
style:
|
|
73
|
+
return (e, f) => (_(), k("span", {
|
|
74
|
+
class: j(S(a)),
|
|
75
|
+
style: V(S(n))
|
|
76
76
|
}, [
|
|
77
|
-
(e.src || e.srcSet) && !
|
|
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:
|
|
83
|
-
onError:
|
|
84
|
-
}, null, 44, ["src", "alt", "srcset"])) : e.icon ? (
|
|
85
|
-
default:
|
|
86
|
-
(
|
|
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
|
-
})) :
|
|
89
|
+
})) : ae(e.$slots, "default", { key: 2 })
|
|
90
90
|
], 6));
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
|
-
var
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
var
|
|
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/${
|
|
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:
|
|
106
|
-
parameters: {
|
|
107
|
-
|
|
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}
|
|
114
|
-
const n =
|
|
115
|
-
|
|
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
|
-
|
|
139
|
+
console.error("流式请求失败:", a), s("error", a.message);
|
|
118
140
|
}
|
|
119
141
|
};
|
|
120
|
-
|
|
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
|
-
},
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
/* @__PURE__ */
|
|
127
|
-
/* @__PURE__ */
|
|
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)),
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
], -1)),
|
|
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
|
-
|
|
176
|
+
帮我查A股科创板下品种转价差上证50并且总市值大于1千万, 按照总市值升序进行排序`
|
|
140
177
|
}
|
|
141
178
|
},
|
|
142
179
|
emits: ["callBack"],
|
|
143
|
-
setup(
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
if (!
|
|
147
|
-
return
|
|
148
|
-
if (
|
|
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:
|
|
153
|
-
content:
|
|
154
|
-
}),
|
|
155
|
-
|
|
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
|
-
|
|
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:
|
|
160
|
-
content:
|
|
161
|
-
}), await
|
|
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
|
-
|
|
168
|
-
|
|
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
|
|
229
|
+
return oe(() => {
|
|
172
230
|
e.value.push({
|
|
173
231
|
role: "assistant",
|
|
174
|
-
time:
|
|
175
|
-
content:
|
|
232
|
+
time: N().format("HH:mm"),
|
|
233
|
+
content: c.defaultMessage
|
|
176
234
|
});
|
|
177
|
-
}),
|
|
235
|
+
}), K(
|
|
178
236
|
() => e.value,
|
|
179
237
|
() => {
|
|
180
|
-
|
|
238
|
+
p();
|
|
181
239
|
},
|
|
182
240
|
{ deep: !0 }
|
|
183
|
-
),
|
|
184
|
-
open: (
|
|
185
|
-
|
|
186
|
-
|
|
241
|
+
), g({
|
|
242
|
+
open: (h) => {
|
|
243
|
+
a.value = !0, C(() => {
|
|
244
|
+
p();
|
|
187
245
|
});
|
|
188
246
|
}
|
|
189
|
-
}), (
|
|
190
|
-
const
|
|
191
|
-
return
|
|
247
|
+
}), (h, w) => {
|
|
248
|
+
const y = be, x = te, H = ee, A = Z;
|
|
249
|
+
return _(), z(A, {
|
|
192
250
|
class: "ai-dialog",
|
|
193
|
-
modelValue:
|
|
194
|
-
"onUpdate:modelValue":
|
|
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:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
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
|
-
|
|
260
|
-
|
|
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
|
-
},
|
|
270
|
-
install(
|
|
271
|
-
|
|
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
|
-
|
|
338
|
+
it as default
|
|
276
339
|
};
|