@seer-ai/seer-vue 0.1.0-beta.12 → 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 +273 -204
- package/dist/useSeerChat.d.ts +25 -1
- 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-d821ceaf]{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-d821ceaf]{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-d821ceaf]{letter-spacing:-.03em;margin:0;font-size:22px}.seer-chat__header p[data-v-d821ceaf],.seer-chat__empty[data-v-d821ceaf],.seer-chat__status[data-v-d821ceaf]{color:#5f6f89;margin:4px 0 0;font-size:14px}.seer-chat__header p[data-v-d821ceaf]{color:#ffffffb8;max-width:34ch}.seer-chat__messages[data-v-d821ceaf]{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-d821ceaf]{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-d821ceaf]{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-d821ceaf]{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-d821ceaf]{opacity:.75;font-size:12px;font-weight:700}.seer-chat__body[data-v-d821ceaf]{flex-direction:column;display:flex}.seer-chat__line[data-v-d821ceaf]{white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.seer-chat__line[data-v-d821ceaf]:not(:last-child){margin-bottom:5px}.seer-chat__line[data-v-d821ceaf]:empty{height:7px}.seer-chat__strong[data-v-d821ceaf]{font-weight:700}.seer-chat__message--assistant .seer-chat__line[data-v-d821ceaf]:has(.seer-chat__label-text){color:#1d2129}.seer-chat__label-text[data-v-d821ceaf]{color:#4e5969;font-weight:700}.seer-chat__message--user .seer-chat__label-text[data-v-d821ceaf]{color:inherit}.seer-chat__price[data-v-d821ceaf]{color:#e0331d;font-weight:600}.seer-chat__message--user .seer-chat__price[data-v-d821ceaf]{color:#ffe2dc}.seer-chat__link[data-v-d821ceaf]{color:#1f5eff;text-underline-offset:2px;overflow-wrap:anywhere;font-weight:600;text-decoration:underline}.seer-chat__link[data-v-d821ceaf]:hover{color:#173fb3}.seer-chat__message--user .seer-chat__link[data-v-d821ceaf]{color:#fff}.seer-chat__image-button[data-v-d821ceaf]{cursor:zoom-in;background:0 0;border:0;padding:0;display:block}.seer-chat__image-button[data-v-d821ceaf]:not(:disabled):hover{transform:none}.seer-chat__image[data-v-d821ceaf]{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-d821ceaf]{filter:brightness(.96)}.seer-chat__lightbox[data-v-d821ceaf]{z-index:1000;cursor:zoom-out;background:#0a0f1ad1;place-items:center;padding:32px;animation:.14s seer-chat__fade-in-d821ceaf;display:grid;position:fixed;inset:0}.seer-chat__lightbox-image[data-v-d821ceaf]{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-d821ceaf]{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-d821ceaf]:not(:disabled):hover{background:#ffffff3d}@keyframes seer-chat__fade-in-d821ceaf{0%{opacity:0}to{opacity:1}}.seer-chat__error[data-v-d821ceaf],.seer-chat__handoff[data-v-d821ceaf]{border-radius:14px;margin:0 18px;padding:10px 12px}.seer-chat__error[data-v-d821ceaf]{color:#8a1f11;background:#fff0ed}.seer-chat__handoff[data-v-d821ceaf]{color:#704600;background:#fff7db}.seer-chat__form[data-v-d821ceaf]{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__label[data-v-d821ceaf]{font-size:13px;font-weight:700}.seer-chat textarea[data-v-d821ceaf]{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-d821ceaf]{color:inherit;cursor:pointer;border:0;font-weight:700;transition:transform .16s,box-shadow .16s,opacity .16s}.seer-chat button[data-v-d821ceaf]:not(:disabled):hover{transform:translateY(-1px)}.seer-chat button[data-v-d821ceaf]:disabled{cursor:not-allowed;opacity:.5}.seer-chat button[data-v-d821ceaf]:focus-visible,.seer-chat textarea[data-v-d821ceaf]:focus-visible{border-color:#1f5eff6b;box-shadow:0 0 0 4px #1f5eff21}.seer-chat__clear-button[data-v-d821ceaf]{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-d821ceaf]:not(:disabled):hover{color:#fff;box-shadow:none;background:#ffffff1a}.seer-chat__stop-button[data-v-d821ceaf]{color:#6c3b12;background:#fff1df;border-radius:12px;padding:8px 11px;font-size:12px}.seer-chat__mic-button[data-v-d821ceaf],.seer-chat__attach-button[data-v-d821ceaf]{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-d821ceaf]:not(:disabled):hover,.seer-chat__attach-button[data-v-d821ceaf]:not(:disabled):hover{background:#dfe8ff}.seer-chat__file-input[data-v-d821ceaf]{display:none}.seer-chat__attachments[data-v-d821ceaf]{flex-wrap:wrap;gap:6px;margin:0 0 8px;padding:0;list-style:none;display:flex}.seer-chat__attachment[data-v-d821ceaf]{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-d821ceaf]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.seer-chat__attachment-remove[data-v-d821ceaf]{color:#4b5878;background:0 0;border-radius:50%;width:20px;height:20px;padding:0;line-height:1}.seer-chat__attachment-remove[data-v-d821ceaf]:hover{background:#dfe8ff}.seer-chat__mic-button--recording[data-v-d821ceaf]{color:#fff;background:#d9342b;animation:1.4s ease-in-out infinite seer-chat__recording-pulse-d821ceaf;box-shadow:0 0 0 5px #d9342b24}.seer-chat__mic-button--recording[data-v-d821ceaf]:not(:disabled):hover{background:#bd271f}.seer-chat__stop-icon[data-v-d821ceaf]{background:currentColor;border-radius:3px;width:12px;height:12px}@keyframes seer-chat__recording-pulse-d821ceaf{50%{box-shadow:0 0 0 9px #d9342b14}}.seer-chat__send-button[data-v-d821ceaf]{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-d821ceaf]:not(:disabled):hover{box-shadow:0 14px 28px #1f5eff47}.seer-chat__hint[data-v-d821ceaf]{color:#7a879a;margin-right:auto;font-size:12px}.seer-chat__composer-footer[data-v-d821ceaf]{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,37 +242,38 @@ 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
|
-
let
|
|
275
|
-
_.value = [..._.value,
|
|
275
|
+
let n = await i.upload(e, e.name);
|
|
276
|
+
_.value = t.replace ? [n] : [..._.value, n];
|
|
276
277
|
} catch (e) {
|
|
277
278
|
l.value = e instanceof Error ? e.message : String(e);
|
|
278
279
|
} finally {
|
|
@@ -311,7 +312,7 @@ function W(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 W(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 W(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
|
|
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 G = ["aria-label"], K = { class: "seer-order-card__title" }, q = { 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
|
-
}, Q = /*#__PURE__*/ Z(le, [["__scopeId", "data-v-17d9e82e"]]), ue = {
|
|
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 G = ["aria-label"], K = { class: "seer-order-card__title" }, q = { class: "s
|
|
|
472
518
|
maxRecordingSeconds: {}
|
|
473
519
|
},
|
|
474
520
|
setup(o) {
|
|
475
|
-
let s = o, c = f(""),
|
|
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,85 +531,96 @@ var G = ["aria-label"], K = { class: "seer-order-card__title" }, q = { class: "s
|
|
|
485
531
|
fetcher: s.fetcher,
|
|
486
532
|
voiceEnabled: s.voiceEnabled,
|
|
487
533
|
maxRecordingSeconds: s.maxRecordingSeconds
|
|
488
|
-
}),
|
|
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
|
-
for (let e of n) await
|
|
538
|
+
for (let e of n) await w.attach(e);
|
|
539
|
+
}
|
|
540
|
+
function k(e) {
|
|
541
|
+
w.uploadEnabled && e.dataTransfer?.types.includes("Files") && (e.preventDefault(), E.value = !0);
|
|
493
542
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
543
|
+
async function te(e) {
|
|
544
|
+
E.value = !1;
|
|
545
|
+
let t = e.dataTransfer?.files?.[0];
|
|
546
|
+
if (!w.uploadEnabled || !t) return;
|
|
547
|
+
e.preventDefault(), D.value = null;
|
|
548
|
+
let n = t.name.slice(t.name.lastIndexOf(".")).toLowerCase();
|
|
549
|
+
c.includes(n) ? w.loading.value || w.uploading.value || await w.attach(t, { replace: !0 }) : D.value = "不支持这种文件,请拖入 Excel(xlsx / xls / csv)、图片或 PDF。";
|
|
497
550
|
}
|
|
498
|
-
function F
|
|
499
|
-
|
|
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();
|
|
554
|
+
}
|
|
555
|
+
function z(e, t) {
|
|
556
|
+
I.value = {
|
|
500
557
|
src: e,
|
|
501
558
|
alt: t
|
|
502
|
-
}, window.addEventListener("keydown",
|
|
559
|
+
}, window.addEventListener("keydown", R);
|
|
503
560
|
}
|
|
504
|
-
function
|
|
505
|
-
|
|
561
|
+
function V() {
|
|
562
|
+
I.value = null, window.removeEventListener("keydown", R);
|
|
506
563
|
}
|
|
507
564
|
u(() => {
|
|
508
|
-
|
|
565
|
+
F = !0, window.removeEventListener("keydown", R), Z(), j && j.state !== "inactive" && (j.ondataavailable = null, j.onstop = null, j.onerror = null, j.stop()), Q();
|
|
509
566
|
});
|
|
510
|
-
async function
|
|
511
|
-
if (!
|
|
512
|
-
let e =
|
|
513
|
-
|
|
567
|
+
async function H() {
|
|
568
|
+
if (!O.value) return;
|
|
569
|
+
let e = f.value;
|
|
570
|
+
f.value = "", await w.send(e);
|
|
514
571
|
}
|
|
515
|
-
async function
|
|
516
|
-
|
|
572
|
+
async function W() {
|
|
573
|
+
x.value ? K() : await G();
|
|
517
574
|
}
|
|
518
|
-
async function
|
|
519
|
-
if (!(!
|
|
520
|
-
|
|
575
|
+
async function G() {
|
|
576
|
+
if (!(!A.value || S.value || w.loading.value)) {
|
|
577
|
+
C.value = null;
|
|
521
578
|
try {
|
|
522
|
-
if (
|
|
579
|
+
if (M = await navigator.mediaDevices.getUserMedia({
|
|
523
580
|
audio: {
|
|
524
581
|
echoCancellation: !0,
|
|
525
582
|
noiseSuppression: !0
|
|
526
583
|
},
|
|
527
584
|
video: !1
|
|
528
|
-
}),
|
|
529
|
-
|
|
585
|
+
}), F) {
|
|
586
|
+
Q();
|
|
530
587
|
return;
|
|
531
588
|
}
|
|
532
|
-
let e =
|
|
533
|
-
|
|
589
|
+
let e = J();
|
|
590
|
+
j = e ? new MediaRecorder(M, {
|
|
534
591
|
mimeType: e,
|
|
535
592
|
audioBitsPerSecond: 64e3
|
|
536
|
-
}) : new MediaRecorder(
|
|
537
|
-
e.data.size > 0 &&
|
|
538
|
-
},
|
|
539
|
-
|
|
540
|
-
},
|
|
541
|
-
|
|
542
|
-
},
|
|
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);
|
|
543
600
|
} catch (e) {
|
|
544
|
-
|
|
601
|
+
C.value = X(e), Q();
|
|
545
602
|
}
|
|
546
603
|
}
|
|
547
604
|
}
|
|
548
|
-
function
|
|
549
|
-
|
|
605
|
+
function K() {
|
|
606
|
+
j && j.state !== "inactive" && (x.value = !1, S.value = !0, Z(), j.stop());
|
|
550
607
|
}
|
|
551
|
-
async function
|
|
552
|
-
|
|
553
|
-
let t =
|
|
554
|
-
if (
|
|
608
|
+
async function q(e) {
|
|
609
|
+
Z(), Q();
|
|
610
|
+
let t = N;
|
|
611
|
+
if (N = [], j = null, F) return;
|
|
555
612
|
let n = new Blob(t, { type: e });
|
|
556
|
-
if (n.size === 0)
|
|
613
|
+
if (n.size === 0) C.value = "没有录到声音,请重试。", S.value = !1;
|
|
557
614
|
else try {
|
|
558
|
-
let t = await
|
|
559
|
-
|
|
615
|
+
let t = await w.transcribe(n, Y(e));
|
|
616
|
+
f.value = f.value.trim() ? `${f.value.trim()} ${t.text}` : t.text;
|
|
560
617
|
} catch {
|
|
561
|
-
|
|
618
|
+
C.value = "语音识别失败,请重试或用文字输入。";
|
|
562
619
|
} finally {
|
|
563
|
-
|
|
620
|
+
S.value = !1;
|
|
564
621
|
}
|
|
565
622
|
}
|
|
566
|
-
function
|
|
623
|
+
function J() {
|
|
567
624
|
if (typeof MediaRecorder.isTypeSupported == "function") return [
|
|
568
625
|
"audio/webm;codecs=opus",
|
|
569
626
|
"audio/mp4",
|
|
@@ -571,107 +628,119 @@ var G = ["aria-label"], K = { class: "seer-order-card__title" }, q = { class: "s
|
|
|
571
628
|
"audio/webm"
|
|
572
629
|
].find((e) => MediaRecorder.isTypeSupported(e));
|
|
573
630
|
}
|
|
574
|
-
function
|
|
631
|
+
function Y(e) {
|
|
575
632
|
return `recording.${{
|
|
576
633
|
"audio/mp4": "m4a",
|
|
577
634
|
"audio/ogg": "ogg",
|
|
578
635
|
"audio/webm": "webm"
|
|
579
636
|
}[e.split(";", 1)[0].toLowerCase()] || "webm"}`;
|
|
580
637
|
}
|
|
581
|
-
function
|
|
638
|
+
function X(e) {
|
|
582
639
|
return e instanceof DOMException && e.name === "NotAllowedError" ? "请允许浏览器使用麦克风。" : e instanceof DOMException && e.name === "NotFoundError" ? "未检测到可用的麦克风。" : "无法启动麦克风,请重试或用文字输入。";
|
|
583
640
|
}
|
|
584
|
-
function
|
|
585
|
-
|
|
641
|
+
function Z() {
|
|
642
|
+
P !== void 0 && (clearTimeout(P), P = void 0);
|
|
586
643
|
}
|
|
587
|
-
function
|
|
588
|
-
|
|
644
|
+
function Q() {
|
|
645
|
+
M?.getTracks().forEach((e) => e.stop()), M = null;
|
|
589
646
|
}
|
|
590
|
-
return (t, s) => (d(), i("section",
|
|
591
|
-
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", {
|
|
592
649
|
type: "button",
|
|
593
650
|
class: "seer-chat__clear-button",
|
|
594
|
-
onClick: s[0] ||= (e) =>
|
|
651
|
+
onClick: s[0] ||= (e) => g(w).reset()
|
|
595
652
|
}, " 清空对话 ")]),
|
|
596
|
-
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", {
|
|
597
654
|
key: `${t.role}-${o}`,
|
|
598
655
|
class: l(["seer-chat__message", `seer-chat__message--${t.role}`])
|
|
599
|
-
}, [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", {
|
|
600
657
|
key: n,
|
|
601
658
|
class: "seer-chat__line"
|
|
602
|
-
}, [(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", {
|
|
603
660
|
key: 0,
|
|
604
661
|
class: "seer-chat__link",
|
|
605
662
|
href: t.href,
|
|
606
663
|
target: "_blank",
|
|
607
664
|
rel: "noopener noreferrer"
|
|
608
|
-
},
|
|
665
|
+
}, h(t.label), 9, Te)) : t.kind === "image" ? (d(), i("button", {
|
|
609
666
|
key: 1,
|
|
610
667
|
type: "button",
|
|
611
668
|
class: "seer-chat__image-button",
|
|
612
669
|
"aria-label": `放大查看${t.alt}`,
|
|
613
|
-
onClick: (e) =>
|
|
670
|
+
onClick: (e) => z(t.href, t.alt)
|
|
614
671
|
}, [a("img", {
|
|
615
672
|
class: "seer-chat__image",
|
|
616
673
|
src: t.href,
|
|
617
674
|
alt: t.alt,
|
|
618
675
|
loading: "lazy"
|
|
619
|
-
}, 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, {
|
|
620
677
|
key: 0,
|
|
621
678
|
card: t.orderCard,
|
|
622
|
-
disabled:
|
|
623
|
-
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
|
|
624
690
|
}, null, 8, [
|
|
625
691
|
"card",
|
|
626
692
|
"disabled",
|
|
627
693
|
"onSubmit"
|
|
628
694
|
])) : r("", !0)])], 2))), 128))]),
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
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),
|
|
632
698
|
a("form", {
|
|
633
|
-
class: "seer-chat__form",
|
|
634
|
-
onSubmit:
|
|
699
|
+
class: l(["seer-chat__form", { "seer-chat__form--dragging": E.value }]),
|
|
700
|
+
onSubmit: b(H, ["prevent"]),
|
|
701
|
+
onDragover: k,
|
|
702
|
+
onDragleave: s[4] ||= (e) => E.value = !1,
|
|
703
|
+
onDrop: te
|
|
635
704
|
}, [
|
|
636
|
-
s[
|
|
705
|
+
s[9] ||= a("label", {
|
|
637
706
|
class: "seer-chat__label",
|
|
638
707
|
for: "seer-chat-input"
|
|
639
708
|
}, "问题", -1),
|
|
640
|
-
|
|
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", {
|
|
641
710
|
key: e.fileId,
|
|
642
711
|
class: "seer-chat__attachment"
|
|
643
|
-
}, [a("span",
|
|
712
|
+
}, [a("span", Ie, h(e.filename), 1), a("button", {
|
|
644
713
|
type: "button",
|
|
645
714
|
class: "seer-chat__attachment-remove",
|
|
646
715
|
"aria-label": `移除附件${e.filename}`,
|
|
647
|
-
onClick: (t) =>
|
|
648
|
-
}, " × ", 8,
|
|
649
|
-
|
|
716
|
+
onClick: (t) => g(w).removeAttachment(e.fileId)
|
|
717
|
+
}, " × ", 8, Le)]))), 128))])) : r("", !0),
|
|
718
|
+
v(a("textarea", {
|
|
650
719
|
id: "seer-chat-input",
|
|
651
|
-
"onUpdate:modelValue": s[1] ||= (e) =>
|
|
720
|
+
"onUpdate:modelValue": s[1] ||= (e) => f.value = e,
|
|
652
721
|
placeholder: o.placeholder,
|
|
653
|
-
disabled:
|
|
722
|
+
disabled: g(w).loading.value || S.value,
|
|
654
723
|
rows: "3",
|
|
655
|
-
onKeydown:
|
|
656
|
-
}, null, 40,
|
|
657
|
-
a("div",
|
|
658
|
-
a("span",
|
|
659
|
-
|
|
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", {
|
|
660
729
|
ref_key: "fileInput",
|
|
661
|
-
ref:
|
|
730
|
+
ref: T,
|
|
662
731
|
class: "seer-chat__file-input",
|
|
663
732
|
type: "file",
|
|
664
733
|
multiple: "",
|
|
665
|
-
accept:
|
|
666
|
-
onChange:
|
|
734
|
+
accept: Je,
|
|
735
|
+
onChange: ee
|
|
667
736
|
}, null, 544), a("button", {
|
|
668
737
|
type: "button",
|
|
669
738
|
class: "seer-chat__attach-button",
|
|
670
|
-
disabled:
|
|
739
|
+
disabled: g(w).loading.value || g(w).uploading.value,
|
|
671
740
|
"aria-label": "上传附件",
|
|
672
741
|
title: "上传下单模板、实物图片等",
|
|
673
|
-
onClick: s[2] ||= (e) =>
|
|
674
|
-
}, [...s[
|
|
742
|
+
onClick: s[2] ||= (e) => T.value?.click()
|
|
743
|
+
}, [...s[6] ||= [a("svg", {
|
|
675
744
|
viewBox: "0 0 24 24",
|
|
676
745
|
width: "20",
|
|
677
746
|
height: "20",
|
|
@@ -679,50 +748,50 @@ var G = ["aria-label"], K = { class: "seer-order-card__title" }, q = { class: "s
|
|
|
679
748
|
}, [a("path", {
|
|
680
749
|
fill: "currentColor",
|
|
681
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"
|
|
682
|
-
})], -1)]], 8,
|
|
683
|
-
|
|
751
|
+
})], -1)]], 8, Ve)], 64)) : r("", !0),
|
|
752
|
+
A.value ? (d(), i("button", {
|
|
684
753
|
key: 1,
|
|
685
754
|
type: "button",
|
|
686
|
-
class: l(["seer-chat__mic-button", { "seer-chat__mic-button--recording":
|
|
687
|
-
disabled:
|
|
688
|
-
"aria-label":
|
|
689
|
-
title:
|
|
690
|
-
onClick:
|
|
691
|
-
}, [
|
|
755
|
+
class: l(["seer-chat__mic-button", { "seer-chat__mic-button--recording": x.value }]),
|
|
756
|
+
disabled: S.value || g(w).loading.value && !x.value,
|
|
757
|
+
"aria-label": x.value ? "停止录音" : "开始语音输入",
|
|
758
|
+
title: x.value ? "停止录音" : "语音输入",
|
|
759
|
+
onClick: W
|
|
760
|
+
}, [x.value ? (d(), i("span", Ue)) : (d(), i("svg", We, [...s[7] ||= [a("path", {
|
|
692
761
|
fill: "currentColor",
|
|
693
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"
|
|
694
|
-
}, null, -1)]]))], 10,
|
|
695
|
-
|
|
763
|
+
}, null, -1)]]))], 10, He)) : r("", !0),
|
|
764
|
+
g(w).loading.value ? (d(), i("button", {
|
|
696
765
|
key: 2,
|
|
697
766
|
type: "button",
|
|
698
767
|
class: "seer-chat__stop-button",
|
|
699
|
-
onClick: s[3] ||= (e) =>
|
|
768
|
+
onClick: s[3] ||= (e) => g(w).abort()
|
|
700
769
|
}, " 停止 ")) : r("", !0),
|
|
701
770
|
a("button", {
|
|
702
771
|
class: "seer-chat__send-button",
|
|
703
772
|
type: "submit",
|
|
704
|
-
disabled: !
|
|
705
|
-
}, [...s[
|
|
773
|
+
disabled: !O.value
|
|
774
|
+
}, [...s[8] ||= [a("span", null, "发送", -1), a("span", { "aria-hidden": "true" }, "↵", -1)]], 8, Ge)
|
|
706
775
|
])
|
|
707
|
-
],
|
|
708
|
-
|
|
776
|
+
], 34),
|
|
777
|
+
I.value ? (d(), i("div", {
|
|
709
778
|
key: 3,
|
|
710
779
|
class: "seer-chat__lightbox",
|
|
711
780
|
role: "dialog",
|
|
712
781
|
"aria-modal": "true",
|
|
713
|
-
"aria-label":
|
|
714
|
-
onClick:
|
|
782
|
+
"aria-label": I.value.alt,
|
|
783
|
+
onClick: V
|
|
715
784
|
}, [a("button", {
|
|
716
785
|
type: "button",
|
|
717
786
|
class: "seer-chat__lightbox-close",
|
|
718
787
|
"aria-label": "关闭",
|
|
719
|
-
onClick:
|
|
788
|
+
onClick: V
|
|
720
789
|
}, " × "), a("img", {
|
|
721
790
|
class: "seer-chat__lightbox-image",
|
|
722
|
-
src:
|
|
723
|
-
alt:
|
|
724
|
-
}, null, 8,
|
|
791
|
+
src: I.value.src,
|
|
792
|
+
alt: I.value.alt
|
|
793
|
+
}, null, 8, qe)], 8, Ke)) : r("", !0)
|
|
725
794
|
]));
|
|
726
795
|
}
|
|
727
|
-
}), [["__scopeId", "data-v-
|
|
728
|
-
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>;
|
|
@@ -108,7 +130,9 @@ export declare function useSeerChat(localOptions?: UseSeerChatOptions): {
|
|
|
108
130
|
size: number;
|
|
109
131
|
}[]>;
|
|
110
132
|
uploading: import("vue").Ref<boolean, boolean>;
|
|
111
|
-
attach: (file: File
|
|
133
|
+
attach: (file: File, attachOptions?: {
|
|
134
|
+
replace?: boolean;
|
|
135
|
+
}) => Promise<void>;
|
|
112
136
|
removeAttachment: (fileId: string) => void;
|
|
113
137
|
send: (content: string) => Promise<void>;
|
|
114
138
|
reset: () => void;
|