u-foo 2.4.3 → 2.4.4
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/package.json +1 -1
- package/src/ui/ink/ChatApp.js +23 -12
package/package.json
CHANGED
package/src/ui/ink/ChatApp.js
CHANGED
|
@@ -407,11 +407,11 @@ function classifyChatLogLine(text = "") {
|
|
|
407
407
|
const speaker = dotMatch[1].trim();
|
|
408
408
|
const lower = speaker.toLowerCase();
|
|
409
409
|
const kind = lower === "ufoo" ? "assistant" : "agent";
|
|
410
|
-
return { kind, marker: kind === "assistant" ? "◆" : "
|
|
410
|
+
return { kind, marker: kind === "assistant" ? "◆" : "•", speaker, body: dotMatch[2] || " " };
|
|
411
411
|
}
|
|
412
412
|
const colonMatch = clean.match(/^([A-Za-z0-9_.:@/-]{1,42}):\s+(.*)$/);
|
|
413
413
|
if (colonMatch) {
|
|
414
|
-
return { kind: "agent", marker: "
|
|
414
|
+
return { kind: "agent", marker: "•", speaker: colonMatch[1], body: colonMatch[2] || " " };
|
|
415
415
|
}
|
|
416
416
|
if (/^(CHAT|UCODE)\s+·/i.test(trimmed)) {
|
|
417
417
|
return { kind: "meta", marker: "·", speaker: "", body: clean };
|
|
@@ -419,6 +419,16 @@ function classifyChatLogLine(text = "") {
|
|
|
419
419
|
return { kind: "plain", marker: "│", speaker: "", body: clean };
|
|
420
420
|
}
|
|
421
421
|
|
|
422
|
+
function buildChatLogLineModel(text = "") {
|
|
423
|
+
const row = classifyChatLogLine(text);
|
|
424
|
+
const hasSpeaker = Boolean(row.speaker);
|
|
425
|
+
return {
|
|
426
|
+
...row,
|
|
427
|
+
markerText: hasSpeaker ? `${row.marker || " "} ` : `${row.marker || " "} `,
|
|
428
|
+
bodyText: row.body || " ",
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
|
|
422
432
|
function createInkStreamState({
|
|
423
433
|
dispatch,
|
|
424
434
|
appendHistory,
|
|
@@ -3248,7 +3258,7 @@ function createChatApp({ React, ink, props, interactive = true }) {
|
|
|
3248
3258
|
}
|
|
3249
3259
|
|
|
3250
3260
|
const renderChatLogLine = (item) => {
|
|
3251
|
-
const row =
|
|
3261
|
+
const row = buildChatLogLineModel((item && item.text) || "");
|
|
3252
3262
|
const key = item && item.id ? item.id : `log-${row.body}`;
|
|
3253
3263
|
if (row.kind === "spacer") {
|
|
3254
3264
|
return h(Text, { key, color: "gray" }, " ");
|
|
@@ -3275,16 +3285,16 @@ function createChatApp({ React, ink, props, interactive = true }) {
|
|
|
3275
3285
|
);
|
|
3276
3286
|
}
|
|
3277
3287
|
return h(Box, { key, width: "100%", marginBottom: 1 },
|
|
3278
|
-
h(
|
|
3279
|
-
|
|
3288
|
+
h(Text, { color: colors.marker, bold: row.kind === "error" }, row.markerText),
|
|
3289
|
+
h(Text, { color: colors.body, wrap: "wrap" },
|
|
3290
|
+
row.speaker
|
|
3291
|
+
? h(Text, { color: colors.speaker, bold: colors.bold }, row.speaker)
|
|
3292
|
+
: null,
|
|
3293
|
+
row.speaker
|
|
3294
|
+
? h(Text, { color: "gray" }, " · ")
|
|
3295
|
+
: null,
|
|
3296
|
+
row.bodyText,
|
|
3280
3297
|
),
|
|
3281
|
-
row.speaker
|
|
3282
|
-
? h(Text, { color: colors.speaker, bold: colors.bold }, row.speaker)
|
|
3283
|
-
: null,
|
|
3284
|
-
row.speaker
|
|
3285
|
-
? h(Text, { color: "gray" }, " · ")
|
|
3286
|
-
: null,
|
|
3287
|
-
h(Text, { color: colors.body, wrap: "wrap" }, row.body || " "),
|
|
3288
3298
|
);
|
|
3289
3299
|
};
|
|
3290
3300
|
|
|
@@ -3663,6 +3673,7 @@ module.exports = {
|
|
|
3663
3673
|
buildPromptIpcRequest,
|
|
3664
3674
|
chatHistoryOptionsForScope,
|
|
3665
3675
|
classifyChatLogLine,
|
|
3676
|
+
buildChatLogLineModel,
|
|
3666
3677
|
createInkMultiWindowToggle,
|
|
3667
3678
|
resolveActiveAgentId,
|
|
3668
3679
|
resolveInjectSockPathForAgent,
|