mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-09 15:52:40 +02:00
fixed rendering logic for terminal message to include all terminal messages
This commit is contained in:
parent
ef761f1a43
commit
359c05dd76
1 changed files with 9 additions and 12 deletions
|
|
@ -981,19 +981,16 @@ const ChatPage = () => {
|
||||||
const renderTerminalContent = (message: any) => {
|
const renderTerminalContent = (message: any) => {
|
||||||
if (!message.annotations) return null;
|
if (!message.annotations) return null;
|
||||||
|
|
||||||
// Get all TERMINAL_INFO annotations
|
// Get all TERMINAL_INFO annotations content
|
||||||
const terminalInfoAnnotations = (message.annotations as any[]).filter(
|
const terminalInfoAnnotations = (message.annotations as any[]).map(item => {
|
||||||
(a) => a.type === "TERMINAL_INFO",
|
if(item.type === "TERMINAL_INFO") {
|
||||||
);
|
return item.content.map((a: any) => a.text)
|
||||||
|
|
||||||
// Get the latest TERMINAL_INFO annotation
|
}
|
||||||
const latestTerminalInfo =
|
}).flat().filter(Boolean)
|
||||||
terminalInfoAnnotations.length > 0
|
|
||||||
? terminalInfoAnnotations[terminalInfoAnnotations.length - 1]
|
|
||||||
: null;
|
|
||||||
|
|
||||||
// Render the content of the latest TERMINAL_INFO annotation
|
// Render the content of the latest TERMINAL_INFO annotation
|
||||||
return latestTerminalInfo?.content.map((item: any, idx: number) => (
|
return terminalInfoAnnotations.map((item: any, idx: number) => (
|
||||||
<div key={idx} className="py-0.5 flex items-start text-gray-300">
|
<div key={idx} className="py-0.5 flex items-start text-gray-300">
|
||||||
<span className="text-gray-500 text-xs mr-2 w-10 flex-shrink-0">
|
<span className="text-gray-500 text-xs mr-2 w-10 flex-shrink-0">
|
||||||
[{String(idx).padStart(2, "0")}:
|
[{String(idx).padStart(2, "0")}:
|
||||||
|
|
@ -1008,7 +1005,7 @@ const ChatPage = () => {
|
||||||
${item.type === "warning" ? "text-yellow-300" : ""}
|
${item.type === "warning" ? "text-yellow-300" : ""}
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
{item.text}
|
{item}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
));
|
));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue