st-comp 0.0.248 → 0.0.249
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/components.d.ts +1 -0
- package/es/ChartLayout.js +4 -4
- package/es/CustomFunction.cjs +2 -2
- package/es/CustomFunction.js +82 -80
- package/es/FactorWarning.cjs +1 -1
- package/es/FactorWarning.js +36 -35
- package/es/Kline.cjs +1 -1
- package/es/Kline.js +20 -19
- package/es/KlineBasic.cjs +1 -1
- package/es/KlineBasic.js +30 -28
- package/es/KlineConfig.cjs +1 -1
- package/es/KlineConfig.js +83 -82
- package/es/KlineNew.cjs +1 -1
- package/es/KlineNew.js +19 -18
- package/es/KlinePlus.cjs +1 -1
- package/es/KlinePlus.js +22 -21
- package/es/LinearLegend.cjs +1 -1
- package/es/LinearLegend.js +63 -1
- package/es/MonacoEditor.cjs +1 -1
- package/es/MonacoEditor.js +28 -26
- package/es/Pagination.cjs +1 -1
- package/es/Pagination.js +121 -120
- package/es/PasswordPrompt.cjs +1 -1
- package/es/PasswordPrompt.js +3 -3
- package/es/Table.cjs +1 -1
- package/es/Table.js +31 -30
- package/es/User.cjs +1 -1
- package/es/User.js +157 -155
- package/es/VarSelectDialog.cjs +2 -2
- package/es/VarSelectDialog.js +29 -27
- package/es/VarietyAiHelper.cjs +4 -0
- package/es/VarietyAiHelper.js +270 -0
- package/es/VarietyAutoComplete.cjs +1 -1
- package/es/VarietyAutoComplete.js +13 -12
- package/es/VarietySearch.cjs +10 -10
- package/es/VarietySearch.js +70 -68
- package/es/{VarietySelect-2fd501da.cjs → VarietySelect-5c845562.cjs} +1 -1
- package/es/{VarietySelect-b9fe3000.js → VarietySelect-9f267958.js} +4 -4
- package/es/VarietyTextCopy.cjs +1 -1
- package/es/VarietyTextCopy.js +24 -22
- package/es/VirtualTable.cjs +1 -1
- package/es/VirtualTable.js +70 -70
- package/es/{_initCloneObject-3823a101.cjs → _initCloneObject-2b82e9f7.cjs} +1 -1
- package/es/{_initCloneObject-382335b2.js → _initCloneObject-69c8ae23.js} +7 -7
- package/es/aiTools.js +36 -0
- package/es/{base-ff0e366f.js → base-29f73b05.js} +40 -40
- package/es/{castArray-15070be9.js → castArray-609a313e.js} +1 -1
- package/es/{config-provider-2182708a.cjs → config-provider-2ae47cc8.cjs} +1 -1
- package/es/{config-provider-2e85eee8.js → config-provider-7860903c.js} +6 -6
- package/es/{debounce-e9e47f9a.js → debounce-a09ce9a3.js} +1 -1
- package/es/{dropdown-2b35a683.js → dropdown-497442b7.js} +30 -29
- package/es/dropdown-eba9eaf5.cjs +1 -0
- package/es/{el-autocomplete-18be2c5a.js → el-autocomplete-27c60cc8.js} +24 -23
- package/es/el-autocomplete-b59eb529.cjs +1 -0
- package/es/{el-button-68baab7b.cjs → el-button-974ff9e9.cjs} +1 -1
- package/es/{el-button-f08c0639.js → el-button-e2c63c08.js} +39 -39
- package/es/el-checkbox-08185353.cjs +1 -0
- package/es/{el-checkbox-058dba2d.js → el-checkbox-71ebd862.js} +31 -31
- package/es/el-dialog-1b185570.cjs +1 -0
- package/es/{el-dialog-d328e0d8.js → el-dialog-eedcfd3e.js} +15 -15
- package/es/{el-divider-4fe55ebe.js → el-divider-523e5874.js} +1 -1
- package/es/{el-empty-ceecb81c.js → el-empty-f5a1607a.js} +5 -5
- package/es/{el-form-item-cb328886.js → el-form-item-bdcfd297.js} +36 -36
- package/es/{el-form-item-4076e55f.cjs → el-form-item-c997b4fa.cjs} +1 -1
- package/es/{el-input-0f6ead19.js → el-input-d47281da.js} +91 -91
- package/es/el-input-fa18ef84.cjs +1 -0
- package/es/el-input-number-3d94fa58.cjs +1 -0
- package/es/{el-input-number-66e68609.js → el-input-number-c8018cb1.js} +28 -28
- package/es/{el-loading-412370c7.js → el-loading-0cd81d05.js} +5 -5
- package/es/{el-loading-05826e64.cjs → el-loading-969a79ca.cjs} +1 -1
- package/es/el-menu-item-26071fd6.cjs +1 -0
- package/es/{el-menu-item-0ee8ad18.js → el-menu-item-dac65bb3.js} +31 -30
- package/es/el-message-0ea8fbf8.cjs +1 -0
- package/es/el-message-4ed993c7.js +1 -0
- package/es/el-message-box-31e0aa98.cjs +1 -0
- package/es/{el-message-box-6db52b29.js → el-message-box-fea4fca8.js} +11 -11
- package/es/{el-overlay-981f8d49.js → el-overlay-1ee0338d.js} +63 -63
- package/es/el-overlay-ea65cb05.cjs +1 -0
- package/es/{el-popconfirm-005013fa.js → el-popconfirm-089b8bec.js} +17 -16
- package/es/el-popconfirm-9e232436.cjs +1 -0
- package/es/el-popper-2d3914e4.cjs +1 -0
- package/es/el-popper-c9b3d3cf.js +1662 -0
- package/es/el-segmented-140ac042.cjs +1 -0
- package/es/{el-segmented-050d0090.js → el-segmented-9d3a9e11.js} +8 -8
- package/es/el-select-a11f33e8.cjs +1 -0
- package/es/{el-select-23a1f302.js → el-select-e51e11c1.js} +92 -91
- package/es/{el-table-column-d0c374cf.js → el-table-column-05d292a8.js} +25 -24
- package/es/el-table-column-98570a4d.cjs +14 -0
- package/es/{el-tag-f13f463b.js → el-tag-17cd04a1.js} +14 -14
- package/es/el-tag-6d8e653e.cjs +1 -0
- package/es/{el-text-27cef2be.js → el-text-2710fff3.js} +2 -2
- package/es/{el-text-1470de46.cjs → el-text-a18106cb.cjs} +1 -1
- package/es/{index-09bd2621.js → index-0ee486ad.js} +43 -43
- package/es/index-0f79095c.js +440 -0
- package/es/{index-e0901394.js → index-1d9b50de.js} +34 -34
- package/es/index-28e03bad.cjs +1 -0
- package/es/{index-269b22da.cjs → index-299ee017.cjs} +1 -1
- package/es/{index-cebc7160.cjs → index-33f80550.cjs} +1 -1
- package/es/{index-4f48940d.cjs → index-37b8d3c6.cjs} +1 -1
- package/es/{index-2375023e.cjs → index-5befc414.cjs} +4 -4
- package/es/{index-696b6a94.cjs → index-6b99def3.cjs} +1 -1
- package/es/index-6ca95c8a.cjs +1 -0
- package/es/index-7dce9f59.cjs +1 -0
- package/es/{index-269b8a8c.js → index-8391a3df.js} +37 -37
- package/es/{index-c266c23a.js → index-8f9d0d17.js} +16 -15
- package/es/{index-15b9603e.js → index-95e5d454.js} +3 -3
- package/es/{index-b937ea22.js → index-b0117ba2.js} +2 -2
- package/es/{index-80a7ad32.js → index-bcd895a0.js} +17 -17
- package/es/{index-ec7ad93f.js → index-c2b9bbfd.js} +95 -65
- package/es/{index-4a3f30c5.js → index-c71e37dc.js} +11 -11
- package/es/{index-93a8960e.js → index-de24705f.js} +1 -1
- package/es/index-e8eeea22.cjs +1 -0
- package/es/{index-ee977f79.cjs → index-eb99b188.cjs} +1 -1
- package/es/{el-message-e6c755df.js → index-f30561d3.js} +33 -33
- package/es/{python-c67c8901.cjs → python-27ece6fa.cjs} +2 -2
- package/es/{python-823b276b.js → python-656db04f.js} +30 -28
- package/es/raf-744cf95a.js +6 -0
- package/es/{scroll-41b4f625.js → scroll-6799bafc.js} +5 -5
- package/es/style.css +1 -1
- package/es/{use-form-common-props-631cacae.js → use-form-common-props-cb0ca65c.js} +72 -72
- package/es/{use-form-common-props-344056f9.cjs → use-form-common-props-d3ed62c6.cjs} +1 -1
- package/es/{use-global-config-cf78ebac.cjs → use-global-config-c80f33a4.cjs} +1 -1
- package/es/{use-global-config-5d001623.js → use-global-config-cdaeca54.js} +14 -14
- package/es/{validator-3cad04b2.cjs → validator-07160325.cjs} +1 -1
- package/es/{validator-4160d9e7.js → validator-4ab9774f.js} +1 -1
- package/es/{vnode-06571d5b.js → vnode-a83e6de8.js} +1 -1
- package/es/{zh-cn-aabfaa94.cjs → zh-cn-6a0f844c.cjs} +1 -1
- package/es/{zh-cn-5df98ac2.js → zh-cn-8a6390a4.js} +2 -2
- package/lib/aiTools.js +36 -0
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +157 -154
- package/lib/{index-f00d1e1f.js → index-6ac0579e.js} +16077 -15806
- package/lib/{python-0f34e2e6.js → python-0432340a.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/VarietyAiHelper/index.ts +8 -0
- package/packages/VarietyAiHelper/index.vue +430 -0
- package/packages/index.ts +2 -0
- package/public/aiTools.js +36 -0
- package/src/App.vue +24 -14
- package/src/pages/VarietyAiHelper/index.vue +20 -0
- package/src/pages/VarietySearch/index.vue +75 -51
- package/src/router/routes.ts +5 -0
- package/es/dropdown-89b74bc9.cjs +0 -1
- package/es/el-autocomplete-b9a3054a.cjs +0 -1
- package/es/el-checkbox-b982e2ef.cjs +0 -1
- package/es/el-dialog-ad7309e9.cjs +0 -1
- package/es/el-input-172c49f8.cjs +0 -1
- package/es/el-input-number-c2e71528.cjs +0 -1
- package/es/el-menu-item-7f986598.cjs +0 -1
- package/es/el-message-a86c0efa.cjs +0 -1
- package/es/el-message-box-40ff2af5.cjs +0 -1
- package/es/el-overlay-d7a6e4a9.cjs +0 -1
- package/es/el-popconfirm-737a015b.cjs +0 -1
- package/es/el-popper-7ba87e05.cjs +0 -1
- package/es/el-popper-fdc7c793.js +0 -2094
- package/es/el-segmented-3fd66a0e.cjs +0 -1
- package/es/el-select-12f6deb7.cjs +0 -1
- package/es/el-table-column-516a0ed9.cjs +0 -14
- package/es/el-tag-789f05d3.cjs +0 -1
- package/es/index-8de94a49.cjs +0 -1
- package/es/index-c04f444f.cjs +0 -1
- package/es/raf-8e05a7f4.js +0 -6
package/package.json
CHANGED
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import { ElMessage } from "element-plus";
|
|
4
|
+
import { ref, nextTick, watch } from "vue";
|
|
5
|
+
import { sendToBaiLianAppNonStreaming } from "../../public/aiTools";
|
|
6
|
+
import { UserFilled, Service, Promotion } from "@element-plus/icons-vue";
|
|
7
|
+
|
|
8
|
+
const emit = defineEmits(["callBack"]);
|
|
9
|
+
|
|
10
|
+
const visible = ref(false);
|
|
11
|
+
const isSending = ref(false);
|
|
12
|
+
const isThinking = ref(false);
|
|
13
|
+
|
|
14
|
+
const messageListRef = ref(null);
|
|
15
|
+
const messages = ref([
|
|
16
|
+
{
|
|
17
|
+
role: "assistant",
|
|
18
|
+
time: dayjs().format("HH:mm"),
|
|
19
|
+
content: "你好呀!我是你的品种池AI助手,会根据您的自然语言去进行品种的条件查询\n\n示例: \n帮我查找A股,总市值1000亿,流通股本大于等于1000万",
|
|
20
|
+
},
|
|
21
|
+
]);
|
|
22
|
+
const inputMessage = ref("");
|
|
23
|
+
|
|
24
|
+
// 发送消息
|
|
25
|
+
const sendMessage = async () => {
|
|
26
|
+
// 校验输入内容是否为空
|
|
27
|
+
const content = inputMessage.value.trim();
|
|
28
|
+
if (!content) return ElMessage.warning("请输入消息内容");
|
|
29
|
+
// 校验是否正在处理消息
|
|
30
|
+
if (isSending.value) return;
|
|
31
|
+
|
|
32
|
+
// 记录用户消息
|
|
33
|
+
messages.value.push({
|
|
34
|
+
role: "user",
|
|
35
|
+
time: dayjs().format("HH:mm"),
|
|
36
|
+
content: content,
|
|
37
|
+
});
|
|
38
|
+
inputMessage.value = "";
|
|
39
|
+
await scrollToBottom();
|
|
40
|
+
|
|
41
|
+
// 发送请求至百炼应用AI
|
|
42
|
+
isSending.value = true;
|
|
43
|
+
isThinking.value = true;
|
|
44
|
+
let apiRes = "{}";
|
|
45
|
+
try {
|
|
46
|
+
const appId = "9e54d112acfe4531bd1fc4fee8827fef";
|
|
47
|
+
const apiKey = "sk-d995eb26a4334bdeb2ccb4cbfaf51de8";
|
|
48
|
+
apiRes = await sendToBaiLianAppNonStreaming({ appId, apiKey, value: content });
|
|
49
|
+
messages.value.push({
|
|
50
|
+
role: "assistant",
|
|
51
|
+
time: dayjs().format("HH:mm"),
|
|
52
|
+
content: apiRes,
|
|
53
|
+
});
|
|
54
|
+
await scrollToBottom();
|
|
55
|
+
} catch (error) {
|
|
56
|
+
ElMessage.error(`AI响应异常: ${error}`);
|
|
57
|
+
console.error("AI响应异常:", error);
|
|
58
|
+
} finally {
|
|
59
|
+
isSending.value = false;
|
|
60
|
+
isThinking.value = false;
|
|
61
|
+
}
|
|
62
|
+
emit("callBack", JSON.parse(apiRes));
|
|
63
|
+
};
|
|
64
|
+
// 滚动到底部
|
|
65
|
+
const scrollToBottom = async () => {
|
|
66
|
+
await nextTick();
|
|
67
|
+
if (messageListRef.value) {
|
|
68
|
+
messageListRef.value.scrollTop = messageListRef.value.scrollHeight;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
watch(
|
|
72
|
+
() => messages.value,
|
|
73
|
+
() => {
|
|
74
|
+
scrollToBottom();
|
|
75
|
+
},
|
|
76
|
+
{ deep: true },
|
|
77
|
+
);
|
|
78
|
+
defineExpose({
|
|
79
|
+
open: (data) => {
|
|
80
|
+
visible.value = true;
|
|
81
|
+
// 自动滚动到底部
|
|
82
|
+
nextTick(() => {
|
|
83
|
+
scrollToBottom();
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
</script>
|
|
88
|
+
|
|
89
|
+
<template>
|
|
90
|
+
<el-dialog
|
|
91
|
+
class="ai-dialog"
|
|
92
|
+
v-model="visible"
|
|
93
|
+
title="✨ 品种池参数解析AI助手"
|
|
94
|
+
width="500px"
|
|
95
|
+
center
|
|
96
|
+
draggable
|
|
97
|
+
overflow
|
|
98
|
+
:modal="false"
|
|
99
|
+
:modal-penetrable="true"
|
|
100
|
+
>
|
|
101
|
+
<div class="chat-container">
|
|
102
|
+
<!-- 消息列表 -->
|
|
103
|
+
<div
|
|
104
|
+
ref="messageListRef"
|
|
105
|
+
class="message-list"
|
|
106
|
+
>
|
|
107
|
+
<div
|
|
108
|
+
v-for="(message, index) in messages"
|
|
109
|
+
:key="index"
|
|
110
|
+
class="message-item"
|
|
111
|
+
:class="message.role"
|
|
112
|
+
>
|
|
113
|
+
<div class="avatar">
|
|
114
|
+
<el-avatar
|
|
115
|
+
:size="32"
|
|
116
|
+
:icon="message.role === 'user' ? UserFilled : Service"
|
|
117
|
+
/>
|
|
118
|
+
</div>
|
|
119
|
+
<div class="message-content">
|
|
120
|
+
<div class="message-text">{{ message.content }}</div>
|
|
121
|
+
<div class="message-time">{{ message.time }}</div>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
<!-- AI 思考状态 -->
|
|
126
|
+
<div
|
|
127
|
+
v-if="isThinking"
|
|
128
|
+
class="message-item assistant"
|
|
129
|
+
>
|
|
130
|
+
<div class="avatar">
|
|
131
|
+
<el-avatar
|
|
132
|
+
:size="32"
|
|
133
|
+
:icon="Service"
|
|
134
|
+
/>
|
|
135
|
+
</div>
|
|
136
|
+
<div class="message-content">
|
|
137
|
+
<div class="typing-indicator">
|
|
138
|
+
<span></span>
|
|
139
|
+
<span></span>
|
|
140
|
+
<span></span>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
<!-- 输入区域 -->
|
|
146
|
+
<div class="input-area">
|
|
147
|
+
<el-input
|
|
148
|
+
class="message-input"
|
|
149
|
+
v-model="inputMessage"
|
|
150
|
+
type="textarea"
|
|
151
|
+
:rows="4"
|
|
152
|
+
:autosize="{ minRows: 2, maxRows: 4 }"
|
|
153
|
+
placeholder="输入您想查询的品种条件..."
|
|
154
|
+
@keydown.ctrl.enter="sendMessage"
|
|
155
|
+
/>
|
|
156
|
+
<div class="input-actions">
|
|
157
|
+
<div class="input-hint">
|
|
158
|
+
<span>Ctrl + Enter 发送</span>
|
|
159
|
+
</div>
|
|
160
|
+
<el-button
|
|
161
|
+
class="send-btn"
|
|
162
|
+
type="primary"
|
|
163
|
+
:icon="Promotion"
|
|
164
|
+
:loading="isSending"
|
|
165
|
+
@click="sendMessage"
|
|
166
|
+
round
|
|
167
|
+
>
|
|
168
|
+
发送
|
|
169
|
+
</el-button>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
</el-dialog>
|
|
174
|
+
</template>
|
|
175
|
+
|
|
176
|
+
<style lang="scss" scoped>
|
|
177
|
+
.ai-dialog {
|
|
178
|
+
:deep(.el-dialog) {
|
|
179
|
+
border-radius: 24px;
|
|
180
|
+
background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
|
|
181
|
+
box-shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.15);
|
|
182
|
+
overflow: hidden;
|
|
183
|
+
|
|
184
|
+
.el-dialog__header {
|
|
185
|
+
padding: 20px 24px 12px;
|
|
186
|
+
margin: 0;
|
|
187
|
+
border-bottom: 1px solid rgba(102, 126, 234, 0.1);
|
|
188
|
+
background: rgba(255, 255, 255, 0.8);
|
|
189
|
+
backdrop-filter: blur(10px);
|
|
190
|
+
|
|
191
|
+
.el-dialog__title {
|
|
192
|
+
font-size: 18px;
|
|
193
|
+
font-weight: 600;
|
|
194
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
195
|
+
background-clip: text;
|
|
196
|
+
-webkit-background-clip: text;
|
|
197
|
+
-webkit-text-fill-color: transparent;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.el-dialog__body {
|
|
202
|
+
padding: 0;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.el-dialog__footer {
|
|
206
|
+
display: none;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
.chat-container {
|
|
211
|
+
display: flex;
|
|
212
|
+
flex-direction: column;
|
|
213
|
+
height: 380px;
|
|
214
|
+
background: transparent;
|
|
215
|
+
}
|
|
216
|
+
.message-list {
|
|
217
|
+
flex: 1;
|
|
218
|
+
overflow-y: auto;
|
|
219
|
+
padding: 20px 24px;
|
|
220
|
+
scroll-behavior: smooth;
|
|
221
|
+
|
|
222
|
+
&::-webkit-scrollbar {
|
|
223
|
+
width: 6px;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
&::-webkit-scrollbar-track {
|
|
227
|
+
background: rgba(0, 0, 0, 0.05);
|
|
228
|
+
border-radius: 3px;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
&::-webkit-scrollbar-thumb {
|
|
232
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
233
|
+
border-radius: 3px;
|
|
234
|
+
|
|
235
|
+
&:hover {
|
|
236
|
+
background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
.message-item {
|
|
241
|
+
display: flex;
|
|
242
|
+
margin-bottom: 20px;
|
|
243
|
+
animation: fadeInUp 0.3s ease-out;
|
|
244
|
+
|
|
245
|
+
&.user {
|
|
246
|
+
flex-direction: row-reverse;
|
|
247
|
+
|
|
248
|
+
.avatar {
|
|
249
|
+
margin-left: 12px;
|
|
250
|
+
margin-right: 0;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.message-content {
|
|
254
|
+
align-items: flex-end;
|
|
255
|
+
|
|
256
|
+
.message-text {
|
|
257
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
258
|
+
color: white;
|
|
259
|
+
border-radius: 18px 18px 4px 18px;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.message-time {
|
|
263
|
+
text-align: right;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
&.assistant {
|
|
269
|
+
.avatar {
|
|
270
|
+
margin-right: 12px;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.message-content {
|
|
274
|
+
align-items: flex-start;
|
|
275
|
+
|
|
276
|
+
.message-text {
|
|
277
|
+
background: white;
|
|
278
|
+
color: #2c3e50;
|
|
279
|
+
border-radius: 18px 18px 18px 4px;
|
|
280
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
|
281
|
+
border: 1px solid rgba(102, 126, 234, 0.1);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.avatar {
|
|
287
|
+
flex-shrink: 0;
|
|
288
|
+
|
|
289
|
+
:deep(.el-avatar) {
|
|
290
|
+
background: linear-gradient(135deg, #f0f2ff 0%, #e8ecff 100%);
|
|
291
|
+
color: #667eea;
|
|
292
|
+
|
|
293
|
+
svg {
|
|
294
|
+
width: 18px;
|
|
295
|
+
height: 18px;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.message-content {
|
|
301
|
+
display: flex;
|
|
302
|
+
flex-direction: column;
|
|
303
|
+
max-width: 70%;
|
|
304
|
+
|
|
305
|
+
.message-text {
|
|
306
|
+
padding: 10px 16px;
|
|
307
|
+
font-size: 14px;
|
|
308
|
+
line-height: 1.5;
|
|
309
|
+
word-wrap: break-word;
|
|
310
|
+
white-space: pre-wrap;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.message-time {
|
|
314
|
+
font-size: 11px;
|
|
315
|
+
color: #9ca3af;
|
|
316
|
+
margin-top: 6px;
|
|
317
|
+
padding: 0 4px;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
.typing-indicator {
|
|
322
|
+
display: flex;
|
|
323
|
+
gap: 4px;
|
|
324
|
+
padding: 10px 16px;
|
|
325
|
+
background: white;
|
|
326
|
+
border-radius: 18px;
|
|
327
|
+
border: 1px solid rgba(102, 126, 234, 0.1);
|
|
328
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
|
329
|
+
|
|
330
|
+
span {
|
|
331
|
+
width: 6px;
|
|
332
|
+
height: 6px;
|
|
333
|
+
border-radius: 50%;
|
|
334
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
335
|
+
animation: typing 1.4s infinite ease-in-out;
|
|
336
|
+
|
|
337
|
+
&:nth-child(1) {
|
|
338
|
+
animation-delay: -0.32s;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
&:nth-child(2) {
|
|
342
|
+
animation-delay: -0.16s;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
.input-area {
|
|
347
|
+
padding: 16px 24px 24px;
|
|
348
|
+
border-top: 1px solid rgba(102, 126, 234, 0.1);
|
|
349
|
+
background: rgba(255, 255, 255, 0.9);
|
|
350
|
+
backdrop-filter: blur(10px);
|
|
351
|
+
|
|
352
|
+
.message-input {
|
|
353
|
+
:deep(.el-textarea__inner) {
|
|
354
|
+
border-radius: 16px;
|
|
355
|
+
border: 1px solid rgba(102, 126, 234, 0.2);
|
|
356
|
+
background: #ffffff;
|
|
357
|
+
font-size: 14px;
|
|
358
|
+
padding: 12px 16px;
|
|
359
|
+
transition: all 0.3s ease;
|
|
360
|
+
|
|
361
|
+
&:focus {
|
|
362
|
+
border-color: #667eea;
|
|
363
|
+
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
&::placeholder {
|
|
367
|
+
color: #cbd5e0;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.input-actions {
|
|
373
|
+
display: flex;
|
|
374
|
+
justify-content: space-between;
|
|
375
|
+
align-items: center;
|
|
376
|
+
margin-top: 12px;
|
|
377
|
+
|
|
378
|
+
.input-hint {
|
|
379
|
+
font-size: 12px;
|
|
380
|
+
color: #9ca3af;
|
|
381
|
+
|
|
382
|
+
span {
|
|
383
|
+
background: rgba(102, 126, 234, 0.1);
|
|
384
|
+
padding: 4px 8px;
|
|
385
|
+
border-radius: 12px;
|
|
386
|
+
font-size: 11px;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.send-btn {
|
|
391
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
392
|
+
border: none;
|
|
393
|
+
padding: 8px 20px;
|
|
394
|
+
font-weight: 500;
|
|
395
|
+
transition: all 0.3s ease;
|
|
396
|
+
|
|
397
|
+
&:hover {
|
|
398
|
+
transform: translateY(-2px);
|
|
399
|
+
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
&:active {
|
|
403
|
+
transform: translateY(0);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
@keyframes fadeInUp {
|
|
409
|
+
from {
|
|
410
|
+
opacity: 0;
|
|
411
|
+
transform: translateY(10px);
|
|
412
|
+
}
|
|
413
|
+
to {
|
|
414
|
+
opacity: 1;
|
|
415
|
+
transform: translateY(0);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
@keyframes typing {
|
|
419
|
+
0%,
|
|
420
|
+
60%,
|
|
421
|
+
100% {
|
|
422
|
+
transform: translateY(0);
|
|
423
|
+
opacity: 0.4;
|
|
424
|
+
}
|
|
425
|
+
30% {
|
|
426
|
+
transform: translateY(-8px);
|
|
427
|
+
opacity: 1;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
</style>
|
package/packages/index.ts
CHANGED
|
@@ -19,6 +19,7 @@ import StPie from "./Pie/index.ts"
|
|
|
19
19
|
import StTable from "./Table/index.ts"
|
|
20
20
|
import StTreeMap from "./TreeMap/index.ts"
|
|
21
21
|
import StUser from "./User/index.ts"
|
|
22
|
+
import StVarietyAiHelper from "./VarietyAiHelper/index.ts"
|
|
22
23
|
import StVarietyAutoComplete from "./VarietyAutoComplete/index.ts"
|
|
23
24
|
import StVarietySearch from "./VarietySearch/index.ts"
|
|
24
25
|
import StVarietyTextCopy from "./VarietyTextCopy/index.ts"
|
|
@@ -47,6 +48,7 @@ export default {
|
|
|
47
48
|
StTable.install(app)
|
|
48
49
|
StTreeMap.install(app)
|
|
49
50
|
StUser.install(app)
|
|
51
|
+
StVarietyAiHelper.install(app)
|
|
50
52
|
StVarietyAutoComplete.install(app)
|
|
51
53
|
StVarietySearch.install(app)
|
|
52
54
|
StVarietyTextCopy.install(app)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 发送非流式请求到百炼 AI 应用
|
|
3
|
+
* @param {Object} options
|
|
4
|
+
* @param {string} options.appId - 应用ID
|
|
5
|
+
* @param {string} options.apiKey - API Key
|
|
6
|
+
* @param {string} options.value - 用户输入
|
|
7
|
+
* @returns {Promise<string>} 返回 AI 输出的完整文本(JSON 字符串)
|
|
8
|
+
*/
|
|
9
|
+
export const sendToBaiLianAppNonStreaming = async ({ appId, apiKey, value }) => {
|
|
10
|
+
try {
|
|
11
|
+
const response = await fetch(`https://dashscope.aliyuncs.com/api/v1/apps/${appId}/completion`, {
|
|
12
|
+
method: "POST",
|
|
13
|
+
headers: {
|
|
14
|
+
Authorization: `Bearer ${apiKey}`,
|
|
15
|
+
"Content-Type": "application/json",
|
|
16
|
+
},
|
|
17
|
+
body: JSON.stringify({
|
|
18
|
+
input: { prompt: value },
|
|
19
|
+
parameters: {
|
|
20
|
+
incremental_output: false, // 非流式
|
|
21
|
+
},
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
26
|
+
}
|
|
27
|
+
const data = await response.json();
|
|
28
|
+
const outputText = data?.output?.text;
|
|
29
|
+
return outputText;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
if (error.name === "AbortError") {
|
|
32
|
+
throw new Error("请求超时");
|
|
33
|
+
}
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
};
|
package/src/App.vue
CHANGED
|
@@ -38,28 +38,38 @@ import routes from "./router/routes.ts";
|
|
|
38
38
|
|
|
39
39
|
const route = useRoute();
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* @description: 项目使用实例
|
|
43
|
+
*/
|
|
41
44
|
// const VITE_RUN_ENV = import.meta.env; // 正常使用
|
|
42
|
-
// const VITE_RUN_ENV = {
|
|
43
|
-
// VITE_PROJECT_NAME: "动量回测",
|
|
44
|
-
// VITE_PROJECT_CLIENTID: "7",
|
|
45
|
-
// VITE_BASE_URL: "http://192.168.12.38:5173",
|
|
46
|
-
// BASE_URL: "/",
|
|
47
|
-
// MODE: "test49",
|
|
48
|
-
// DEV: true,
|
|
49
|
-
// PROD: false,
|
|
50
|
-
// SSR: false,
|
|
51
|
-
// };
|
|
52
45
|
|
|
46
|
+
/**
|
|
47
|
+
* @description: 组件库Demo测试
|
|
48
|
+
*/
|
|
53
49
|
const VITE_RUN_ENV = {
|
|
54
50
|
VITE_PROJECT_NAME: "动量回测",
|
|
55
51
|
VITE_PROJECT_CLIENTID: "7",
|
|
56
|
-
VITE_BASE_URL: "
|
|
52
|
+
VITE_BASE_URL: "http://192.168.12.38:5173",
|
|
57
53
|
BASE_URL: "/",
|
|
58
|
-
MODE: "
|
|
59
|
-
DEV:
|
|
60
|
-
PROD:
|
|
54
|
+
MODE: "test49",
|
|
55
|
+
DEV: true,
|
|
56
|
+
PROD: false,
|
|
61
57
|
SSR: false,
|
|
62
58
|
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @description: 组件库Demo线上
|
|
62
|
+
*/
|
|
63
|
+
// const VITE_RUN_ENV = {
|
|
64
|
+
// VITE_PROJECT_NAME: "动量回测",
|
|
65
|
+
// VITE_PROJECT_CLIENTID: "7",
|
|
66
|
+
// VITE_BASE_URL: "//investapi.hzyotoy.com",
|
|
67
|
+
// BASE_URL: "/",
|
|
68
|
+
// MODE: "production",
|
|
69
|
+
// DEV: false,
|
|
70
|
+
// PROD: true,
|
|
71
|
+
// SSR: false,
|
|
72
|
+
// };
|
|
63
73
|
</script>
|
|
64
74
|
|
|
65
75
|
<style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
|
|
4
|
+
const VarietyAiHelperRef = ref(null);
|
|
5
|
+
|
|
6
|
+
const handleClick = () => {
|
|
7
|
+
VarietyAiHelperRef.value.open();
|
|
8
|
+
};
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<div>
|
|
13
|
+
<el-button
|
|
14
|
+
type="primary"
|
|
15
|
+
@click="handleClick"
|
|
16
|
+
>AI查询助手</el-button
|
|
17
|
+
>
|
|
18
|
+
<st-varietyAiHelper ref="VarietyAiHelperRef" />
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|