@seer-ai/seer-vue 0.1.0-beta.13 → 0.1.0-beta.14
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/dist/client.d.ts +15 -1
- package/dist/components/SeerMissingForm.vue.d.ts +13 -0
- package/dist/components/SeerOrderCard.vue.d.ts +2 -2
- package/dist/content.d.ts +1 -3
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +245 -190
- package/dist/useSeerChat.d.ts +22 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface SeerOrderCardItem {
|
|
|
14
14
|
detail?: string;
|
|
15
15
|
}
|
|
16
16
|
/** 「物流费用智能核算」卡片:行已经按多发货卖家端「下单详情」规则排好,照着画就行。 */
|
|
17
|
-
export interface
|
|
17
|
+
export interface SeerOrderEstimateCard {
|
|
18
18
|
type: 'order_estimate';
|
|
19
19
|
title: string;
|
|
20
20
|
channel_name: string;
|
|
@@ -32,6 +32,20 @@ export interface SeerOrderCard {
|
|
|
32
32
|
} | null;
|
|
33
33
|
blocked_reason: string;
|
|
34
34
|
}
|
|
35
|
+
/** 「还需要补充」表单:每项一个输入框,提交时把填了的项按「项目:内容」一行一项发回去。 */
|
|
36
|
+
export interface SeerOrderMissingCard {
|
|
37
|
+
type: 'order_missing';
|
|
38
|
+
title: string;
|
|
39
|
+
fields: Array<{
|
|
40
|
+
label: string;
|
|
41
|
+
group: string;
|
|
42
|
+
}>;
|
|
43
|
+
action: {
|
|
44
|
+
label: string;
|
|
45
|
+
};
|
|
46
|
+
note: string;
|
|
47
|
+
}
|
|
48
|
+
export type SeerOrderCard = SeerOrderEstimateCard | SeerOrderMissingCard;
|
|
35
49
|
export type SeerOrgOwner = string | (() => string | undefined);
|
|
36
50
|
export interface SeerClientOptions {
|
|
37
51
|
endpoint: string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SeerOrderMissingCard } from "../client";
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
card: SeerOrderMissingCard;
|
|
4
|
+
/** 不是最新一张卡、或正在回复时不可提交 */
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
submit: (message: string) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
onSubmit?: ((message: string) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
package/dist/content.d.ts
CHANGED
|
@@ -25,6 +25,4 @@ export interface ContentOptions {
|
|
|
25
25
|
export declare function linkAnchorLabel(prefix: string): string | null;
|
|
26
26
|
export declare function toContentSegments(content: string, options?: ContentOptions): ContentSegment[];
|
|
27
27
|
export declare function toContentLines(content: string, options?: ContentOptions): ContentSegment[][];
|
|
28
|
-
export declare function withoutCardText(content: string, card?:
|
|
29
|
-
panel_text?: string;
|
|
30
|
-
} | null): string;
|
|
28
|
+
export declare function withoutCardText(content: string, card?: object | null): string;
|
package/dist/index.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.seer-order-card[data-v-17d9e82e]{background:linear-gradient(#eef1fb,#fff 56px);border:1px solid #7f8faa38;border-radius:16px;margin-top:8px;padding:14px 14px 12px}.seer-order-card__title[data-v-17d9e82e]{color:#1d2129;margin:0 0 10px;font-size:18px;font-weight:800}.seer-order-card__panel[data-v-17d9e82e]{background:#fff;border-radius:12px;gap:10px;padding:12px;display:grid}.seer-order-card__channel[data-v-17d9e82e]{color:#1d2129;margin:0;font-size:14px;font-weight:600}.seer-order-card__rows[data-v-17d9e82e]{border:1px solid #e5e6eb;border-radius:10px;margin:0;overflow:hidden}.seer-order-card__row[data-v-17d9e82e]{grid-template-columns:1fr auto;gap:12px;padding:9px 12px;display:grid}.seer-order-card__row+.seer-order-card__row[data-v-17d9e82e]{border-top:1px solid #e5e6eb}.seer-order-card__label[data-v-17d9e82e]{color:#4e5969;font-weight:700}.seer-order-card__value[data-v-17d9e82e]{color:#1d2129;text-align:right;margin:0;font-weight:400}.seer-order-card__value--struck[data-v-17d9e82e]{text-decoration:line-through}.seer-order-card__subsidy[data-v-17d9e82e]{color:#c4161c;border:1px solid #c4161c;border-radius:10px;gap:2px;padding:8px 12px;font-size:13px;display:grid}.seer-order-card__total[data-v-17d9e82e]{justify-content:space-between;align-items:baseline;display:flex}.seer-order-card__total-value[data-v-17d9e82e]{color:#1d2129;font-size:20px;font-weight:800}.seer-order-card__submit[data-v-17d9e82e]{color:#1d2129;cursor:pointer;background:#fc0;border:0;border-radius:10px;padding:11px 0;font-size:16px;font-weight:700}.seer-order-card__submit[data-v-17d9e82e]:disabled{cursor:not-allowed;opacity:.5}.seer-order-card__blocked[data-v-17d9e82e]{color:#c4161c;margin:0;font-size:13px}.seer-chat[data-v-4cdc6832]{color:#18212f;background:radial-gradient(circle at 18% 0,#476aff24,#0000 32%),linear-gradient(#fff 0%,#f7f9fd 100%);border:1px solid #7f8faa47;border-radius:28px;gap:18px;max-width:720px;min-height:640px;padding:0;display:grid;overflow:hidden;box-shadow:0 24px 70px #151f3429}.seer-chat__header[data-v-4cdc6832]{color:#fff;background:linear-gradient(135deg,#141f34f5,#243f76f0),#172033;justify-content:space-between;align-items:flex-start;gap:16px;padding:22px 22px 18px;display:flex}.seer-chat__header h2[data-v-4cdc6832]{letter-spacing:-.03em;margin:0;font-size:22px}.seer-chat__header p[data-v-4cdc6832],.seer-chat__empty[data-v-4cdc6832],.seer-chat__status[data-v-4cdc6832]{color:#5f6f89;margin:4px 0 0;font-size:14px}.seer-chat__header p[data-v-4cdc6832]{color:#ffffffb8;max-width:34ch}.seer-chat__messages[data-v-4cdc6832]{align-content:start;gap:12px;min-height:330px;max-height:470px;padding:18px 18px 4px;display:grid;overflow-y:auto}.seer-chat__empty[data-v-4cdc6832]{color:#66748a;text-align:center;background:#ffffff9e;border:1px dashed #7f8faa61;border-radius:22px;place-items:center;min-height:260px;padding:0 28px;display:grid}.seer-chat__message[data-v-4cdc6832]{background:#ffffffe0;border:1px solid #7f8faa29;border-radius:18px 18px 18px 6px;gap:6px;max-width:min(86%,520px);padding:13px 15px;display:grid;box-shadow:0 12px 28px #151f3414}.seer-chat__message--user[data-v-4cdc6832]{color:#fff;background:linear-gradient(135deg,#285cff,#1d45c9);border-color:#0000;border-radius:18px 18px 6px;justify-self:end;box-shadow:0 14px 30px #1f5eff3d}.seer-chat__role[data-v-4cdc6832]{opacity:.75;font-size:12px;font-weight:700}.seer-chat__body[data-v-4cdc6832]{flex-direction:column;display:flex}.seer-chat__line[data-v-4cdc6832]{white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.seer-chat__line[data-v-4cdc6832]:not(:last-child){margin-bottom:5px}.seer-chat__line[data-v-4cdc6832]:empty{height:7px}.seer-chat__strong[data-v-4cdc6832]{font-weight:700}.seer-chat__message--assistant .seer-chat__line[data-v-4cdc6832]:has(.seer-chat__label-text){color:#1d2129}.seer-chat__label-text[data-v-4cdc6832]{color:#4e5969;font-weight:700}.seer-chat__message--user .seer-chat__label-text[data-v-4cdc6832]{color:inherit}.seer-chat__price[data-v-4cdc6832]{color:#e0331d;font-weight:600}.seer-chat__message--user .seer-chat__price[data-v-4cdc6832]{color:#ffe2dc}.seer-chat__link[data-v-4cdc6832]{color:#1f5eff;text-underline-offset:2px;overflow-wrap:anywhere;font-weight:600;text-decoration:underline}.seer-chat__link[data-v-4cdc6832]:hover{color:#173fb3}.seer-chat__message--user .seer-chat__link[data-v-4cdc6832]{color:#fff}.seer-chat__image-button[data-v-4cdc6832]{cursor:zoom-in;background:0 0;border:0;padding:0;display:block}.seer-chat__image-button[data-v-4cdc6832]:not(:disabled):hover{transform:none}.seer-chat__image[data-v-4cdc6832]{border:1px solid #7f8faa38;border-radius:12px;max-width:100%;margin:6px 0;transition:filter .16s;display:block}.seer-chat__image-button:hover .seer-chat__image[data-v-4cdc6832]{filter:brightness(.96)}.seer-chat__lightbox[data-v-4cdc6832]{z-index:1000;cursor:zoom-out;background:#0a0f1ad1;place-items:center;padding:32px;animation:.14s seer-chat__fade-in-4cdc6832;display:grid;position:fixed;inset:0}.seer-chat__lightbox-image[data-v-4cdc6832]{object-fit:contain;border-radius:12px;max-width:min(92vw,1200px);max-height:90vh;box-shadow:0 30px 80px #00000080}.seer-chat__lightbox-close[data-v-4cdc6832]{color:#fff;background:#ffffff24;border-radius:50%;place-items:center;width:40px;height:40px;font-size:26px;line-height:1;display:grid;position:fixed;top:18px;right:22px}.seer-chat__lightbox-close[data-v-4cdc6832]:not(:disabled):hover{background:#ffffff3d}@keyframes seer-chat__fade-in-4cdc6832{0%{opacity:0}to{opacity:1}}.seer-chat__error[data-v-4cdc6832],.seer-chat__handoff[data-v-4cdc6832]{border-radius:14px;margin:0 18px;padding:10px 12px}.seer-chat__error[data-v-4cdc6832]{color:#8a1f11;background:#fff0ed}.seer-chat__handoff[data-v-4cdc6832]{color:#704600;background:#fff7db}.seer-chat__form[data-v-4cdc6832]{background:#fff;border:1px solid #7f8faa42;border-radius:22px;gap:11px;margin:0 18px 18px;padding:14px;display:grid;box-shadow:0 18px 38px #151f3417}.seer-chat__form--dragging[data-v-4cdc6832]{background:#f3f6ff;border:1px dashed #285cff}.seer-chat__label[data-v-4cdc6832]{font-size:13px;font-weight:700}.seer-chat textarea[data-v-4cdc6832]{box-sizing:border-box;width:100%;min-height:92px;color:inherit;resize:vertical;background:#f8fafd;border:1px solid #0000;border-radius:16px;outline:none;padding:14px;line-height:1.55;transition:background .16s,border-color .16s,box-shadow .16s}.seer-chat button[data-v-4cdc6832]{color:inherit;cursor:pointer;border:0;font-weight:700;transition:transform .16s,box-shadow .16s,opacity .16s}.seer-chat button[data-v-4cdc6832]:not(:disabled):hover{transform:translateY(-1px)}.seer-chat button[data-v-4cdc6832]:disabled{cursor:not-allowed;opacity:.5}.seer-chat button[data-v-4cdc6832]:focus-visible,.seer-chat textarea[data-v-4cdc6832]:focus-visible{border-color:#1f5eff6b;box-shadow:0 0 0 4px #1f5eff21}.seer-chat__clear-button[data-v-4cdc6832]{color:#ffffffc7;background:0 0;border-radius:12px;flex:none;padding:8px 11px;font-size:12px;border:1px solid #ffffff2e!important}.seer-chat__clear-button[data-v-4cdc6832]:not(:disabled):hover{color:#fff;box-shadow:none;background:#ffffff1a}.seer-chat__stop-button[data-v-4cdc6832]{color:#6c3b12;background:#fff1df;border-radius:12px;padding:8px 11px;font-size:12px}.seer-chat__mic-button[data-v-4cdc6832],.seer-chat__attach-button[data-v-4cdc6832]{color:#285cff;background:#edf2ff;border-radius:50%;flex:none;place-items:center;width:40px;height:40px;padding:0;display:grid}.seer-chat__mic-button[data-v-4cdc6832]:not(:disabled):hover,.seer-chat__attach-button[data-v-4cdc6832]:not(:disabled):hover{background:#dfe8ff}.seer-chat__file-input[data-v-4cdc6832]{display:none}.seer-chat__attachments[data-v-4cdc6832]{flex-wrap:wrap;gap:6px;margin:0 0 8px;padding:0;list-style:none;display:flex}.seer-chat__attachment[data-v-4cdc6832]{color:#1f2a44;background:#edf2ff;border-radius:999px;align-items:center;gap:4px;max-width:100%;padding:4px 6px 4px 10px;font-size:13px;display:inline-flex}.seer-chat__attachment-name[data-v-4cdc6832]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.seer-chat__attachment-remove[data-v-4cdc6832]{color:#4b5878;background:0 0;border-radius:50%;width:20px;height:20px;padding:0;line-height:1}.seer-chat__attachment-remove[data-v-4cdc6832]:hover{background:#dfe8ff}.seer-chat__mic-button--recording[data-v-4cdc6832]{color:#fff;background:#d9342b;animation:1.4s ease-in-out infinite seer-chat__recording-pulse-4cdc6832;box-shadow:0 0 0 5px #d9342b24}.seer-chat__mic-button--recording[data-v-4cdc6832]:not(:disabled):hover{background:#bd271f}.seer-chat__stop-icon[data-v-4cdc6832]{background:currentColor;border-radius:3px;width:12px;height:12px}@keyframes seer-chat__recording-pulse-4cdc6832{50%{box-shadow:0 0 0 9px #d9342b14}}.seer-chat__send-button[data-v-4cdc6832]{color:#fff;background:linear-gradient(135deg,#1f5eff,#173fb3);border-radius:14px;justify-content:center;align-items:center;gap:8px;min-width:86px;padding:10px 14px;display:inline-flex;box-shadow:0 12px 24px #1f5eff38}.seer-chat__send-button[data-v-4cdc6832]:not(:disabled):hover{box-shadow:0 14px 28px #1f5eff47}.seer-chat__hint[data-v-4cdc6832]{color:#7a879a;margin-right:auto;font-size:12px}.seer-chat__composer-footer[data-v-4cdc6832]{justify-content:flex-end;align-items:center;gap:8px;display:flex}
|
|
1
|
+
.seer-missing-form[data-v-0316f2f7]{background:#fff;border:1px solid #7f8faa38;border-radius:16px;gap:10px;margin-top:8px;padding:14px;display:grid}.seer-missing-form__title[data-v-0316f2f7]{color:#1d2129;margin:0;font-size:16px;font-weight:800}.seer-missing-form__group[data-v-0316f2f7]{border:1px solid #e5e6eb;border-radius:10px;gap:8px;margin:0;padding:10px 12px;display:grid}.seer-missing-form__legend[data-v-0316f2f7]{color:#1d2129;padding:0 4px;font-size:13px;font-weight:700}.seer-missing-form__field[data-v-0316f2f7]{gap:4px;display:grid}.seer-missing-form__label[data-v-0316f2f7]{color:#4e5969;font-size:13px;font-weight:700}.seer-missing-form__input[data-v-0316f2f7]{color:#1d2129;font:inherit;border:1px solid #c9cdd4;border-radius:8px;padding:7px 10px}.seer-missing-form__note[data-v-0316f2f7]{color:#86909c;margin:0;font-size:12px}.seer-missing-form__submit[data-v-0316f2f7]{color:#fff;cursor:pointer;background:#285cff;border:0;border-radius:10px;padding:9px 0;font-weight:700}.seer-missing-form__submit[data-v-0316f2f7]:disabled{cursor:not-allowed;opacity:.5}.seer-order-card[data-v-7db76bb0]{background:linear-gradient(#eef1fb,#fff 56px);border:1px solid #7f8faa38;border-radius:16px;margin-top:8px;padding:14px 14px 12px}.seer-order-card__title[data-v-7db76bb0]{color:#1d2129;margin:0 0 10px;font-size:18px;font-weight:800}.seer-order-card__panel[data-v-7db76bb0]{background:#fff;border-radius:12px;gap:10px;padding:12px;display:grid}.seer-order-card__channel[data-v-7db76bb0]{color:#1d2129;margin:0;font-size:14px;font-weight:600}.seer-order-card__rows[data-v-7db76bb0]{border:1px solid #e5e6eb;border-radius:10px;margin:0;overflow:hidden}.seer-order-card__row[data-v-7db76bb0]{grid-template-columns:1fr auto;gap:12px;padding:9px 12px;display:grid}.seer-order-card__row+.seer-order-card__row[data-v-7db76bb0]{border-top:1px solid #e5e6eb}.seer-order-card__label[data-v-7db76bb0]{color:#4e5969;font-weight:700}.seer-order-card__value[data-v-7db76bb0]{color:#1d2129;text-align:right;margin:0;font-weight:400}.seer-order-card__value--struck[data-v-7db76bb0]{text-decoration:line-through}.seer-order-card__subsidy[data-v-7db76bb0]{color:#c4161c;border:1px solid #c4161c;border-radius:10px;gap:2px;padding:8px 12px;font-size:13px;display:grid}.seer-order-card__total[data-v-7db76bb0]{justify-content:space-between;align-items:baseline;display:flex}.seer-order-card__total-value[data-v-7db76bb0]{color:#1d2129;font-size:20px;font-weight:800}.seer-order-card__submit[data-v-7db76bb0]{color:#1d2129;cursor:pointer;background:#fc0;border:0;border-radius:10px;padding:11px 0;font-size:16px;font-weight:700}.seer-order-card__submit[data-v-7db76bb0]:disabled{cursor:not-allowed;opacity:.5}.seer-order-card__blocked[data-v-7db76bb0]{color:#c4161c;margin:0;font-size:13px}.seer-chat[data-v-f99281cd]{color:#18212f;background:radial-gradient(circle at 18% 0,#476aff24,#0000 32%),linear-gradient(#fff 0%,#f7f9fd 100%);border:1px solid #7f8faa47;border-radius:28px;gap:18px;max-width:720px;min-height:640px;padding:0;display:grid;overflow:hidden;box-shadow:0 24px 70px #151f3429}.seer-chat__header[data-v-f99281cd]{color:#fff;background:linear-gradient(135deg,#141f34f5,#243f76f0),#172033;justify-content:space-between;align-items:flex-start;gap:16px;padding:22px 22px 18px;display:flex}.seer-chat__header h2[data-v-f99281cd]{letter-spacing:-.03em;margin:0;font-size:22px}.seer-chat__header p[data-v-f99281cd],.seer-chat__empty[data-v-f99281cd],.seer-chat__status[data-v-f99281cd]{color:#5f6f89;margin:4px 0 0;font-size:14px}.seer-chat__header p[data-v-f99281cd]{color:#ffffffb8;max-width:34ch}.seer-chat__messages[data-v-f99281cd]{align-content:start;gap:12px;min-height:330px;max-height:470px;padding:18px 18px 4px;display:grid;overflow-y:auto}.seer-chat__empty[data-v-f99281cd]{color:#66748a;text-align:center;background:#ffffff9e;border:1px dashed #7f8faa61;border-radius:22px;place-items:center;min-height:260px;padding:0 28px;display:grid}.seer-chat__message[data-v-f99281cd]{background:#ffffffe0;border:1px solid #7f8faa29;border-radius:18px 18px 18px 6px;gap:6px;max-width:min(86%,520px);padding:13px 15px;display:grid;box-shadow:0 12px 28px #151f3414}.seer-chat__message--user[data-v-f99281cd]{color:#fff;background:linear-gradient(135deg,#285cff,#1d45c9);border-color:#0000;border-radius:18px 18px 6px;justify-self:end;box-shadow:0 14px 30px #1f5eff3d}.seer-chat__role[data-v-f99281cd]{opacity:.75;font-size:12px;font-weight:700}.seer-chat__body[data-v-f99281cd]{flex-direction:column;display:flex}.seer-chat__line[data-v-f99281cd]{white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.seer-chat__line[data-v-f99281cd]:not(:last-child){margin-bottom:5px}.seer-chat__line[data-v-f99281cd]:empty{height:7px}.seer-chat__strong[data-v-f99281cd]{font-weight:700}.seer-chat__message--assistant .seer-chat__line[data-v-f99281cd]:has(.seer-chat__label-text){color:#1d2129}.seer-chat__label-text[data-v-f99281cd]{color:#4e5969;font-weight:700}.seer-chat__message--user .seer-chat__label-text[data-v-f99281cd]{color:inherit}.seer-chat__price[data-v-f99281cd]{color:#e0331d;font-weight:600}.seer-chat__message--user .seer-chat__price[data-v-f99281cd]{color:#ffe2dc}.seer-chat__link[data-v-f99281cd]{color:#1f5eff;text-underline-offset:2px;overflow-wrap:anywhere;font-weight:600;text-decoration:underline}.seer-chat__link[data-v-f99281cd]:hover{color:#173fb3}.seer-chat__message--user .seer-chat__link[data-v-f99281cd]{color:#fff}.seer-chat__image-button[data-v-f99281cd]{cursor:zoom-in;background:0 0;border:0;padding:0;display:block}.seer-chat__image-button[data-v-f99281cd]:not(:disabled):hover{transform:none}.seer-chat__image[data-v-f99281cd]{border:1px solid #7f8faa38;border-radius:12px;max-width:100%;margin:6px 0;transition:filter .16s;display:block}.seer-chat__image-button:hover .seer-chat__image[data-v-f99281cd]{filter:brightness(.96)}.seer-chat__lightbox[data-v-f99281cd]{z-index:1000;cursor:zoom-out;background:#0a0f1ad1;place-items:center;padding:32px;animation:.14s seer-chat__fade-in-f99281cd;display:grid;position:fixed;inset:0}.seer-chat__lightbox-image[data-v-f99281cd]{object-fit:contain;border-radius:12px;max-width:min(92vw,1200px);max-height:90vh;box-shadow:0 30px 80px #00000080}.seer-chat__lightbox-close[data-v-f99281cd]{color:#fff;background:#ffffff24;border-radius:50%;place-items:center;width:40px;height:40px;font-size:26px;line-height:1;display:grid;position:fixed;top:18px;right:22px}.seer-chat__lightbox-close[data-v-f99281cd]:not(:disabled):hover{background:#ffffff3d}@keyframes seer-chat__fade-in-f99281cd{0%{opacity:0}to{opacity:1}}.seer-chat__error[data-v-f99281cd],.seer-chat__handoff[data-v-f99281cd]{border-radius:14px;margin:0 18px;padding:10px 12px}.seer-chat__error[data-v-f99281cd]{color:#8a1f11;background:#fff0ed}.seer-chat__handoff[data-v-f99281cd]{color:#704600;background:#fff7db}.seer-chat__form[data-v-f99281cd]{background:#fff;border:1px solid #7f8faa42;border-radius:22px;gap:11px;margin:0 18px 18px;padding:14px;display:grid;box-shadow:0 18px 38px #151f3417}.seer-chat__form--dragging[data-v-f99281cd]{background:#f3f6ff;border:1px dashed #285cff}.seer-chat__label[data-v-f99281cd]{font-size:13px;font-weight:700}.seer-chat textarea[data-v-f99281cd]{box-sizing:border-box;width:100%;min-height:92px;color:inherit;resize:vertical;background:#f8fafd;border:1px solid #0000;border-radius:16px;outline:none;padding:14px;line-height:1.55;transition:background .16s,border-color .16s,box-shadow .16s}.seer-chat button[data-v-f99281cd]{color:inherit;cursor:pointer;border:0;font-weight:700;transition:transform .16s,box-shadow .16s,opacity .16s}.seer-chat button[data-v-f99281cd]:not(:disabled):hover{transform:translateY(-1px)}.seer-chat button[data-v-f99281cd]:disabled{cursor:not-allowed;opacity:.5}.seer-chat button[data-v-f99281cd]:focus-visible,.seer-chat textarea[data-v-f99281cd]:focus-visible{border-color:#1f5eff6b;box-shadow:0 0 0 4px #1f5eff21}.seer-chat__clear-button[data-v-f99281cd]{color:#ffffffc7;background:0 0;border-radius:12px;flex:none;padding:8px 11px;font-size:12px;border:1px solid #ffffff2e!important}.seer-chat__clear-button[data-v-f99281cd]:not(:disabled):hover{color:#fff;box-shadow:none;background:#ffffff1a}.seer-chat__stop-button[data-v-f99281cd]{color:#6c3b12;background:#fff1df;border-radius:12px;padding:8px 11px;font-size:12px}.seer-chat__mic-button[data-v-f99281cd],.seer-chat__attach-button[data-v-f99281cd]{color:#285cff;background:#edf2ff;border-radius:50%;flex:none;place-items:center;width:40px;height:40px;padding:0;display:grid}.seer-chat__mic-button[data-v-f99281cd]:not(:disabled):hover,.seer-chat__attach-button[data-v-f99281cd]:not(:disabled):hover{background:#dfe8ff}.seer-chat__file-input[data-v-f99281cd]{display:none}.seer-chat__attachments[data-v-f99281cd]{flex-wrap:wrap;gap:6px;margin:0 0 8px;padding:0;list-style:none;display:flex}.seer-chat__attachment[data-v-f99281cd]{color:#1f2a44;background:#edf2ff;border-radius:999px;align-items:center;gap:4px;max-width:100%;padding:4px 6px 4px 10px;font-size:13px;display:inline-flex}.seer-chat__attachment-name[data-v-f99281cd]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.seer-chat__attachment-remove[data-v-f99281cd]{color:#4b5878;background:0 0;border-radius:50%;width:20px;height:20px;padding:0;line-height:1}.seer-chat__attachment-remove[data-v-f99281cd]:hover{background:#dfe8ff}.seer-chat__mic-button--recording[data-v-f99281cd]{color:#fff;background:#d9342b;animation:1.4s ease-in-out infinite seer-chat__recording-pulse-f99281cd;box-shadow:0 0 0 5px #d9342b24}.seer-chat__mic-button--recording[data-v-f99281cd]:not(:disabled):hover{background:#bd271f}.seer-chat__stop-icon[data-v-f99281cd]{background:currentColor;border-radius:3px;width:12px;height:12px}@keyframes seer-chat__recording-pulse-f99281cd{50%{box-shadow:0 0 0 9px #d9342b14}}.seer-chat__send-button[data-v-f99281cd]{color:#fff;background:linear-gradient(135deg,#1f5eff,#173fb3);border-radius:14px;justify-content:center;align-items:center;gap:8px;min-width:86px;padding:10px 14px;display:inline-flex;box-shadow:0 12px 24px #1f5eff38}.seer-chat__send-button[data-v-f99281cd]:not(:disabled):hover{box-shadow:0 14px 28px #1f5eff47}.seer-chat__hint[data-v-f99281cd]{color:#7a879a;margin-right:auto;font-size:12px}.seer-chat__composer-footer[data-v-f99281cd]{justify-content:flex-end;align-items:center;gap:8px;display:flex}
|
|
2
2
|
/*$vite$:1*/
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { SeerChatPlugin } from './plugin';
|
|
|
4
4
|
export { useSeerChat } from './useSeerChat';
|
|
5
5
|
export { default as SeerChat } from './components/SeerChat.vue';
|
|
6
6
|
export { default as SeerOrderCard } from './components/SeerOrderCard.vue';
|
|
7
|
-
export
|
|
7
|
+
export { default as SeerMissingForm } from './components/SeerMissingForm.vue';
|
|
8
|
+
export type { SeerChatCallbacks, SeerChatMessage, SeerChatRequest, SeerChatResult, SeerChatRole, SeerClient, SeerClientOptions, SeerOrderCard as SeerOrderCardData, SeerOrderEstimateCard, SeerOrderMissingCard, SeerOrderCardItem, SeerTranscriptionCallbacks, SeerTranscriptionResult, SeerUploadedFile, } from './client';
|
|
8
9
|
export type { SeerChatPluginOptions } from './plugin';
|
|
9
10
|
export type { UseSeerChatOptions } from './useSeerChat';
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, hasInjectionContext as s, inject as c, normalizeClass as l, onBeforeUnmount as u, openBlock as d,
|
|
1
|
+
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, hasInjectionContext as s, inject as c, normalizeClass as l, onBeforeUnmount as u, openBlock as d, reactive as f, ref as p, renderList as m, toDisplayString as h, unref as g, vModelText as _, withDirectives as v, withKeys as y, withModifiers as b } from "vue";
|
|
2
2
|
// src/client.ts
|
|
3
|
-
function
|
|
4
|
-
let t = e.fetcher ?? fetch, n = e.model ?? "seer", r =
|
|
3
|
+
function x(e) {
|
|
4
|
+
let t = e.fetcher ?? fetch, n = e.model ?? "seer", r = C(e.endpoint, e.transcriptionEndpoint, "/v1/browser/audio/transcriptions"), i = C(e.endpoint, e.uploadEndpoint, "/v1/browser/files"), a = e.now ?? (() => Math.floor(Date.now() / 1e3)), o, s = 0, c;
|
|
5
5
|
return {
|
|
6
6
|
transcriptionEnabled: !!r,
|
|
7
7
|
uploadEnabled: !!i,
|
|
8
8
|
async chat(r, i = {}) {
|
|
9
9
|
let a = r.stream ?? !1, o = await l(), s = { "Content-Type": "application/json" };
|
|
10
10
|
o && (s.Authorization = `Bearer ${o}`);
|
|
11
|
-
let c =
|
|
11
|
+
let c = S(e.sellerToken);
|
|
12
12
|
c && (s["X-DFH-Seller-Token"] = c);
|
|
13
13
|
let u = await t(e.endpoint, {
|
|
14
14
|
method: "POST",
|
|
@@ -30,8 +30,8 @@ function b(e) {
|
|
|
30
30
|
...r.attachments?.length ? { attachments: r.attachments } : {}
|
|
31
31
|
})
|
|
32
32
|
});
|
|
33
|
-
if (!u.ok) throw Error(await
|
|
34
|
-
return a ?
|
|
33
|
+
if (!u.ok) throw Error(await D(u));
|
|
34
|
+
return a ? T(u, i.onDelta) : w(await u.json());
|
|
35
35
|
},
|
|
36
36
|
async transcribe(e, n, i = {}) {
|
|
37
37
|
if (!r) throw Error("Seer audio transcription endpoint is not configured");
|
|
@@ -45,7 +45,7 @@ function b(e) {
|
|
|
45
45
|
signal: i.signal,
|
|
46
46
|
body: s
|
|
47
47
|
});
|
|
48
|
-
if (!c.ok) throw Error(await
|
|
48
|
+
if (!c.ok) throw Error(await D(c));
|
|
49
49
|
let u = await c.json(), d = typeof u.text == "string" ? u.text.trim() : "";
|
|
50
50
|
if (!d) throw Error("Seer audio transcription returned empty text");
|
|
51
51
|
return { text: d };
|
|
@@ -62,7 +62,7 @@ function b(e) {
|
|
|
62
62
|
signal: r.signal,
|
|
63
63
|
body: s
|
|
64
64
|
});
|
|
65
|
-
if (!c.ok) throw Error(await
|
|
65
|
+
if (!c.ok) throw Error(await D(c));
|
|
66
66
|
let u = await c.json();
|
|
67
67
|
if (!u.file_id) throw Error("Seer file upload returned no file_id");
|
|
68
68
|
return {
|
|
@@ -76,13 +76,13 @@ function b(e) {
|
|
|
76
76
|
};
|
|
77
77
|
async function l() {
|
|
78
78
|
if (!e.sessionEndpoint) return;
|
|
79
|
-
let n = a(), r =
|
|
79
|
+
let n = a(), r = S(e.orgOwner);
|
|
80
80
|
if (o && c === r && s - 30 > n) return o;
|
|
81
81
|
let i = await t(e.sessionEndpoint, {
|
|
82
82
|
method: "GET",
|
|
83
83
|
headers: await u(r)
|
|
84
84
|
});
|
|
85
|
-
if (!i.ok) throw Error(await
|
|
85
|
+
if (!i.ok) throw Error(await D(i));
|
|
86
86
|
let l = await i.json();
|
|
87
87
|
return o = l.token, s = l.expires_at, c = r, o;
|
|
88
88
|
}
|
|
@@ -91,14 +91,14 @@ function b(e) {
|
|
|
91
91
|
return e.challengeTokenProvider && (n["X-Seer-Challenge-Token"] = await e.challengeTokenProvider()), t && (n["X-Seer-Org-Owner"] = t), n;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function S(e) {
|
|
95
95
|
return (typeof e == "function" ? e() : e)?.trim() || void 0;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function C(e, t, n) {
|
|
98
98
|
if (t !== void 0) return t || void 0;
|
|
99
99
|
if (e.endsWith("/v1/browser/chat/completions")) return `${e.slice(0, -28)}${n}`;
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function w(e) {
|
|
102
102
|
let t = e.choices?.[0];
|
|
103
103
|
return {
|
|
104
104
|
content: t?.message?.content ?? t?.delta?.content ?? "",
|
|
@@ -109,8 +109,8 @@ function C(e) {
|
|
|
109
109
|
...e.order_card ? { orderCard: e.order_card } : {}
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
-
async function
|
|
113
|
-
if (!e.body) return
|
|
112
|
+
async function T(e, t) {
|
|
113
|
+
if (!e.body) return w({});
|
|
114
114
|
let n = e.body.getReader(), r = new TextDecoder(), i = "", a = "", o, s = [], c = !1, l, u, d = !1;
|
|
115
115
|
for (;;) {
|
|
116
116
|
let { done: e, value: f } = await n.read();
|
|
@@ -119,7 +119,7 @@ async function w(e, t) {
|
|
|
119
119
|
let p = i.split("\n\n");
|
|
120
120
|
i = p.pop() ?? "";
|
|
121
121
|
for (let e of p) {
|
|
122
|
-
let n =
|
|
122
|
+
let n = E(e);
|
|
123
123
|
if (!n) continue;
|
|
124
124
|
if (n === "[DONE]") {
|
|
125
125
|
d = !0;
|
|
@@ -139,11 +139,11 @@ async function w(e, t) {
|
|
|
139
139
|
...u ? { orderCard: u } : {}
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function E(e) {
|
|
143
143
|
let t = e.split("\n").map((e) => e.trim()).filter((e) => e.startsWith("data:")).map((e) => e.slice(5).trim());
|
|
144
144
|
return t.length === 0 ? null : t.join("\n");
|
|
145
145
|
}
|
|
146
|
-
async function
|
|
146
|
+
async function D(e) {
|
|
147
147
|
let t = e.statusText || "unknown error";
|
|
148
148
|
try {
|
|
149
149
|
let n = await e.json();
|
|
@@ -155,12 +155,12 @@ async function E(e) {
|
|
|
155
155
|
return `seer chat request failed with status ${e.status}: ${t}`;
|
|
156
156
|
}
|
|
157
157
|
// src/content.ts
|
|
158
|
-
var
|
|
159
|
-
function
|
|
158
|
+
var O = /https?:\/\/[^\s)\u3000-\u303f\u4e00-\u9fff\uff00-\uffef]+/g, ee = /\.(png|jpe?g|gif|webp|bmp|svg)$/i, k = "链接生成中…", te = "图片加载中…", A = /* @__PURE__ */ RegExp("(单价\\s*\\d[\\d.]*\\s*[A-Za-z]+\\/(?:kg|方))|(按当前信息为您筛选出[^\\n:]*推荐方案[^\\n:]*:)|(方案PK|时效最快|价格最低)", "g");
|
|
159
|
+
function j(e) {
|
|
160
160
|
let t = [];
|
|
161
|
-
|
|
161
|
+
A.lastIndex = 0;
|
|
162
162
|
let n = 0, r;
|
|
163
|
-
for (; (r =
|
|
163
|
+
for (; (r = A.exec(e)) !== null;) {
|
|
164
164
|
r.index > n && t.push({
|
|
165
165
|
kind: "text",
|
|
166
166
|
value: e.slice(n, r.index)
|
|
@@ -179,52 +179,52 @@ function M(e) {
|
|
|
179
179
|
value: e.slice(n)
|
|
180
180
|
}), t;
|
|
181
181
|
}
|
|
182
|
-
var
|
|
183
|
-
function
|
|
182
|
+
var M = /标签|箱唛|唛头|入库单|交接单|入仓单|面单|下载/;
|
|
183
|
+
function N(e, t) {
|
|
184
184
|
if (/方案|截图|报价图|效果图|示意图|图片/.test(t)) return !0;
|
|
185
|
-
if (
|
|
185
|
+
if (M.test(t)) return !1;
|
|
186
186
|
let n = e.split(/[?#]/)[0];
|
|
187
|
-
return
|
|
187
|
+
return ee.test(n);
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function P(e) {
|
|
190
190
|
return /方案|报价|截图|PK/.test(e) ? "方案PK" : "图片";
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function F(e) {
|
|
193
193
|
return /标签|箱唛/.test(e) ? "点击下载箱唛" : /入库单|交接单/.test(e) ? "点击下载入库单" : /面单/.test(e) ? "点击下载面单" : /截图|方案/.test(e) ? "点击查看方案PK" : /下载链接|labelUrl|下载/.test(e) ? "点击下载" : /链接/.test(e) ? "点击查看" : null;
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function I(e, t = {}) {
|
|
196
196
|
let n = [];
|
|
197
|
-
|
|
197
|
+
O.lastIndex = 0;
|
|
198
198
|
let r = 0, i;
|
|
199
|
-
for (; (i =
|
|
200
|
-
let a = i[0], o = i.index, s = e.lastIndexOf("\n", o - 1) + 1, c = e.slice(s, o), l =
|
|
199
|
+
for (; (i = O.exec(e)) !== null;) {
|
|
200
|
+
let a = i[0], o = i.index, s = e.lastIndexOf("\n", o - 1) + 1, c = e.slice(s, o), l = N(a, c), u = !t.complete && o + a.length === e.length;
|
|
201
201
|
if (o > r) {
|
|
202
202
|
let t = e.slice(r, o);
|
|
203
|
-
l && (t = t.replace(/链接([::])\s*$/, "$1")), n.push(...
|
|
203
|
+
l && (t = t.replace(/链接([::])\s*$/, "$1")), n.push(...j(t));
|
|
204
204
|
}
|
|
205
205
|
u ? n.push({
|
|
206
206
|
kind: "text",
|
|
207
|
-
value: l ?
|
|
207
|
+
value: l ? te : k
|
|
208
208
|
}) : l ? n.push({
|
|
209
209
|
kind: "image",
|
|
210
210
|
href: a,
|
|
211
|
-
alt:
|
|
211
|
+
alt: P(c)
|
|
212
212
|
}) : n.push({
|
|
213
213
|
kind: "link",
|
|
214
214
|
href: a,
|
|
215
|
-
label:
|
|
215
|
+
label: F(c) ?? a
|
|
216
216
|
}), r = o + a.length;
|
|
217
217
|
}
|
|
218
|
-
return r < e.length && n.push(...
|
|
218
|
+
return r < e.length && n.push(...j(e.slice(r))), n;
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function L(e, t = {}) {
|
|
221
221
|
let n = e.split("\n");
|
|
222
222
|
return n.map((e, r) => {
|
|
223
|
-
let i =
|
|
224
|
-
return a ?
|
|
223
|
+
let i = I(e, { complete: t.complete || r < n.length - 1 }), a = z.exec(e);
|
|
224
|
+
return a ? R(i, a[0]) : i;
|
|
225
225
|
});
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function R(e, t) {
|
|
228
228
|
let n = t.length, r = [];
|
|
229
229
|
for (let t of e) {
|
|
230
230
|
if (n === 0 || !("value" in t)) {
|
|
@@ -242,33 +242,34 @@ function z(e, t) {
|
|
|
242
242
|
value: t
|
|
243
243
|
}, ...r];
|
|
244
244
|
}
|
|
245
|
-
var
|
|
246
|
-
function
|
|
247
|
-
|
|
245
|
+
var z = /^[\u4e00-\u9fffA-Za-z0-9()()/-]{1,14}:(?=\S)/;
|
|
246
|
+
function B(e, t) {
|
|
247
|
+
let n = t && "panel_text" in t ? String(t.panel_text) : "";
|
|
248
|
+
return n ? e.replace(n, "").replace(/\n{3,}/g, "\n\n") : e;
|
|
248
249
|
}
|
|
249
250
|
// src/plugin.ts
|
|
250
|
-
var
|
|
251
|
-
e.provide(
|
|
251
|
+
var V = Symbol("seer-chat-options"), H = { install(e, t) {
|
|
252
|
+
e.provide(V, t);
|
|
252
253
|
} };
|
|
253
254
|
// src/useSeerChat.ts
|
|
254
|
-
function
|
|
255
|
-
let t = s() ? c(
|
|
255
|
+
function U(e = {}) {
|
|
256
|
+
let t = s() ? c(V, void 0) : void 0, n = Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0)), r = {
|
|
256
257
|
...t,
|
|
257
258
|
...n
|
|
258
259
|
};
|
|
259
260
|
if (!r.endpoint) throw Error("Seer chat endpoint is required. Pass it to app.use() or useSeerChat().");
|
|
260
|
-
let i =
|
|
261
|
+
let i = x({
|
|
261
262
|
endpoint: r.endpoint,
|
|
262
263
|
sessionEndpoint: r.sessionEndpoint,
|
|
263
264
|
transcriptionEndpoint: r.transcriptionEndpoint,
|
|
264
265
|
uploadEndpoint: r.uploadEndpoint,
|
|
265
266
|
challengeTokenProvider: r.challengeTokenProvider,
|
|
266
|
-
orgOwner: () =>
|
|
267
|
-
sellerToken: () =>
|
|
267
|
+
orgOwner: () => S(e.orgOwner) ?? S(t?.orgOwner),
|
|
268
|
+
sellerToken: () => S(e.sellerToken) ?? S(t?.sellerToken),
|
|
268
269
|
model: r.model,
|
|
269
270
|
fetcher: r.fetcher
|
|
270
|
-
}), a =
|
|
271
|
-
async function
|
|
271
|
+
}), a = p([]), o = p(!1), l = p(null), u = p(), d = p([]), f = p(!1), m = r.voiceEnabled !== !1 && i.transcriptionEnabled, h = r.uploadEnabled !== !1 && i.uploadEnabled, g = r.maxRecordingSeconds ?? 60, _ = p([]), v = p(!1), y = null;
|
|
272
|
+
async function b(e, t = {}) {
|
|
272
273
|
v.value = !0, l.value = null;
|
|
273
274
|
try {
|
|
274
275
|
let n = await i.upload(e, e.name);
|
|
@@ -311,7 +312,7 @@ function ee(e = {}) {
|
|
|
311
312
|
role: "assistant",
|
|
312
313
|
content: e.content,
|
|
313
314
|
...e.orderCard ? { orderCard: e.orderCard } : {}
|
|
314
|
-
}], u.value = e.conversationId, d.value = e.citations,
|
|
315
|
+
}], u.value = e.conversationId, d.value = e.citations, f.value = e.handoffRequested;
|
|
315
316
|
} catch (e) {
|
|
316
317
|
e.name !== "AbortError" && (l.value = e instanceof Error ? e.message : String(e));
|
|
317
318
|
} finally {
|
|
@@ -319,7 +320,7 @@ function ee(e = {}) {
|
|
|
319
320
|
}
|
|
320
321
|
}
|
|
321
322
|
function T() {
|
|
322
|
-
a.value = [], _.value = [], l.value = null, u.value = void 0, d.value = [],
|
|
323
|
+
a.value = [], _.value = [], l.value = null, u.value = void 0, d.value = [], f.value = !1;
|
|
323
324
|
}
|
|
324
325
|
function E() {
|
|
325
326
|
y?.abort();
|
|
@@ -330,32 +331,81 @@ function ee(e = {}) {
|
|
|
330
331
|
error: l,
|
|
331
332
|
conversationId: u,
|
|
332
333
|
citations: d,
|
|
333
|
-
handoffRequested:
|
|
334
|
+
handoffRequested: f,
|
|
334
335
|
transcriptionEnabled: m,
|
|
335
336
|
maxRecordingSeconds: g,
|
|
336
337
|
transcribe: i.transcribe,
|
|
337
338
|
uploadEnabled: h,
|
|
338
339
|
attachments: _,
|
|
339
340
|
uploading: v,
|
|
340
|
-
attach:
|
|
341
|
+
attach: b,
|
|
341
342
|
removeAttachment: C,
|
|
342
343
|
send: w,
|
|
343
344
|
reset: T,
|
|
344
345
|
abort: E
|
|
345
346
|
};
|
|
346
347
|
}
|
|
347
|
-
// src/components/
|
|
348
|
-
var W = ["aria-label"], G = { class: "seer-
|
|
348
|
+
// src/components/SeerMissingForm.vue?vue&type=script&setup=true&lang.ts
|
|
349
|
+
var W = ["aria-label"], G = { class: "seer-missing-form__title" }, K = ["disabled"], q = { class: "seer-missing-form__legend" }, J = { class: "seer-missing-form__label" }, Y = ["onUpdate:modelValue"], X = { class: "seer-missing-form__note" }, Z = ["disabled"], Q = /*@__PURE__*/ o({
|
|
350
|
+
__name: "SeerMissingForm",
|
|
351
|
+
props: {
|
|
352
|
+
card: {},
|
|
353
|
+
disabled: { type: Boolean }
|
|
354
|
+
},
|
|
355
|
+
emits: ["submit"],
|
|
356
|
+
setup(n, { emit: r }) {
|
|
357
|
+
let o = n, s = r, c = f({}), l = t(() => {
|
|
358
|
+
let e = /* @__PURE__ */ new Map();
|
|
359
|
+
for (let t of o.card.fields) e.set(t.group, [...e.get(t.group) ?? [], t.label]);
|
|
360
|
+
return [...e.entries()].map(([e, t]) => ({
|
|
361
|
+
name: e,
|
|
362
|
+
labels: t
|
|
363
|
+
}));
|
|
364
|
+
}), u = t(() => o.card.fields.map((e) => [e.label, (c[e.label] ?? "").trim()]).filter(([, e]) => e));
|
|
365
|
+
function p() {
|
|
366
|
+
o.disabled || u.value.length === 0 || s("submit", u.value.map(([e, t]) => `${e}:${t}`).join("\n"));
|
|
367
|
+
}
|
|
368
|
+
return (t, r) => (d(), i("form", {
|
|
369
|
+
class: "seer-missing-form",
|
|
370
|
+
"aria-label": n.card.title,
|
|
371
|
+
onSubmit: b(p, ["prevent"])
|
|
372
|
+
}, [
|
|
373
|
+
a("h3", G, h(n.card.title), 1),
|
|
374
|
+
(d(!0), i(e, null, m(l.value, (t) => (d(), i("fieldset", {
|
|
375
|
+
key: t.name,
|
|
376
|
+
class: "seer-missing-form__group",
|
|
377
|
+
disabled: n.disabled
|
|
378
|
+
}, [a("legend", q, h(t.name), 1), (d(!0), i(e, null, m(t.labels, (e) => (d(), i("label", {
|
|
379
|
+
key: e,
|
|
380
|
+
class: "seer-missing-form__field"
|
|
381
|
+
}, [a("span", J, h(e), 1), v(a("input", {
|
|
382
|
+
"onUpdate:modelValue": (t) => c[e] = t,
|
|
383
|
+
class: "seer-missing-form__input",
|
|
384
|
+
type: "text"
|
|
385
|
+
}, null, 8, Y), [[_, c[e]]])]))), 128))], 8, K))), 128)),
|
|
386
|
+
a("p", X, h(n.card.note), 1),
|
|
387
|
+
a("button", {
|
|
388
|
+
type: "submit",
|
|
389
|
+
class: "seer-missing-form__submit",
|
|
390
|
+
disabled: n.disabled || u.value.length === 0
|
|
391
|
+
}, h(n.card.action.label), 9, Z)
|
|
392
|
+
], 40, W));
|
|
393
|
+
}
|
|
394
|
+
}), $ = (e, t) => {
|
|
395
|
+
let n = e.__vccOpts || e;
|
|
396
|
+
for (let [e, r] of t) n[e] = r;
|
|
397
|
+
return n;
|
|
398
|
+
}, ne = /*#__PURE__*/ $(Q, [["__scopeId", "data-v-0316f2f7"]]), re = ["aria-label"], ie = { class: "seer-order-card__title" }, ae = { class: "seer-order-card__panel" }, oe = { class: "seer-order-card__channel" }, se = { class: "seer-order-card__rows" }, ce = { class: "seer-order-card__label" }, le = {
|
|
349
399
|
key: 0,
|
|
350
400
|
class: "seer-order-card__row"
|
|
351
|
-
},
|
|
401
|
+
}, ue = { class: "seer-order-card__label" }, de = { class: "seer-order-card__value" }, fe = {
|
|
352
402
|
key: 0,
|
|
353
403
|
class: "seer-order-card__subsidy"
|
|
354
|
-
},
|
|
404
|
+
}, pe = { class: "seer-order-card__total" }, me = ["title"], he = { class: "seer-order-card__total-value" }, ge = ["disabled"], _e = {
|
|
355
405
|
key: 2,
|
|
356
406
|
class: "seer-order-card__blocked",
|
|
357
407
|
role: "note"
|
|
358
|
-
},
|
|
408
|
+
}, ve = /*#__PURE__*/ $(/* @__PURE__ */ o({
|
|
359
409
|
__name: "SeerOrderCard",
|
|
360
410
|
props: {
|
|
361
411
|
card: {},
|
|
@@ -367,84 +417,80 @@ var W = ["aria-label"], G = { class: "seer-order-card__title" }, K = { class: "s
|
|
|
367
417
|
return (n, s) => (d(), i("section", {
|
|
368
418
|
class: "seer-order-card",
|
|
369
419
|
"aria-label": t.card.title
|
|
370
|
-
}, [a("h3",
|
|
371
|
-
a("h4",
|
|
372
|
-
a("dl",
|
|
420
|
+
}, [a("h3", ie, h(t.card.title), 1), a("div", ae, [
|
|
421
|
+
a("h4", oe, h(t.card.channel_name), 1),
|
|
422
|
+
a("dl", se, [(d(!0), i(e, null, m(t.card.rows, (e) => (d(), i("div", {
|
|
373
423
|
key: e.label,
|
|
374
424
|
class: "seer-order-card__row"
|
|
375
|
-
}, [a("dt",
|
|
376
|
-
t.card.subsidy ? (d(), i("div",
|
|
377
|
-
a("div",
|
|
425
|
+
}, [a("dt", ce, h(e.label), 1), a("dd", { class: l(["seer-order-card__value", { "seer-order-card__value--struck": e.struck }]) }, h(e.value), 3)]))), 128)), t.card.coupon ? (d(), i("div", le, [a("dt", ue, h(t.card.coupon.label), 1), a("dd", de, h(t.card.coupon.value), 1)])) : r("", !0)]),
|
|
426
|
+
t.card.subsidy ? (d(), i("div", fe, [a("strong", null, h(t.card.subsidy.label), 1), a("span", null, h(t.card.subsidy.value) + " = " + h(t.card.subsidy.detail), 1)])) : r("", !0),
|
|
427
|
+
a("div", pe, [a("span", {
|
|
378
428
|
class: "seer-order-card__label",
|
|
379
429
|
title: t.card.note
|
|
380
|
-
},
|
|
430
|
+
}, h(t.card.total.label), 9, me), a("span", he, h(t.card.total.value), 1)]),
|
|
381
431
|
t.card.action ? (d(), i("button", {
|
|
382
432
|
key: 1,
|
|
383
433
|
type: "button",
|
|
384
434
|
class: "seer-order-card__submit",
|
|
385
435
|
disabled: t.disabled,
|
|
386
436
|
onClick: s[0] ||= (e) => o("submit", t.card.action.message)
|
|
387
|
-
},
|
|
388
|
-
])], 8,
|
|
437
|
+
}, h(t.card.action.label), 9, ge)) : t.card.blocked_reason ? (d(), i("p", _e, h(t.card.blocked_reason), 1)) : r("", !0)
|
|
438
|
+
])], 8, re));
|
|
389
439
|
}
|
|
390
|
-
}),
|
|
391
|
-
let n = e.__vccOpts || e;
|
|
392
|
-
for (let [e, r] of t) n[e] = r;
|
|
393
|
-
return n;
|
|
394
|
-
}, ce = /*#__PURE__*/ se(oe, [["__scopeId", "data-v-17d9e82e"]]), le = {
|
|
440
|
+
}), [["__scopeId", "data-v-7db76bb0"]]), ye = {
|
|
395
441
|
class: "seer-chat",
|
|
396
442
|
"aria-label": "多发货 AI 客服聊天"
|
|
397
|
-
},
|
|
443
|
+
}, be = { class: "seer-chat__header" }, xe = {
|
|
398
444
|
class: "seer-chat__messages",
|
|
399
445
|
"aria-live": "polite"
|
|
400
|
-
},
|
|
446
|
+
}, Se = {
|
|
401
447
|
key: 0,
|
|
402
448
|
class: "seer-chat__empty"
|
|
403
|
-
},
|
|
449
|
+
}, Ce = { class: "seer-chat__role" }, we = { class: "seer-chat__body" }, Te = ["href"], Ee = ["aria-label", "onClick"], De = ["src", "alt"], Oe = {
|
|
404
450
|
key: 2,
|
|
405
451
|
class: "seer-chat__strong"
|
|
406
|
-
},
|
|
452
|
+
}, ke = {
|
|
407
453
|
key: 3,
|
|
408
454
|
class: "seer-chat__price"
|
|
409
|
-
},
|
|
455
|
+
}, Ae = {
|
|
410
456
|
key: 4,
|
|
411
457
|
class: "seer-chat__label-text"
|
|
412
|
-
},
|
|
458
|
+
}, je = { key: 5 }, Me = {
|
|
413
459
|
key: 0,
|
|
414
460
|
class: "seer-chat__status"
|
|
415
|
-
},
|
|
461
|
+
}, Ne = {
|
|
416
462
|
key: 1,
|
|
417
463
|
class: "seer-chat__error",
|
|
418
464
|
role: "alert"
|
|
419
|
-
},
|
|
465
|
+
}, Pe = {
|
|
420
466
|
key: 2,
|
|
421
467
|
class: "seer-chat__handoff"
|
|
422
|
-
},
|
|
468
|
+
}, Fe = {
|
|
423
469
|
key: 0,
|
|
424
470
|
class: "seer-chat__attachments",
|
|
425
471
|
"aria-label": "待发送的附件"
|
|
426
|
-
},
|
|
472
|
+
}, Ie = { class: "seer-chat__attachment-name" }, Le = ["aria-label", "onClick"], Re = [
|
|
427
473
|
"placeholder",
|
|
428
474
|
"disabled",
|
|
429
475
|
"onKeydown"
|
|
430
|
-
],
|
|
476
|
+
], ze = { class: "seer-chat__composer-footer" }, Be = {
|
|
431
477
|
class: "seer-chat__hint",
|
|
432
478
|
"aria-live": "polite"
|
|
433
|
-
},
|
|
479
|
+
}, Ve = ["disabled"], He = [
|
|
434
480
|
"disabled",
|
|
435
481
|
"aria-label",
|
|
436
482
|
"title"
|
|
437
|
-
],
|
|
483
|
+
], Ue = {
|
|
438
484
|
key: 0,
|
|
439
485
|
class: "seer-chat__stop-icon",
|
|
440
486
|
"aria-hidden": "true"
|
|
441
|
-
},
|
|
487
|
+
}, We = {
|
|
442
488
|
key: 1,
|
|
443
489
|
viewBox: "0 0 24 24",
|
|
444
490
|
width: "20",
|
|
445
491
|
height: "20",
|
|
446
492
|
"aria-hidden": "true"
|
|
447
|
-
},
|
|
493
|
+
}, Ge = ["disabled"], Ke = ["aria-label"], qe = ["src", "alt"], Je = ".xlsx,.xls,.csv,.png,.jpg,.jpeg,.webp,.pdf", Ye = /*#__PURE__*/ $(/* @__PURE__ */ o({
|
|
448
494
|
__name: "SeerChat",
|
|
449
495
|
props: {
|
|
450
496
|
endpoint: {},
|
|
@@ -472,7 +518,7 @@ var W = ["aria-label"], G = { class: "seer-order-card__title" }, K = { class: "s
|
|
|
472
518
|
maxRecordingSeconds: {}
|
|
473
519
|
},
|
|
474
520
|
setup(o) {
|
|
475
|
-
let s = o, c =
|
|
521
|
+
let s = o, c = Je.split(","), f = p(""), x = p(!1), S = p(!1), C = p(null), w = U({
|
|
476
522
|
endpoint: s.endpoint,
|
|
477
523
|
sessionEndpoint: s.sessionEndpoint,
|
|
478
524
|
transcriptionEndpoint: s.transcriptionEndpoint,
|
|
@@ -485,16 +531,16 @@ var W = ["aria-label"], G = { class: "seer-order-card__title" }, K = { class: "s
|
|
|
485
531
|
fetcher: s.fetcher,
|
|
486
532
|
voiceEnabled: s.voiceEnabled,
|
|
487
533
|
maxRecordingSeconds: s.maxRecordingSeconds
|
|
488
|
-
}), T =
|
|
489
|
-
async function
|
|
534
|
+
}), T = p(null), E = p(!1), D = p(null), O = t(() => (f.value.trim().length > 0 || w.attachments.value.length > 0) && !w.loading.value && !w.uploading.value && !x.value && !S.value);
|
|
535
|
+
async function ee(e) {
|
|
490
536
|
let t = e.target, n = Array.from(t.files ?? []);
|
|
491
537
|
t.value = "";
|
|
492
538
|
for (let e of n) await w.attach(e);
|
|
493
539
|
}
|
|
494
|
-
function
|
|
540
|
+
function k(e) {
|
|
495
541
|
w.uploadEnabled && e.dataTransfer?.types.includes("Files") && (e.preventDefault(), E.value = !0);
|
|
496
542
|
}
|
|
497
|
-
async function
|
|
543
|
+
async function te(e) {
|
|
498
544
|
E.value = !1;
|
|
499
545
|
let t = e.dataTransfer?.files?.[0];
|
|
500
546
|
if (!w.uploadEnabled || !t) return;
|
|
@@ -502,79 +548,79 @@ var W = ["aria-label"], G = { class: "seer-order-card__title" }, K = { class: "s
|
|
|
502
548
|
let n = t.name.slice(t.name.lastIndexOf(".")).toLowerCase();
|
|
503
549
|
c.includes(n) ? w.loading.value || w.uploading.value || await w.attach(t, { replace: !0 }) : D.value = "不支持这种文件,请拖入 Excel(xlsx / xls / csv)、图片或 PDF。";
|
|
504
550
|
}
|
|
505
|
-
let
|
|
506
|
-
function
|
|
507
|
-
e.key === "Escape" &&
|
|
551
|
+
let A = t(() => w.transcriptionEnabled && typeof navigator < "u" && typeof navigator.mediaDevices?.getUserMedia == "function" && typeof MediaRecorder < "u"), j = null, M = null, N = [], P, F = !1, I = p(null);
|
|
552
|
+
function R(e) {
|
|
553
|
+
e.key === "Escape" && V();
|
|
508
554
|
}
|
|
509
|
-
function
|
|
510
|
-
|
|
555
|
+
function z(e, t) {
|
|
556
|
+
I.value = {
|
|
511
557
|
src: e,
|
|
512
558
|
alt: t
|
|
513
|
-
}, window.addEventListener("keydown",
|
|
559
|
+
}, window.addEventListener("keydown", R);
|
|
514
560
|
}
|
|
515
|
-
function
|
|
516
|
-
|
|
561
|
+
function V() {
|
|
562
|
+
I.value = null, window.removeEventListener("keydown", R);
|
|
517
563
|
}
|
|
518
564
|
u(() => {
|
|
519
|
-
|
|
565
|
+
F = !0, window.removeEventListener("keydown", R), Z(), j && j.state !== "inactive" && (j.ondataavailable = null, j.onstop = null, j.onerror = null, j.stop()), Q();
|
|
520
566
|
});
|
|
521
|
-
async function
|
|
567
|
+
async function H() {
|
|
522
568
|
if (!O.value) return;
|
|
523
|
-
let e =
|
|
524
|
-
|
|
569
|
+
let e = f.value;
|
|
570
|
+
f.value = "", await w.send(e);
|
|
525
571
|
}
|
|
526
|
-
async function
|
|
527
|
-
x.value ?
|
|
572
|
+
async function W() {
|
|
573
|
+
x.value ? K() : await G();
|
|
528
574
|
}
|
|
529
|
-
async function
|
|
530
|
-
if (!(!
|
|
575
|
+
async function G() {
|
|
576
|
+
if (!(!A.value || S.value || w.loading.value)) {
|
|
531
577
|
C.value = null;
|
|
532
578
|
try {
|
|
533
|
-
if (
|
|
579
|
+
if (M = await navigator.mediaDevices.getUserMedia({
|
|
534
580
|
audio: {
|
|
535
581
|
echoCancellation: !0,
|
|
536
582
|
noiseSuppression: !0
|
|
537
583
|
},
|
|
538
584
|
video: !1
|
|
539
|
-
}),
|
|
540
|
-
|
|
585
|
+
}), F) {
|
|
586
|
+
Q();
|
|
541
587
|
return;
|
|
542
588
|
}
|
|
543
|
-
let e =
|
|
544
|
-
|
|
589
|
+
let e = J();
|
|
590
|
+
j = e ? new MediaRecorder(M, {
|
|
545
591
|
mimeType: e,
|
|
546
592
|
audioBitsPerSecond: 64e3
|
|
547
|
-
}) : new MediaRecorder(
|
|
548
|
-
e.data.size > 0 &&
|
|
549
|
-
},
|
|
550
|
-
|
|
551
|
-
},
|
|
552
|
-
C.value = "录音失败,请重试或用文字输入。", x.value = !1, S.value = !1,
|
|
553
|
-
},
|
|
593
|
+
}) : new MediaRecorder(M), N = [], j.ondataavailable = (e) => {
|
|
594
|
+
e.data.size > 0 && N.push(e.data);
|
|
595
|
+
}, j.onstop = () => {
|
|
596
|
+
q(j?.mimeType || e || "audio/webm");
|
|
597
|
+
}, j.onerror = () => {
|
|
598
|
+
C.value = "录音失败,请重试或用文字输入。", x.value = !1, S.value = !1, Z(), Q();
|
|
599
|
+
}, j.start(), x.value = !0, P = setTimeout(K, Math.max(1, w.maxRecordingSeconds) * 1e3);
|
|
554
600
|
} catch (e) {
|
|
555
|
-
C.value =
|
|
601
|
+
C.value = X(e), Q();
|
|
556
602
|
}
|
|
557
603
|
}
|
|
558
604
|
}
|
|
559
|
-
function
|
|
560
|
-
|
|
605
|
+
function K() {
|
|
606
|
+
j && j.state !== "inactive" && (x.value = !1, S.value = !0, Z(), j.stop());
|
|
561
607
|
}
|
|
562
|
-
async function
|
|
563
|
-
|
|
564
|
-
let t =
|
|
565
|
-
if (
|
|
608
|
+
async function q(e) {
|
|
609
|
+
Z(), Q();
|
|
610
|
+
let t = N;
|
|
611
|
+
if (N = [], j = null, F) return;
|
|
566
612
|
let n = new Blob(t, { type: e });
|
|
567
613
|
if (n.size === 0) C.value = "没有录到声音,请重试。", S.value = !1;
|
|
568
614
|
else try {
|
|
569
|
-
let t = await w.transcribe(n,
|
|
570
|
-
|
|
615
|
+
let t = await w.transcribe(n, Y(e));
|
|
616
|
+
f.value = f.value.trim() ? `${f.value.trim()} ${t.text}` : t.text;
|
|
571
617
|
} catch {
|
|
572
618
|
C.value = "语音识别失败,请重试或用文字输入。";
|
|
573
619
|
} finally {
|
|
574
620
|
S.value = !1;
|
|
575
621
|
}
|
|
576
622
|
}
|
|
577
|
-
function
|
|
623
|
+
function J() {
|
|
578
624
|
if (typeof MediaRecorder.isTypeSupported == "function") return [
|
|
579
625
|
"audio/webm;codecs=opus",
|
|
580
626
|
"audio/mp4",
|
|
@@ -582,106 +628,115 @@ var W = ["aria-label"], G = { class: "seer-order-card__title" }, K = { class: "s
|
|
|
582
628
|
"audio/webm"
|
|
583
629
|
].find((e) => MediaRecorder.isTypeSupported(e));
|
|
584
630
|
}
|
|
585
|
-
function
|
|
631
|
+
function Y(e) {
|
|
586
632
|
return `recording.${{
|
|
587
633
|
"audio/mp4": "m4a",
|
|
588
634
|
"audio/ogg": "ogg",
|
|
589
635
|
"audio/webm": "webm"
|
|
590
636
|
}[e.split(";", 1)[0].toLowerCase()] || "webm"}`;
|
|
591
637
|
}
|
|
592
|
-
function
|
|
638
|
+
function X(e) {
|
|
593
639
|
return e instanceof DOMException && e.name === "NotAllowedError" ? "请允许浏览器使用麦克风。" : e instanceof DOMException && e.name === "NotFoundError" ? "未检测到可用的麦克风。" : "无法启动麦克风,请重试或用文字输入。";
|
|
594
640
|
}
|
|
595
|
-
function
|
|
596
|
-
|
|
641
|
+
function Z() {
|
|
642
|
+
P !== void 0 && (clearTimeout(P), P = void 0);
|
|
597
643
|
}
|
|
598
|
-
function
|
|
599
|
-
|
|
644
|
+
function Q() {
|
|
645
|
+
M?.getTracks().forEach((e) => e.stop()), M = null;
|
|
600
646
|
}
|
|
601
|
-
return (t, s) => (d(), i("section",
|
|
602
|
-
a("header",
|
|
647
|
+
return (t, s) => (d(), i("section", ye, [
|
|
648
|
+
a("header", be, [a("div", null, [a("h2", null, h(o.title), 1), s[5] ||= a("p", null, "可咨询渠道报价、时效、下单资料、入仓和售后问题。", -1)]), a("button", {
|
|
603
649
|
type: "button",
|
|
604
650
|
class: "seer-chat__clear-button",
|
|
605
|
-
onClick: s[0] ||= (e) =>
|
|
651
|
+
onClick: s[0] ||= (e) => g(w).reset()
|
|
606
652
|
}, " 清空对话 ")]),
|
|
607
|
-
a("div",
|
|
653
|
+
a("div", xe, [g(w).messages.value.length === 0 ? (d(), i("p", Se, " 直接输入问题即可,复杂查单或赔付问题会提示转人工。 ")) : r("", !0), (d(!0), i(e, null, m(g(w).messages.value, (t, o) => (d(), i("article", {
|
|
608
654
|
key: `${t.role}-${o}`,
|
|
609
655
|
class: l(["seer-chat__message", `seer-chat__message--${t.role}`])
|
|
610
|
-
}, [a("span",
|
|
656
|
+
}, [a("span", Ce, h(t.role === "user" ? "你" : "AI 客服"), 1), a("div", we, [(d(!0), i(e, null, m(g(L)(g(B)(t.content, t.orderCard), { complete: !(g(w).loading.value && o === g(w).messages.value.length - 1) }), (t, n) => (d(), i("p", {
|
|
611
657
|
key: n,
|
|
612
658
|
class: "seer-chat__line"
|
|
613
|
-
}, [(d(!0), i(e, null,
|
|
659
|
+
}, [(d(!0), i(e, null, m(t, (t, n) => (d(), i(e, { key: n }, [t.kind === "link" ? (d(), i("a", {
|
|
614
660
|
key: 0,
|
|
615
661
|
class: "seer-chat__link",
|
|
616
662
|
href: t.href,
|
|
617
663
|
target: "_blank",
|
|
618
664
|
rel: "noopener noreferrer"
|
|
619
|
-
},
|
|
665
|
+
}, h(t.label), 9, Te)) : t.kind === "image" ? (d(), i("button", {
|
|
620
666
|
key: 1,
|
|
621
667
|
type: "button",
|
|
622
668
|
class: "seer-chat__image-button",
|
|
623
669
|
"aria-label": `放大查看${t.alt}`,
|
|
624
|
-
onClick: (e) =>
|
|
670
|
+
onClick: (e) => z(t.href, t.alt)
|
|
625
671
|
}, [a("img", {
|
|
626
672
|
class: "seer-chat__image",
|
|
627
673
|
src: t.href,
|
|
628
674
|
alt: t.alt,
|
|
629
675
|
loading: "lazy"
|
|
630
|
-
}, null, 8,
|
|
676
|
+
}, null, 8, De)], 8, Ee)) : t.kind === "strong" ? (d(), i("strong", Oe, h(t.value), 1)) : t.kind === "price" ? (d(), i("span", ke, h(t.value), 1)) : t.kind === "label" ? (d(), i("span", Ae, h(t.value), 1)) : (d(), i("span", je, h(t.value), 1))], 64))), 128))]))), 128)), t.orderCard?.type === "order_estimate" ? (d(), n(ve, {
|
|
631
677
|
key: 0,
|
|
632
678
|
card: t.orderCard,
|
|
633
|
-
disabled:
|
|
634
|
-
onSubmit:
|
|
679
|
+
disabled: g(w).loading.value || o !== g(w).messages.value.length - 1,
|
|
680
|
+
onSubmit: g(w).send
|
|
681
|
+
}, null, 8, [
|
|
682
|
+
"card",
|
|
683
|
+
"disabled",
|
|
684
|
+
"onSubmit"
|
|
685
|
+
])) : t.orderCard?.type === "order_missing" ? (d(), n(ne, {
|
|
686
|
+
key: 1,
|
|
687
|
+
card: t.orderCard,
|
|
688
|
+
disabled: g(w).loading.value || o !== g(w).messages.value.length - 1,
|
|
689
|
+
onSubmit: g(w).send
|
|
635
690
|
}, null, 8, [
|
|
636
691
|
"card",
|
|
637
692
|
"disabled",
|
|
638
693
|
"onSubmit"
|
|
639
694
|
])) : r("", !0)])], 2))), 128))]),
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
695
|
+
g(w).loading.value ? (d(), i("p", Me, "正在回复...")) : r("", !0),
|
|
696
|
+
g(w).error.value || C.value || D.value ? (d(), i("p", Ne, h(C.value || D.value || g(w).error.value), 1)) : r("", !0),
|
|
697
|
+
g(w).handoffRequested.value ? (d(), i("p", Pe, " 建议转人工:请留下联系方式或等待客服接入。 ")) : r("", !0),
|
|
643
698
|
a("form", {
|
|
644
699
|
class: l(["seer-chat__form", { "seer-chat__form--dragging": E.value }]),
|
|
645
|
-
onSubmit:
|
|
646
|
-
onDragover:
|
|
700
|
+
onSubmit: b(H, ["prevent"]),
|
|
701
|
+
onDragover: k,
|
|
647
702
|
onDragleave: s[4] ||= (e) => E.value = !1,
|
|
648
|
-
onDrop:
|
|
703
|
+
onDrop: te
|
|
649
704
|
}, [
|
|
650
705
|
s[9] ||= a("label", {
|
|
651
706
|
class: "seer-chat__label",
|
|
652
707
|
for: "seer-chat-input"
|
|
653
708
|
}, "问题", -1),
|
|
654
|
-
|
|
709
|
+
g(w).attachments.value.length > 0 ? (d(), i("ul", Fe, [(d(!0), i(e, null, m(g(w).attachments.value, (e) => (d(), i("li", {
|
|
655
710
|
key: e.fileId,
|
|
656
711
|
class: "seer-chat__attachment"
|
|
657
|
-
}, [a("span",
|
|
712
|
+
}, [a("span", Ie, h(e.filename), 1), a("button", {
|
|
658
713
|
type: "button",
|
|
659
714
|
class: "seer-chat__attachment-remove",
|
|
660
715
|
"aria-label": `移除附件${e.filename}`,
|
|
661
|
-
onClick: (t) =>
|
|
662
|
-
}, " × ", 8,
|
|
663
|
-
|
|
716
|
+
onClick: (t) => g(w).removeAttachment(e.fileId)
|
|
717
|
+
}, " × ", 8, Le)]))), 128))])) : r("", !0),
|
|
718
|
+
v(a("textarea", {
|
|
664
719
|
id: "seer-chat-input",
|
|
665
|
-
"onUpdate:modelValue": s[1] ||= (e) =>
|
|
720
|
+
"onUpdate:modelValue": s[1] ||= (e) => f.value = e,
|
|
666
721
|
placeholder: o.placeholder,
|
|
667
|
-
disabled:
|
|
722
|
+
disabled: g(w).loading.value || S.value,
|
|
668
723
|
rows: "3",
|
|
669
|
-
onKeydown:
|
|
670
|
-
}, null, 40,
|
|
671
|
-
a("div",
|
|
672
|
-
a("span",
|
|
673
|
-
|
|
724
|
+
onKeydown: y(b(H, ["exact", "prevent"]), ["enter"])
|
|
725
|
+
}, null, 40, Re), [[_, f.value]]),
|
|
726
|
+
a("div", ze, [
|
|
727
|
+
a("span", Be, h(x.value ? `正在录音,最长 ${g(w).maxRecordingSeconds} 秒` : S.value ? "正在识别语音..." : g(w).uploading.value ? "正在上传附件..." : E.value ? "松开即可上传(一次一个文件,会替换当前附件)" : "Enter 发送 · Shift+Enter 换行"), 1),
|
|
728
|
+
g(w).uploadEnabled ? (d(), i(e, { key: 0 }, [a("input", {
|
|
674
729
|
ref_key: "fileInput",
|
|
675
730
|
ref: T,
|
|
676
731
|
class: "seer-chat__file-input",
|
|
677
732
|
type: "file",
|
|
678
733
|
multiple: "",
|
|
679
|
-
accept:
|
|
680
|
-
onChange:
|
|
734
|
+
accept: Je,
|
|
735
|
+
onChange: ee
|
|
681
736
|
}, null, 544), a("button", {
|
|
682
737
|
type: "button",
|
|
683
738
|
class: "seer-chat__attach-button",
|
|
684
|
-
disabled:
|
|
739
|
+
disabled: g(w).loading.value || g(w).uploading.value,
|
|
685
740
|
"aria-label": "上传附件",
|
|
686
741
|
title: "上传下单模板、实物图片等",
|
|
687
742
|
onClick: s[2] ||= (e) => T.value?.click()
|
|
@@ -693,50 +748,50 @@ var W = ["aria-label"], G = { class: "seer-order-card__title" }, K = { class: "s
|
|
|
693
748
|
}, [a("path", {
|
|
694
749
|
fill: "currentColor",
|
|
695
750
|
d: "M16.5 6.5v10a4.5 4.5 0 0 1-9 0V5a3 3 0 0 1 6 0v10.5a1.5 1.5 0 0 1-3 0V6.5H9v9a3 3 0 0 0 6 0V5a4.5 4.5 0 0 0-9 0v11.5a6 6 0 0 0 12 0v-10h-1.5Z"
|
|
696
|
-
})], -1)]], 8,
|
|
697
|
-
|
|
751
|
+
})], -1)]], 8, Ve)], 64)) : r("", !0),
|
|
752
|
+
A.value ? (d(), i("button", {
|
|
698
753
|
key: 1,
|
|
699
754
|
type: "button",
|
|
700
755
|
class: l(["seer-chat__mic-button", { "seer-chat__mic-button--recording": x.value }]),
|
|
701
|
-
disabled: S.value ||
|
|
756
|
+
disabled: S.value || g(w).loading.value && !x.value,
|
|
702
757
|
"aria-label": x.value ? "停止录音" : "开始语音输入",
|
|
703
758
|
title: x.value ? "停止录音" : "语音输入",
|
|
704
|
-
onClick:
|
|
705
|
-
}, [x.value ? (d(), i("span",
|
|
759
|
+
onClick: W
|
|
760
|
+
}, [x.value ? (d(), i("span", Ue)) : (d(), i("svg", We, [...s[7] ||= [a("path", {
|
|
706
761
|
fill: "currentColor",
|
|
707
762
|
d: "M12 14a3 3 0 0 0 3-3V5a3 3 0 1 0-6 0v6a3 3 0 0 0 3 3Zm5-3a1 1 0 1 1 2 0 7 7 0 0 1-6 6.93V20h3a1 1 0 1 1 0 2H8a1 1 0 1 1 0-2h3v-2.07A7 7 0 0 1 5 11a1 1 0 1 1 2 0 5 5 0 0 0 10 0Z"
|
|
708
|
-
}, null, -1)]]))], 10,
|
|
709
|
-
|
|
763
|
+
}, null, -1)]]))], 10, He)) : r("", !0),
|
|
764
|
+
g(w).loading.value ? (d(), i("button", {
|
|
710
765
|
key: 2,
|
|
711
766
|
type: "button",
|
|
712
767
|
class: "seer-chat__stop-button",
|
|
713
|
-
onClick: s[3] ||= (e) =>
|
|
768
|
+
onClick: s[3] ||= (e) => g(w).abort()
|
|
714
769
|
}, " 停止 ")) : r("", !0),
|
|
715
770
|
a("button", {
|
|
716
771
|
class: "seer-chat__send-button",
|
|
717
772
|
type: "submit",
|
|
718
773
|
disabled: !O.value
|
|
719
|
-
}, [...s[8] ||= [a("span", null, "发送", -1), a("span", { "aria-hidden": "true" }, "↵", -1)]], 8,
|
|
774
|
+
}, [...s[8] ||= [a("span", null, "发送", -1), a("span", { "aria-hidden": "true" }, "↵", -1)]], 8, Ge)
|
|
720
775
|
])
|
|
721
776
|
], 34),
|
|
722
|
-
|
|
777
|
+
I.value ? (d(), i("div", {
|
|
723
778
|
key: 3,
|
|
724
779
|
class: "seer-chat__lightbox",
|
|
725
780
|
role: "dialog",
|
|
726
781
|
"aria-modal": "true",
|
|
727
|
-
"aria-label":
|
|
728
|
-
onClick:
|
|
782
|
+
"aria-label": I.value.alt,
|
|
783
|
+
onClick: V
|
|
729
784
|
}, [a("button", {
|
|
730
785
|
type: "button",
|
|
731
786
|
class: "seer-chat__lightbox-close",
|
|
732
787
|
"aria-label": "关闭",
|
|
733
|
-
onClick:
|
|
788
|
+
onClick: V
|
|
734
789
|
}, " × "), a("img", {
|
|
735
790
|
class: "seer-chat__lightbox-image",
|
|
736
|
-
src:
|
|
737
|
-
alt:
|
|
738
|
-
}, null, 8,
|
|
791
|
+
src: I.value.src,
|
|
792
|
+
alt: I.value.alt
|
|
793
|
+
}, null, 8, qe)], 8, Ke)) : r("", !0)
|
|
739
794
|
]));
|
|
740
795
|
}
|
|
741
|
-
}), [["__scopeId", "data-v-
|
|
742
|
-
export {
|
|
796
|
+
}), [["__scopeId", "data-v-f99281cd"]]);
|
|
797
|
+
export { Ye as SeerChat, H as SeerChatPlugin, ne as SeerMissingForm, ve as SeerOrderCard, x as createSeerClient, F as linkAnchorLabel, L as toContentLines, I as toContentSegments, U as useSeerChat, B as withoutCardText };
|
package/dist/useSeerChat.d.ts
CHANGED
|
@@ -43,6 +43,17 @@ export declare function useSeerChat(localOptions?: UseSeerChatOptions): {
|
|
|
43
43
|
message: string;
|
|
44
44
|
} | null;
|
|
45
45
|
blocked_reason: string;
|
|
46
|
+
} | {
|
|
47
|
+
type: "order_missing";
|
|
48
|
+
title: string;
|
|
49
|
+
fields: {
|
|
50
|
+
label: string;
|
|
51
|
+
group: string;
|
|
52
|
+
}[];
|
|
53
|
+
action: {
|
|
54
|
+
label: string;
|
|
55
|
+
};
|
|
56
|
+
note: string;
|
|
46
57
|
} | undefined;
|
|
47
58
|
}[], SeerChatMessage[] | {
|
|
48
59
|
role: import("./client").SeerChatRole;
|
|
@@ -83,6 +94,17 @@ export declare function useSeerChat(localOptions?: UseSeerChatOptions): {
|
|
|
83
94
|
message: string;
|
|
84
95
|
} | null;
|
|
85
96
|
blocked_reason: string;
|
|
97
|
+
} | {
|
|
98
|
+
type: "order_missing";
|
|
99
|
+
title: string;
|
|
100
|
+
fields: {
|
|
101
|
+
label: string;
|
|
102
|
+
group: string;
|
|
103
|
+
}[];
|
|
104
|
+
action: {
|
|
105
|
+
label: string;
|
|
106
|
+
};
|
|
107
|
+
note: string;
|
|
86
108
|
} | undefined;
|
|
87
109
|
}[]>;
|
|
88
110
|
loading: import("vue").Ref<boolean, boolean>;
|