sooyie-pgss 0.0.7 → 0.0.8

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.
Files changed (78) hide show
  1. package/dist/apiCall-BhS14qUE.mjs +194 -0
  2. package/dist/{edit-BWwsW4lY.mjs → edit-DC2jf7oH.mjs} +1 -1
  3. package/dist/{edit-CONEPS6o.mjs → edit-DPZ2KRCd.mjs} +1 -1
  4. package/dist/history-xRxkIYRN.mjs +186 -0
  5. package/dist/{index-BjyqkRSF.mjs → index-BP4jibk6.mjs} +1 -1
  6. package/dist/{index-BzcWIZeM.mjs → index-BhzzZN5S.mjs} +1 -1
  7. package/dist/{index-gj9-Uezz.mjs → index-C0DLTypb.mjs} +2 -2
  8. package/dist/{index-CkVsz6yH.mjs → index-DMVIfzsH.mjs} +86 -26
  9. package/dist/{index-CLmQf2ec.mjs → index-DRytYmLN.mjs} +1 -1
  10. package/dist/index-Dew2HmWi.mjs +401 -0
  11. package/dist/index.mjs +239 -197
  12. package/dist/{info-Cf-H4Nq1.mjs → info-CkB6TQua.mjs} +1 -1
  13. package/dist/new-conversation-BJrE2piC.mjs +181 -0
  14. package/dist/rename-x4dBXv7B.mjs +4 -0
  15. package/dist/rename.vue_vue_type_script_setup_true_lang-CAXpy7Ny.mjs +165 -0
  16. package/dist/style.css +1 -1
  17. package/dts/src/App.vue.js +39 -0
  18. package/dts/src/api/pgss/dict.js +44 -0
  19. package/dts/src/api/pgss/index.js +46 -0
  20. package/dts/src/api/pgss/pgss-app-info/index.js +129 -0
  21. package/dts/src/api/pgss/pgss-app-info/types.js +1 -0
  22. package/dts/src/api/pgss/pgss-chat/index.d.ts +6 -1
  23. package/dts/src/api/pgss/pgss-chat/index.js +68 -0
  24. package/dts/src/api/pgss/pgss-chat/types.d.ts +54 -0
  25. package/dts/src/api/pgss/pgss-chat/types.js +1 -0
  26. package/dts/src/api/pgss/pgss-message-log/index.js +87 -0
  27. package/dts/src/api/pgss/pgss-message-log/types.js +1 -0
  28. package/dts/src/api/pgss/pgss-portrait-weight/index.js +148 -0
  29. package/dts/src/api/pgss/pgss-portrait-weight/types.js +1 -0
  30. package/dts/src/api/pgss/pgss-prompt-template/index.js +100 -0
  31. package/dts/src/api/pgss/pgss-prompt-template/types.js +1 -0
  32. package/dts/src/api/pgss/pgss-user-portrait/index.js +126 -0
  33. package/dts/src/api/pgss/pgss-user-portrait/types.js +1 -0
  34. package/dts/src/components/DateRangePicker/DateRangePicker.vue.js +168 -0
  35. package/dts/src/constant.js +45 -0
  36. package/dts/src/index.js +21 -0
  37. package/dts/src/lang/index.js +13 -0
  38. package/dts/src/lang/pgss/en.d.ts +21 -0
  39. package/dts/src/lang/pgss/en.js +134 -0
  40. package/dts/src/lang/pgss/zh-cn.d.ts +21 -0
  41. package/dts/src/lang/pgss/zh-cn.js +187 -0
  42. package/dts/src/main.js +35 -0
  43. package/dts/src/permission.js +88 -0
  44. package/dts/src/router/index.js +97 -0
  45. package/dts/src/utils/copy.js +46 -0
  46. package/dts/src/utils/dateFormat.js +15 -0
  47. package/dts/src/utils/duration.js +24 -0
  48. package/dts/src/utils/timePlugin.js +12 -0
  49. package/dts/src/views/pgss/pgss-app-info/app-info.vue.js +885 -0
  50. package/dts/src/views/pgss/pgss-app-info/edit.vue.js +690 -0
  51. package/dts/src/views/pgss/pgss-app-info/index.vue.js +137 -0
  52. package/dts/src/views/pgss/pgss-app-info/info.vue.js +395 -0
  53. package/dts/src/views/pgss/pgss-app-info/resetPwd.vue.js +275 -0
  54. package/dts/src/views/pgss/pgss-chat/history.vue.d.ts +25 -0
  55. package/dts/src/views/pgss/pgss-chat/history.vue.js +403 -0
  56. package/dts/src/views/pgss/pgss-chat/index.vue.js +829 -0
  57. package/dts/src/views/pgss/pgss-chat/new-conversation.vue.d.ts +17 -0
  58. package/dts/src/views/pgss/pgss-chat/new-conversation.vue.js +327 -0
  59. package/dts/src/views/pgss/pgss-chat/rename.vue.d.ts +35 -0
  60. package/dts/src/views/pgss/pgss-chat/rename.vue.js +250 -0
  61. package/dts/src/views/pgss/pgss-homepage/apiCall.vue.js +258 -0
  62. package/dts/src/views/pgss/pgss-homepage/image.vue.js +155 -0
  63. package/dts/src/views/pgss/pgss-homepage/index.vue.js +214 -0
  64. package/dts/src/views/pgss/pgss-login/index.vue.js +369 -0
  65. package/dts/src/views/pgss/pgss-message-log/index.vue.js +607 -0
  66. package/dts/src/views/pgss/pgss-message-log/info.vue.js +226 -0
  67. package/dts/src/views/pgss/pgss-portrait-weight/index.vue.js +526 -0
  68. package/dts/src/views/pgss/pgss-prompt-template/edit.vue.js +844 -0
  69. package/dts/src/views/pgss/pgss-prompt-template/index.vue.js +595 -0
  70. package/dts/src/views/pgss/pgss-prompt-template-custom/edit.vue.js +851 -0
  71. package/dts/src/views/pgss/pgss-prompt-template-custom/index.vue.js +662 -0
  72. package/dts/src/views/pgss/pgss-user-portrait/index.vue.js +1034 -0
  73. package/dts/src/views/pgss/pgss-user-portrait/info.vue.js +484 -0
  74. package/dts/src/views/pgss/pgss-user-portrait/simulateNum.vue.d.ts +1 -1
  75. package/dts/src/views/pgss/pgss-user-portrait/simulateNum.vue.js +201 -0
  76. package/package.json +1 -1
  77. package/dist/apiCall-B-uq340z.mjs +0 -224
  78. package/dist/index-x65eowQY.mjs +0 -266
