mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
Revert "Update ui/src/ui/chat/export.ts"
This reverts commit d648dd7643.
This commit is contained in:
@@ -10,15 +10,7 @@ export function exportChatMarkdown(messages: unknown[], assistantName: string):
|
|||||||
for (const msg of history) {
|
for (const msg of history) {
|
||||||
const m = msg as Record<string, unknown>;
|
const m = msg as Record<string, unknown>;
|
||||||
const role = m.role === "user" ? "You" : m.role === "assistant" ? assistantName : "Tool";
|
const role = m.role === "user" ? "You" : m.role === "assistant" ? assistantName : "Tool";
|
||||||
const content =
|
const content = typeof m.content === "string" ? m.content : "";
|
||||||
typeof m.content === "string"
|
|
||||||
? m.content
|
|
||||||
: Array.isArray(m.content)
|
|
||||||
? (m.content as Array<{ type?: string; text?: string }>)
|
|
||||||
.filter((b) => b?.type === "text" && typeof b.text === "string")
|
|
||||||
.map((b) => b.text)
|
|
||||||
.join("")
|
|
||||||
: "";
|
|
||||||
const ts = typeof m.timestamp === "number" ? new Date(m.timestamp).toISOString() : "";
|
const ts = typeof m.timestamp === "number" ? new Date(m.timestamp).toISOString() : "";
|
||||||
lines.push(`## ${role}${ts ? ` (${ts})` : ""}`, "", content, "");
|
lines.push(`## ${role}${ts ? ` (${ts})` : ""}`, "", content, "");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user