@lambforge/agent-chat 0.0.6 → 0.0.7
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/README.md +9 -0
- package/dist/agent-chat.js +83 -35
- package/dist/agent-chat.js.map +4 -4
- package/dist/index.cjs +163 -15
- package/dist/index.cjs.map +4 -4
- package/dist/index.mjs +160 -12
- package/dist/index.mjs.map +4 -4
- package/package.json +3 -3
- package/types/index.d.ts +11 -0
package/dist/index.mjs
CHANGED
|
@@ -2430,7 +2430,7 @@ var require_dist3 = __commonJS({
|
|
|
2430
2430
|
// src/element.ts
|
|
2431
2431
|
var import_component = __toESM(require_dist3());
|
|
2432
2432
|
var import_lit_html19 = __toESM(require_dist());
|
|
2433
|
-
import { AgentClient } from "@lambforge/agents";
|
|
2433
|
+
import { ACCEPTED_ATTACHMENT_TYPES, AgentClient } from "@lambforge/agents";
|
|
2434
2434
|
import { defer } from "rxjs";
|
|
2435
2435
|
import { finalize } from "rxjs/operators";
|
|
2436
2436
|
|
|
@@ -2626,7 +2626,12 @@ var historyLoaded = action(
|
|
|
2626
2626
|
payload()
|
|
2627
2627
|
);
|
|
2628
2628
|
var newConversation = action("[chat] new conversation");
|
|
2629
|
-
var sendMessage = action(
|
|
2629
|
+
var sendMessage = action(
|
|
2630
|
+
"[chat] send",
|
|
2631
|
+
payload()
|
|
2632
|
+
);
|
|
2633
|
+
var addFiles = action("[chat] add files", payload());
|
|
2634
|
+
var removeFile = action("[chat] remove file", payload());
|
|
2630
2635
|
var resume = action(
|
|
2631
2636
|
"[chat] resume",
|
|
2632
2637
|
payload()
|
|
@@ -2943,9 +2948,14 @@ var ChatEffects = class {
|
|
|
2943
2948
|
action$.pipe(
|
|
2944
2949
|
ofType(sendMessage),
|
|
2945
2950
|
map3(({ payload: payload2 }) => {
|
|
2946
|
-
const { agentId, conversationId, text } = payload2;
|
|
2951
|
+
const { agentId, conversationId, text, files } = payload2;
|
|
2947
2952
|
const c9 = this.conversation(agentId, conversationId);
|
|
2948
|
-
|
|
2953
|
+
const attachments = (files ?? []).map((file) => ({
|
|
2954
|
+
name: file.name,
|
|
2955
|
+
mimeType: file.type || void 0,
|
|
2956
|
+
data: file
|
|
2957
|
+
}));
|
|
2958
|
+
return { c: c9, events: attachments.length ? c9.send(text, { attachments }) : c9.send(text) };
|
|
2949
2959
|
})
|
|
2950
2960
|
),
|
|
2951
2961
|
action$.pipe(
|
|
@@ -3008,6 +3018,9 @@ var ChatEffects = class {
|
|
|
3008
3018
|
}
|
|
3009
3019
|
};
|
|
3010
3020
|
|
|
3021
|
+
// src/store/chat-reducer.ts
|
|
3022
|
+
import { attachmentsProblem } from "@lambforge/agents";
|
|
3023
|
+
|
|
3011
3024
|
// src/store/chat-state.ts
|
|
3012
3025
|
var initialChatState = {
|
|
3013
3026
|
shown: false,
|
|
@@ -3017,16 +3030,30 @@ var initialChatState = {
|
|
|
3017
3030
|
messages: [],
|
|
3018
3031
|
answering: false,
|
|
3019
3032
|
live: null,
|
|
3020
|
-
notice: null
|
|
3033
|
+
notice: null,
|
|
3034
|
+
files: []
|
|
3021
3035
|
};
|
|
3022
3036
|
function toMessage(m4) {
|
|
3023
3037
|
const tools = (m4.toolCalls ?? []).map((c9) => c9?.name).filter((n11) => !!n11);
|
|
3024
|
-
return {
|
|
3038
|
+
return {
|
|
3039
|
+
id: m4.id,
|
|
3040
|
+
role: m4.role,
|
|
3041
|
+
text: m4.text ?? "",
|
|
3042
|
+
tools: Array.from(new Set(tools)),
|
|
3043
|
+
attachments: (m4.attachments ?? []).map((a5) => a5.name)
|
|
3044
|
+
};
|
|
3025
3045
|
}
|
|
3026
3046
|
|
|
3027
3047
|
// src/store/chat-reducer.ts
|
|
3028
3048
|
var LOCAL_ID = /^local:/;
|
|
3029
|
-
var empty = {
|
|
3049
|
+
var empty = {
|
|
3050
|
+
conversationId: null,
|
|
3051
|
+
messages: [],
|
|
3052
|
+
answering: false,
|
|
3053
|
+
live: null,
|
|
3054
|
+
notice: null,
|
|
3055
|
+
files: []
|
|
3056
|
+
};
|
|
3030
3057
|
var chatReducer = reducer(
|
|
3031
3058
|
initialChatState,
|
|
3032
3059
|
on(shown, (s9, { payload: payload2 }) => s9.shown || !payload2 ? s9 : { ...s9, shown: true }),
|
|
@@ -3065,11 +3092,31 @@ var chatReducer = reducer(
|
|
|
3065
3092
|
// shown at once; replaced by the stored copy when it arrives
|
|
3066
3093
|
messages: [
|
|
3067
3094
|
...s9.messages,
|
|
3068
|
-
{
|
|
3095
|
+
{
|
|
3096
|
+
id: `local:${s9.messages.length}`,
|
|
3097
|
+
role: "user",
|
|
3098
|
+
text: payload2.text,
|
|
3099
|
+
tools: [],
|
|
3100
|
+
attachments: (payload2.files ?? []).map((f4) => f4.name)
|
|
3101
|
+
}
|
|
3069
3102
|
],
|
|
3103
|
+
files: [],
|
|
3070
3104
|
answering: true,
|
|
3071
3105
|
notice: { kind: "busy", what: "thinking" }
|
|
3072
3106
|
})),
|
|
3107
|
+
on(addFiles, (s9, { payload: payload2 }) => {
|
|
3108
|
+
const agent = s9.agents.find((a5) => a5.id === s9.agentId);
|
|
3109
|
+
if (!agent?.allowAttachments) return { ...s9, notice: { kind: "error", code: "attachments-off" } };
|
|
3110
|
+
const files = [...s9.files, ...payload2];
|
|
3111
|
+
const problem = attachmentsProblem(files);
|
|
3112
|
+
if (problem) return { ...s9, notice: { kind: "error", code: problem } };
|
|
3113
|
+
return { ...s9, files, notice: s9.notice?.kind === "error" ? null : s9.notice };
|
|
3114
|
+
}),
|
|
3115
|
+
on(removeFile, (s9, { payload: payload2 }) => ({
|
|
3116
|
+
...s9,
|
|
3117
|
+
files: s9.files.filter((_2, i12) => i12 !== payload2),
|
|
3118
|
+
notice: s9.notice?.kind === "error" ? null : s9.notice
|
|
3119
|
+
})),
|
|
3073
3120
|
on(agentEvent, (s9, { payload: payload2 }) => withEvent(s9, payload2)),
|
|
3074
3121
|
on(runEnded, (s9) => ({
|
|
3075
3122
|
...s9,
|
|
@@ -3158,6 +3205,10 @@ var en = {
|
|
|
3158
3205
|
pickAgent: "Assistant",
|
|
3159
3206
|
usedTools: "Used",
|
|
3160
3207
|
verifying: "Checking that you are human",
|
|
3208
|
+
attach: "Attach files",
|
|
3209
|
+
attached: "Attached files",
|
|
3210
|
+
removeFile: "Remove",
|
|
3211
|
+
filesOnly: "Please look at the attached files.",
|
|
3161
3212
|
errors: {
|
|
3162
3213
|
"limit-reached": "This conversation is full - start a new one.",
|
|
3163
3214
|
"cap-reached": "The assistant is not available right now - try again later.",
|
|
@@ -3169,6 +3220,13 @@ var en = {
|
|
|
3169
3220
|
unauthorized: "This chat is not allowed here.",
|
|
3170
3221
|
"bad-request": "That did not work - try again.",
|
|
3171
3222
|
network: "No connection - try again.",
|
|
3223
|
+
"attachments-off": "This assistant does not take files.",
|
|
3224
|
+
"attachments-unsupported": "This assistant cannot read that kind of file.",
|
|
3225
|
+
"attachment-invalid": "Only images, PDF and text files can be attached.",
|
|
3226
|
+
"attachment-too-large": "That file is too large (images 5 MB, PDF 10 MB, text 1 MB).",
|
|
3227
|
+
"attachment-limit": "At most 5 files and 15 MB in one message.",
|
|
3228
|
+
"attachment-missing": "A file was lost - attach it again.",
|
|
3229
|
+
"attachment-not-uploaded": "A file did not finish uploading - attach it again.",
|
|
3172
3230
|
default: "Something went wrong - try again."
|
|
3173
3231
|
}
|
|
3174
3232
|
};
|
|
@@ -3185,6 +3243,10 @@ var bg = {
|
|
|
3185
3243
|
pickAgent: "\u0410\u0441\u0438\u0441\u0442\u0435\u043D\u0442",
|
|
3186
3244
|
usedTools: "\u0418\u0437\u043F\u043E\u043B\u0437\u0432\u0430\u043D\u043E",
|
|
3187
3245
|
verifying: "\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430, \u0447\u0435 \u0441\u0442\u0435 \u0447\u043E\u0432\u0435\u043A",
|
|
3246
|
+
attach: "\u041F\u0440\u0438\u043A\u0430\u0447\u0438 \u0444\u0430\u0439\u043B\u043E\u0432\u0435",
|
|
3247
|
+
attached: "\u041F\u0440\u0438\u043A\u0430\u0447\u0435\u043D\u0438 \u0444\u0430\u0439\u043B\u043E\u0432\u0435",
|
|
3248
|
+
removeFile: "\u041F\u0440\u0435\u043C\u0430\u0445\u043D\u0438",
|
|
3249
|
+
filesOnly: "\u041C\u043E\u043B\u044F, \u0440\u0430\u0437\u0433\u043B\u0435\u0434\u0430\u0439\u0442\u0435 \u043F\u0440\u0438\u043A\u0430\u0447\u0435\u043D\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u043E\u0432\u0435.",
|
|
3188
3250
|
errors: {
|
|
3189
3251
|
"limit-reached": "\u0420\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u044A\u0442 \u0435 \u043F\u044A\u043B\u0435\u043D - \u0437\u0430\u043F\u043E\u0447\u043D\u0435\u0442\u0435 \u043D\u043E\u0432.",
|
|
3190
3252
|
"cap-reached": "\u0410\u0441\u0438\u0441\u0442\u0435\u043D\u0442\u044A\u0442 \u043D\u0435 \u0435 \u0434\u043E\u0441\u0442\u044A\u043F\u0435\u043D \u0432 \u043C\u043E\u043C\u0435\u043D\u0442\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043F\u043E-\u043A\u044A\u0441\u043D\u043E.",
|
|
@@ -3196,6 +3258,13 @@ var bg = {
|
|
|
3196
3258
|
unauthorized: "\u0422\u043E\u0437\u0438 \u0447\u0430\u0442 \u043D\u0435 \u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D \u0442\u0443\u043A.",
|
|
3197
3259
|
"bad-request": "\u041D\u0435 \u0441\u0435 \u043F\u043E\u043B\u0443\u0447\u0438 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",
|
|
3198
3260
|
network: "\u041D\u044F\u043C\u0430 \u0432\u0440\u044A\u0437\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",
|
|
3261
|
+
"attachments-off": "\u0422\u043E\u0437\u0438 \u0430\u0441\u0438\u0441\u0442\u0435\u043D\u0442 \u043D\u0435 \u043F\u0440\u0438\u0435\u043C\u0430 \u0444\u0430\u0439\u043B\u043E\u0432\u0435.",
|
|
3262
|
+
"attachments-unsupported": "\u0422\u043E\u0437\u0438 \u0430\u0441\u0438\u0441\u0442\u0435\u043D\u0442 \u043D\u0435 \u043C\u043E\u0436\u0435 \u0434\u0430 \u0447\u0435\u0442\u0435 \u0442\u0430\u043A\u044A\u0432 \u0444\u0430\u0439\u043B.",
|
|
3263
|
+
"attachment-invalid": "\u041C\u043E\u0436\u0435 \u0434\u0430 \u043F\u0440\u0438\u043A\u0430\u0447\u0438\u0442\u0435 \u0441\u0430\u043C\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F, PDF \u0438 \u0442\u0435\u043A\u0441\u0442\u043E\u0432\u0438 \u0444\u0430\u0439\u043B\u043E\u0432\u0435.",
|
|
3264
|
+
"attachment-too-large": "\u0424\u0430\u0439\u043B\u044A\u0442 \u0435 \u0442\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C (\u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F 5 MB, PDF 10 MB, \u0442\u0435\u043A\u0441\u0442 1 MB).",
|
|
3265
|
+
"attachment-limit": "\u041D\u0430\u0439-\u043C\u043D\u043E\u0433\u043E 5 \u0444\u0430\u0439\u043B\u0430 \u0438 15 MB \u0432 \u0435\u0434\u043D\u043E \u0441\u044A\u043E\u0431\u0449\u0435\u043D\u0438\u0435.",
|
|
3266
|
+
"attachment-missing": "\u0424\u0430\u0439\u043B \u0441\u0435 \u0438\u0437\u0433\u0443\u0431\u0438 - \u043F\u0440\u0438\u043A\u0430\u0447\u0435\u0442\u0435 \u0433\u043E \u043E\u0442\u043D\u043E\u0432\u043E.",
|
|
3267
|
+
"attachment-not-uploaded": "\u0424\u0430\u0439\u043B \u043D\u0435 \u0441\u0435 \u043A\u0430\u0447\u0438 \u0434\u043E\u043A\u0440\u0430\u0439 - \u043F\u0440\u0438\u043A\u0430\u0447\u0435\u0442\u0435 \u0433\u043E \u043E\u0442\u043D\u043E\u0432\u043E.",
|
|
3199
3268
|
default: "\u041D\u0435\u0449\u043E \u0441\u0435 \u043E\u0431\u044A\u0440\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E."
|
|
3200
3269
|
}
|
|
3201
3270
|
};
|
|
@@ -3384,6 +3453,26 @@ textarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; b
|
|
|
3384
3453
|
padding: 0 14px; height: 40px; font-weight: 600;
|
|
3385
3454
|
}
|
|
3386
3455
|
.send:disabled { opacity: 0.5; cursor: default; }
|
|
3456
|
+
.attach { flex: none; height: 40px; }
|
|
3457
|
+
.attach:disabled { opacity: 0.5; cursor: default; }
|
|
3458
|
+
.files {
|
|
3459
|
+
list-style: none; margin: 0; padding: 8px 12px 0; display: flex; flex-wrap: wrap; gap: 6px;
|
|
3460
|
+
border-top: 1px solid var(--_border);
|
|
3461
|
+
}
|
|
3462
|
+
.file {
|
|
3463
|
+
display: inline-flex; align-items: center; gap: 2px; max-width: 100%;
|
|
3464
|
+
border: 1px solid var(--_border); border-radius: 999px; padding: 2px 2px 2px 10px; font-size: 13px;
|
|
3465
|
+
}
|
|
3466
|
+
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
|
|
3467
|
+
.file-remove {
|
|
3468
|
+
border: 0; background: transparent; color: var(--_muted); width: 22px; height: 22px;
|
|
3469
|
+
border-radius: 999px; display: grid; place-items: center; padding: 0;
|
|
3470
|
+
}
|
|
3471
|
+
.file-remove:hover, .file-remove:focus-visible { background: var(--_bot-bg); color: var(--_fg); }
|
|
3472
|
+
.file-remove svg { width: 14px; height: 14px; }
|
|
3473
|
+
.files + form { border-top: 0; }
|
|
3474
|
+
.msg-files { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
|
|
3475
|
+
.msg-file { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,0.2); }
|
|
3387
3476
|
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
3388
3477
|
`;
|
|
3389
3478
|
|
|
@@ -3472,6 +3561,8 @@ var TAG = "lambforge-agent-chat";
|
|
|
3472
3561
|
var ICON_CHAT = import_lit_html19.svg`<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>`;
|
|
3473
3562
|
var ICON_CLOSE = import_lit_html19.svg`<path d="M18 6 6 18M6 6l12 12"/>`;
|
|
3474
3563
|
var ICON_NEW = import_lit_html19.svg`<path d="M12 5v14M5 12h14"/>`;
|
|
3564
|
+
var ICON_ATTACH = import_lit_html19.svg`<path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/>`;
|
|
3565
|
+
var ACCEPT = [...ACCEPTED_ATTACHMENT_TYPES, ".md", ".csv", ".yaml", ".yml", ".json", ".txt"].join(",");
|
|
3475
3566
|
var icon = (paths) => import_lit_html19.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${paths}</svg>`;
|
|
3476
3567
|
var LambforgeAgentChat = class extends import_lit_html19.LitElement {
|
|
3477
3568
|
constructor() {
|
|
@@ -3581,16 +3672,36 @@ var LambforgeAgentChat = class extends import_lit_html19.LitElement {
|
|
|
3581
3672
|
throw new Error("turnstile: the chat is not rendered");
|
|
3582
3673
|
}
|
|
3583
3674
|
// ------------------------------------------------------------ actions
|
|
3584
|
-
/** Send a message to the selected agent. */
|
|
3675
|
+
/** Send a message (with the picked files) to the selected agent. */
|
|
3585
3676
|
send(text) {
|
|
3586
3677
|
return ([state]) => {
|
|
3587
|
-
const
|
|
3678
|
+
const files = state.files;
|
|
3679
|
+
const clean = String(text ?? "").trim() || (files.length ? this.t.filesOnly : "");
|
|
3588
3680
|
if (!clean || state.answering || !state.agentId) return;
|
|
3589
3681
|
this.dispatch(
|
|
3590
|
-
sendMessage({
|
|
3682
|
+
sendMessage({
|
|
3683
|
+
agentId: state.agentId,
|
|
3684
|
+
conversationId: state.conversationId,
|
|
3685
|
+
text: clean,
|
|
3686
|
+
...files.length ? { files } : {}
|
|
3687
|
+
})
|
|
3591
3688
|
);
|
|
3592
3689
|
};
|
|
3593
3690
|
}
|
|
3691
|
+
/** Files for the next message (the reducer refuses what the API would). */
|
|
3692
|
+
attach(files) {
|
|
3693
|
+
const list = Array.from(files ?? []);
|
|
3694
|
+
if (list.length) this.dispatch(addFiles(list));
|
|
3695
|
+
}
|
|
3696
|
+
detach(index) {
|
|
3697
|
+
this.dispatch(removeFile(index));
|
|
3698
|
+
}
|
|
3699
|
+
onPaste(ev, allowed) {
|
|
3700
|
+
const files = Array.from(ev.clipboardData?.files ?? []);
|
|
3701
|
+
if (!allowed || !files.length) return;
|
|
3702
|
+
ev.preventDefault();
|
|
3703
|
+
this.attach(files);
|
|
3704
|
+
}
|
|
3594
3705
|
/** Stop the answer in progress. */
|
|
3595
3706
|
stopAnswer() {
|
|
3596
3707
|
return ([state]) => {
|
|
@@ -3678,6 +3789,7 @@ var LambforgeAgentChat = class extends import_lit_html19.LitElement {
|
|
|
3678
3789
|
const drawer = this.mode === "drawer";
|
|
3679
3790
|
const agent = state.agents.find((a5) => a5.id === state.agentId) ?? null;
|
|
3680
3791
|
const title = this.heading || agent?.name || t9.title;
|
|
3792
|
+
const canAttach = !!agent?.allowAttachments;
|
|
3681
3793
|
const live = state.live?.text ? state.live : null;
|
|
3682
3794
|
const notice = live && state.notice?.kind === "busy" ? null : state.notice;
|
|
3683
3795
|
const size = `${state.messages.length}:${live?.text.length ?? 0}`;
|
|
@@ -3746,7 +3858,40 @@ var LambforgeAgentChat = class extends import_lit_html19.LitElement {
|
|
|
3746
3858
|
part="status"
|
|
3747
3859
|
role="status"
|
|
3748
3860
|
>${this.noticeText(notice)}</div>
|
|
3861
|
+
${canAttach && state.files.length ? import_lit_html19.html`<ul class="files" part="files" aria-label=${t9.attached}>
|
|
3862
|
+
${state.files.map(
|
|
3863
|
+
(f4, i12) => import_lit_html19.html`<li class="file" part="file">
|
|
3864
|
+
<span class="file-name" title=${f4.name}>${f4.name}</span>
|
|
3865
|
+
<button type="button" class="file-remove" aria-label=${`${t9.removeFile}: ${f4.name}`} @click=${() => this.detach(i12)}>
|
|
3866
|
+
${icon(ICON_CLOSE)}
|
|
3867
|
+
</button>
|
|
3868
|
+
</li>`
|
|
3869
|
+
)}
|
|
3870
|
+
</ul>` : ""}
|
|
3749
3871
|
<form part="composer" @submit=${(ev) => this.submit(ev, state)}>
|
|
3872
|
+
${canAttach ? import_lit_html19.html`<input
|
|
3873
|
+
class="file-input"
|
|
3874
|
+
type="file"
|
|
3875
|
+
multiple
|
|
3876
|
+
accept=${ACCEPT}
|
|
3877
|
+
hidden
|
|
3878
|
+
@change=${(ev) => {
|
|
3879
|
+
const input = ev.target;
|
|
3880
|
+
this.attach(input.files);
|
|
3881
|
+
input.value = "";
|
|
3882
|
+
}}
|
|
3883
|
+
/>
|
|
3884
|
+
<button
|
|
3885
|
+
class="icon attach"
|
|
3886
|
+
part="attach"
|
|
3887
|
+
type="button"
|
|
3888
|
+
title=${t9.attach}
|
|
3889
|
+
aria-label=${t9.attach}
|
|
3890
|
+
?disabled=${state.answering}
|
|
3891
|
+
@click=${() => this.shadowRoot?.querySelector(".file-input")?.click()}
|
|
3892
|
+
>
|
|
3893
|
+
${icon(ICON_ATTACH)}
|
|
3894
|
+
</button>` : ""}
|
|
3750
3895
|
<label class="sr-only" for="lf-input">${t9.placeholder}</label>
|
|
3751
3896
|
<textarea
|
|
3752
3897
|
id="lf-input"
|
|
@@ -3755,6 +3900,7 @@ var LambforgeAgentChat = class extends import_lit_html19.LitElement {
|
|
|
3755
3900
|
placeholder=${t9.placeholder}
|
|
3756
3901
|
@keydown=${(ev) => this.onInputKey(ev, state)}
|
|
3757
3902
|
@input=${(ev) => this.autosize(ev.target)}
|
|
3903
|
+
@paste=${(ev) => this.onPaste(ev, canAttach && !state.answering)}
|
|
3758
3904
|
></textarea>
|
|
3759
3905
|
<button class="send" part="send" type="submit" aria-label=${state.answering ? t9.stop : t9.send}>
|
|
3760
3906
|
${state.answering ? t9.stop : t9.send}
|
|
@@ -3765,7 +3911,7 @@ var LambforgeAgentChat = class extends import_lit_html19.LitElement {
|
|
|
3765
3911
|
}
|
|
3766
3912
|
bubble(m4) {
|
|
3767
3913
|
if (m4.role === "user") {
|
|
3768
|
-
return import_lit_html19.html`<div class="msg user" part="message user">${m4.text}</div>`;
|
|
3914
|
+
return import_lit_html19.html`<div class="msg user" part="message user">${m4.text}${m4.attachments?.length ? import_lit_html19.html`<div class="msg-files">${m4.attachments.map((name) => import_lit_html19.html`<span class="msg-file">${name}</span>`)}</div>` : ""}</div>`;
|
|
3769
3915
|
}
|
|
3770
3916
|
return import_lit_html19.html`<div class="msg assistant" part="message assistant">
|
|
3771
3917
|
${renderMarkdown(m4.text)}
|
|
@@ -3861,6 +4007,7 @@ export {
|
|
|
3861
4007
|
LOCALES,
|
|
3862
4008
|
LambforgeAgentChat,
|
|
3863
4009
|
TAG,
|
|
4010
|
+
addFiles,
|
|
3864
4011
|
agentEvent,
|
|
3865
4012
|
agentsLoaded,
|
|
3866
4013
|
chatReducer,
|
|
@@ -3873,6 +4020,7 @@ export {
|
|
|
3873
4020
|
newConversation,
|
|
3874
4021
|
pickAgent,
|
|
3875
4022
|
pickAgents,
|
|
4023
|
+
removeFile,
|
|
3876
4024
|
renderMarkdown,
|
|
3877
4025
|
resume,
|
|
3878
4026
|
runEnded,
|