@@ -0,0 +1,401 @@
1
+ import { defineComponent as ce, ref as i, resolveComponent as $, resolveDirective as de, openBlock as r, createElementBlock as u, withDirectives as q, createVNode as g, vShow as j, createElementVNode as l, withCtx as k, createBlock as B, createTextVNode as G, toDisplayString as p, createCommentVNode as pe, Fragment as A, renderList as H, normalizeClass as ve, nextTick as he } from "vue";
2
+ import { ElMessage as O } from "element-plus";
3
+ import { useI18n as fe } from "vue-i18n";
4
+ import { a as J } from "./index-MA9jC8ZF.mjs";
5
+ import { u as Q } from "./index-CeyTmMNJ.mjs";
6
+ import { c as S } from "./rename.vue_vue_type_script_setup_true_lang-CAXpy7Ny.mjs";
7
+ import ge from "./history-xRxkIYRN.mjs";
8
+ import _e from "./new-conversation-BJrE2piC.mjs";
9
+ import { _ as me } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
10
+ const ye = { class: "chat-container" }, Ie = { class: "chat-main" }, ke = { class: "chat-header" }, be = {
11
+ key: 0,
12
+ class: "chat-empty"
13
+ }, we = { class: "chat-empty__title" }, Ce = { class: "chat-empty__desc" }, $e = {
14
+ key: 1,
15
+ class: "message-list"
16
+ }, Ve = { class: "message__avatar" }, Ue = { class: "message__content" }, Ne = {
17
+ key: 0,
18
+ class: "message__bubble"
19
+ }, Le = {
20
+ key: 1,
21
+ class: "message__prompt"
22
+ }, Ae = ["onClick"], Oe = { class: "message__prompt-label" }, Se = { class: "message__prompt-toggle" }, Te = {
23
+ key: 1,
24
+ class: "message__bubble"
25
+ }, De = {
26
+ key: 0,
27
+ class: "message__pending"
28
+ }, Re = {
29
+ key: 1,
30
+ class: "message__answer"
31
+ }, qe = { class: "chat-input" }, Be = { class: "chat-input__box" }, He = { class: "chat-input__toolbar" }, Me = { class: "chat-input__selectors" }, Pe = /* @__PURE__ */ ce({
32
+ __name: "index",
33
+ setup(Ee) {
34
+ const { t: y } = fe(), V = i(!1), M = i(), v = i(), b = i(!1), U = i(!1), T = i(!1), c = i([]), I = i(""), w = i(!1), P = i();
35
+ let N = 0;
36
+ const _ = i(), h = i([]), D = i(!1), m = i(), f = i([]), L = i(!1);
37
+ let E = !1;
38
+ function W() {
39
+ return `${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
40
+ }
41
+ async function R() {
42
+ await he();
43
+ const e = P.value;
44
+ e && (e.scrollTop = e.scrollHeight);
45
+ }
46
+ function X(e) {
47
+ e.thinkingOpen = !e.thinkingOpen;
48
+ }
49
+ function x(e) {
50
+ D.value = !0;
51
+ const t = {
52
+ curPage: 1,
53
+ pageSize: 100,
54
+ likeIdentityName: e || void 0
55
+ };
56
+ Q.findPage(t).then(({ data: n }) => {
57
+ h.value = (n.results ?? []).filter((a) => !!a.thirdUserId).map((a) => ({
58
+ value: a.thirdUserId,
59
+ label: a.identityName ? `${a.identityName}(${a.thirdUserId})` : a.thirdUserId
60
+ }));
61
+ }).catch((n) => {
62
+ console.error("[pgss-chat] 用户列表加载失败:", n), h.value = [];
63
+ }).finally(() => {
64
+ D.value = !1;
65
+ });
66
+ }
67
+ function Y() {
68
+ E || L.value || (L.value = !0, J.findList().then(({ data: e }) => {
69
+ f.value = e.results ?? [], E = !0;
70
+ }).catch((e) => {
71
+ console.error("[pgss-chat] 应用列表加载失败:", e), f.value = [];
72
+ }).finally(() => {
73
+ L.value = !1;
74
+ }));
75
+ }
76
+ function Z(e) {
77
+ e && !h.value.length && x("");
78
+ }
79
+ function ee(e) {
80
+ e && Y();
81
+ }
82
+ function te(e) {
83
+ v.value = e.conversationId, b.value = !0, oe(e.conversationId), S.getUserAppInfo({ conversationId: e.conversationId }).then(({ data: t }) => {
84
+ z(
85
+ (t == null ? void 0 : t.thirdUserId) || e.thirdUserId,
86
+ (t == null ? void 0 : t.appId) || e.appId
87
+ );
88
+ }).catch((t) => {
89
+ console.error("[pgss-chat] 对话用户/应用信息加载失败:", t), z(e.thirdUserId, e.appId);
90
+ });
91
+ }
92
+ function z(e, t) {
93
+ e && (_.value = e, se(e)), t && (m.value = t, ne(t));
94
+ }
95
+ function se(e) {
96
+ h.value.some((t) => t.value === e) || Q.findList({ thirdUserId: e }).then(({ data: t }) => {
97
+ const n = ((t == null ? void 0 : t.results) ?? []).find(
98
+ (d) => d.thirdUserId === e
99
+ ), a = n != null && n.identityName ? `${n.identityName}(${e})` : e;
100
+ h.value.some((d) => d.value === e) || (h.value = [{ value: e, label: a }, ...h.value]);
101
+ }).catch((t) => {
102
+ console.error("[pgss-chat] 历史对话用户信息加载失败:", t);
103
+ });
104
+ }
105
+ function ne(e) {
106
+ f.value.some((t) => t.appId === e) || J.findById({ appId: e }).then(({ data: t }) => {
107
+ t && !f.value.some((n) => n.appId === e) && (f.value = [t, ...f.value]);
108
+ }).catch((t) => {
109
+ console.error("[pgss-chat] 历史对话应用信息加载失败:", t);
110
+ });
111
+ }
112
+ function le(e) {
113
+ e.conversationId === v.value && K();
114
+ }
115
+ function ae(e) {
116
+ _.value = e.thirdUserId, m.value = e.appId, h.value = [
117
+ { value: e.thirdUserId, label: e.userLabel }
118
+ ], f.value = [
119
+ { appId: e.appId, appName: e.appLabel }
120
+ ], b.value = !0, U.value = !1, c.value = [], v.value = void 0, I.value = "";
121
+ }
122
+ function oe(e) {
123
+ e && (T.value = !0, S.getHistoryMessages({ conversationId: e }).then(({ data: t }) => {
124
+ const n = (t == null ? void 0 : t.results) ?? [], a = [];
125
+ n.forEach((d, o) => {
126
+ d.query && a.push({
127
+ id: `history-user-${o}`,
128
+ role: "user",
129
+ content: d.query
130
+ }), a.push({
131
+ id: `history-ai-${o}`,
132
+ role: "ai",
133
+ content: d.answer ?? ""
134
+ });
135
+ }), c.value = a, R();
136
+ }).catch((t) => {
137
+ console.error("[pgss-chat] 历史消息加载失败:", t), c.value = [], O.error(y("chat.historyLoadFail"));
138
+ }).finally(() => {
139
+ T.value = !1;
140
+ }));
141
+ }
142
+ function re(e) {
143
+ e.key !== "Enter" || e.shiftKey || e.isComposing || (e.preventDefault(), F());
144
+ }
145
+ async function F() {
146
+ var d;
147
+ const e = I.value.trim();
148
+ if (!e || w.value)
149
+ return;
150
+ if (!_.value) {
151
+ O.warning(y("chat.userRequired"));
152
+ return;
153
+ }
154
+ if (!m.value) {
155
+ O.warning(y("chat.appTypeRequired"));
156
+ return;
157
+ }
158
+ N += 1, c.value.push({
159
+ id: `user-${N}`,
160
+ role: "user",
161
+ content: e
162
+ }), N += 1, c.value.push({
163
+ id: `ai-${N}`,
164
+ role: "ai",
165
+ content: "",
166
+ pending: !0
167
+ });
168
+ const t = c.value[c.value.length - 2], n = c.value[c.value.length - 1];
169
+ I.value = "", w.value = !0, R();
170
+ const a = {
171
+ requestId: W(),
172
+ appId: m.value,
173
+ thirdUserId: _.value,
174
+ content: e,
175
+ // 基于历史对话继续提问时带上 conversationId,首次对话不传
176
+ ...v.value ? { conversationId: v.value } : {}
177
+ };
178
+ try {
179
+ const { data: o } = await S.chat(a);
180
+ if (n.pending = !1, (o == null ? void 0 : o.success) === !1) {
181
+ n.content = y("chat.failAnswer"), O.error(y("chat.sendFail"));
182
+ return;
183
+ }
184
+ t.thinking = (o == null ? void 0 : o.promptOutput) ?? "", t.thinkingOpen = !0, n.content = (o == null ? void 0 : o.contentAnswer) ?? "";
185
+ const C = o == null ? void 0 : o.conversationId;
186
+ C ? v.value = C : v.value || await ie();
187
+ } catch (o) {
188
+ console.error("[pgss-chat] 发送对话消息失败:", o), n.pending = !1, n.content = y("chat.failAnswer");
189
+ } finally {
190
+ w.value = !1, R(), (d = M.value) == null || d.refresh();
191
+ }
192
+ }
193
+ async function ie() {
194
+ try {
195
+ const { data: e } = await S.getHistoryList({}), t = ((e == null ? void 0 : e.results) ?? []).filter(
196
+ (n) => !!n.conversationId && n.thirdUserId === _.value && n.appId === m.value
197
+ ).sort(
198
+ (n, a) => (a.updateTime ?? a.createTime ?? "").localeCompare(
199
+ n.updateTime ?? n.createTime ?? ""
200
+ )
201
+ )[0];
202
+ t != null && t.conversationId && (v.value = t.conversationId);
203
+ } catch (e) {
204
+ console.error("[pgss-chat] 回查新建对话ID失败:", e);
205
+ }
206
+ }
207
+ function K() {
208
+ c.value = [], v.value = void 0, b.value = !1;
209
+ }
210
+ return (e, t) => {
211
+ const n = $("el-button"), a = $("el-tooltip"), d = $("el-input"), o = $("el-option"), C = $("el-select"), ue = de("loading");
212
+ return r(), u("div", ye, [
213
+ q(g(ge, {
214
+ ref_key: "historyRef",
215
+ ref: M,
216
+ "conversation-id": v.value,
217
+ onSelect: te,
218
+ onDelete: le,
219
+ onNew: t[0] || (t[0] = (s) => U.value = !0)
220
+ }, null, 8, ["conversation-id"]), [
221
+ [j, !V.value]
222
+ ]),
223
+ g(_e, {
224
+ modelValue: U.value,
225
+ "onUpdate:modelValue": t[1] || (t[1] = (s) => U.value = s),
226
+ onConfirm: ae
227
+ }, null, 8, ["modelValue"]),
228
+ l("div", Ie, [
229
+ l("div", ke, [
230
+ g(a, {
231
+ content: V.value ? e.$t("chat.expandSidebar") : e.$t("chat.collapseSidebar"),
232
+ placement: "bottom"
233
+ }, {
234
+ default: k(() => [
235
+ g(n, {
236
+ text: "",
237
+ class: "chat-header__toggle",
238
+ onClick: t[2] || (t[2] = (s) => V.value = !V.value)
239
+ }, {
240
+ default: k(() => [...t[6] || (t[6] = [
241
+ l("svg", {
242
+ viewBox: "0 0 24 24",
243
+ width: "18",
244
+ height: "18",
245
+ "aria-hidden": "true"
246
+ }, [
247
+ l("rect", {
248
+ x: "3",
249
+ y: "4.5",
250
+ width: "18",
251
+ height: "15",
252
+ rx: "4",
253
+ fill: "none",
254
+ stroke: "currentColor",
255
+ "stroke-width": "1.8"
256
+ }),
257
+ l("path", {
258
+ d: "M9.6 5.4 V18.6",
259
+ stroke: "currentColor",
260
+ "stroke-width": "1.8",
261
+ "stroke-linecap": "round"
262
+ })
263
+ ], -1)
264
+ ])]),
265
+ _: 1
266
+ })
267
+ ]),
268
+ _: 1
269
+ }, 8, ["content"]),
270
+ c.value.length ? (r(), B(n, {
271
+ key: 0,
272
+ text: "",
273
+ class: "chat-header__action",
274
+ onClick: K
275
+ }, {
276
+ default: k(() => [
277
+ G(p(e.$t("chat.clear")), 1)
278
+ ]),
279
+ _: 1
280
+ })) : pe("", !0)
281
+ ]),
282
+ q((r(), u("div", {
283
+ ref_key: "messageBodyRef",
284
+ ref: P,
285
+ class: "chat-body"
286
+ }, [
287
+ c.value.length ? (r(), u("div", $e, [
288
+ (r(!0), u(A, null, H(c.value, (s) => (r(), u("div", {
289
+ key: s.id,
290
+ class: ve(["message", s.role === "user" ? "message--user" : "message--ai"])
291
+ }, [
292
+ l("div", Ve, p(s.role === "user" ? e.$t("chat.meAvatar") : "AI"), 1),
293
+ l("div", Ue, [
294
+ s.role === "user" ? (r(), u(A, { key: 0 }, [
295
+ s.thinking ? (r(), u("div", Le, [
296
+ l("div", {
297
+ class: "message__prompt-head",
298
+ onClick: (xe) => X(s)
299
+ }, [
300
+ l("span", Oe, p(e.$t("chat.enhancedPrompt")), 1),
301
+ l("span", Se, p(s.thinkingOpen ? e.$t("chat.collapse") : e.$t("chat.expand")), 1)
302
+ ], 8, Ae),
303
+ q(l("div", { class: "message__prompt-body" }, p(s.thinking), 513), [
304
+ [j, s.thinkingOpen]
305
+ ])
306
+ ])) : (r(), u("div", Ne, p(s.content), 1))
307
+ ], 64)) : (r(), u("div", Te, [
308
+ s.pending ? (r(), u("div", De, [
309
+ t[8] || (t[8] = l("span", { class: "message__pending-dot" }, null, -1)),
310
+ t[9] || (t[9] = l("span", { class: "message__pending-dot" }, null, -1)),
311
+ t[10] || (t[10] = l("span", { class: "message__pending-dot" }, null, -1)),
312
+ l("span", null, p(e.$t("chat.generating")), 1)
313
+ ])) : (r(), u("div", Re, p(s.content), 1))
314
+ ]))
315
+ ])
316
+ ], 2))), 128))
317
+ ])) : (r(), u("div", be, [
318
+ t[7] || (t[7] = l("div", { class: "chat-empty__logo" }, "AI", -1)),
319
+ l("p", we, p(e.$t("chat.welcomeTitle")), 1),
320
+ l("p", Ce, p(e.$t("chat.welcomeDesc")), 1)
321
+ ]))
322
+ ])), [
323
+ [ue, T.value]
324
+ ]),
325
+ l("div", qe, [
326
+ l("div", Be, [
327
+ g(d, {
328
+ modelValue: I.value,
329
+ "onUpdate:modelValue": t[3] || (t[3] = (s) => I.value = s),
330
+ type: "textarea",
331
+ autosize: { minRows: 2, maxRows: 6 },
332
+ resize: "none",
333
+ class: "chat-input__textarea",
334
+ placeholder: e.$t("chat.inputPlaceholder"),
335
+ onKeydown: re
336
+ }, null, 8, ["modelValue", "placeholder"]),
337
+ l("div", He, [
338
+ l("div", Me, [
339
+ g(C, {
340
+ modelValue: _.value,
341
+ "onUpdate:modelValue": t[4] || (t[4] = (s) => _.value = s),
342
+ filterable: "",
343
+ remote: "",
344
+ "reserve-keyword": "",
345
+ disabled: b.value,
346
+ "remote-method": x,
347
+ loading: D.value,
348
+ placeholder: e.$t("chat.userPlaceholder"),
349
+ class: "chat-input__select",
350
+ onVisibleChange: Z
351
+ }, {
352
+ default: k(() => [
353
+ (r(!0), u(A, null, H(h.value, (s) => (r(), B(o, {
354
+ key: s.value,
355
+ label: s.label,
356
+ value: s.value
357
+ }, null, 8, ["label", "value"]))), 128))
358
+ ]),
359
+ _: 1
360
+ }, 8, ["modelValue", "disabled", "loading", "placeholder"]),
361
+ g(C, {
362
+ modelValue: m.value,
363
+ "onUpdate:modelValue": t[5] || (t[5] = (s) => m.value = s),
364
+ disabled: b.value,
365
+ loading: L.value,
366
+ placeholder: e.$t("chat.appTypePlaceholder"),
367
+ class: "chat-input__select",
368
+ onVisibleChange: ee
369
+ }, {
370
+ default: k(() => [
371
+ (r(!0), u(A, null, H(f.value, (s) => (r(), B(o, {
372
+ key: s.appId,
373
+ label: s.appName,
374
+ value: s.appId
375
+ }, null, 8, ["label", "value"]))), 128))
376
+ ]),
377
+ _: 1
378
+ }, 8, ["modelValue", "disabled", "loading", "placeholder"])
379
+ ]),
380
+ g(n, {
381
+ class: "chat-input__send",
382
+ loading: w.value,
383
+ disabled: !I.value.trim() || w.value,
384
+ onClick: F
385
+ }, {
386
+ default: k(() => [
387
+ G(p(e.$t("chat.send")), 1)
388
+ ]),
389
+ _: 1
390
+ }, 8, ["loading", "disabled"])
391
+ ])
392
+ ])
393
+ ])
394
+ ])
395
+ ]);
396
+ };
397
+ }
398
+ }), Ye = /* @__PURE__ */ me(Pe, [["__scopeId", "data-v-ecde798f"]]);
399
+ export {
400
+ Ye as default
401
+ };