feat: persist photos and enrich conversation history
This commit is contained in:
@@ -1154,7 +1154,10 @@ function DebugVisionWorkspace({
|
||||
} | null>(null);
|
||||
const latestMessage = [...messages]
|
||||
.reverse()
|
||||
.find((message) => message.content.trim());
|
||||
.find(
|
||||
(message) =>
|
||||
message.content.trim() || (message.attachments?.length ?? 0) > 0,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const container = containerRef.current;
|
||||
@@ -1201,7 +1204,10 @@ function DebugVisionWorkspace({
|
||||
{latestMessage?.role === "user" ? "我:" : "助手:"}
|
||||
</span>
|
||||
<span>
|
||||
{latestMessage?.content || "暂无消息,点击返回聊天记录"}
|
||||
{latestMessage?.content ||
|
||||
(latestMessage?.attachments?.length
|
||||
? "发送了一张照片"
|
||||
: "暂无消息,点击返回聊天记录")}
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
@@ -1449,7 +1455,7 @@ function DebugTranscriptPanel({
|
||||
助手{time ? ` · ${time}` : ""}
|
||||
</span>
|
||||
<div className="whitespace-pre-wrap rounded-2xl rounded-tl-sm bg-surface-strong px-4 py-2.5 text-sm leading-6 text-foreground">
|
||||
{message.content}
|
||||
{message.content || (message.streaming ? "…" : "")}
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
@@ -1460,8 +1466,26 @@ function DebugTranscriptPanel({
|
||||
<span className="px-1 text-[11px] text-muted-soft">
|
||||
我{time ? ` · ${time}` : ""}
|
||||
</span>
|
||||
<div className="whitespace-pre-wrap rounded-2xl rounded-tr-sm bg-primary px-4 py-2.5 text-sm leading-6 text-primary-foreground">
|
||||
{message.content}
|
||||
<div
|
||||
className={[
|
||||
"overflow-hidden whitespace-pre-wrap rounded-2xl rounded-tr-sm bg-primary text-sm leading-6 text-primary-foreground",
|
||||
message.attachments?.length ? "p-1" : "px-4 py-2.5",
|
||||
].join(" ")}
|
||||
>
|
||||
{message.attachments?.map((attachment) => (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img
|
||||
key={attachment.id}
|
||||
src={attachment.url}
|
||||
alt={attachment.alt}
|
||||
className="max-h-72 w-full rounded-[0.8rem] object-cover"
|
||||
/>
|
||||
))}
|
||||
{message.content && (
|
||||
<div className={message.attachments?.length ? "px-3 py-2" : ""}>
|
||||
{message.content}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user