fix: pass payload struct for regenerate/edit/download commands, edit button visibility
This commit is contained in:
+12
-7
@@ -193,13 +193,16 @@ export const api = {
|
||||
conversationId: string,
|
||||
messageId: string,
|
||||
params: ChatParams,
|
||||
) => invoke<void>("regenerate_message", { conversationId, messageId, params }),
|
||||
) => invoke<void>("regenerate_message", { payload: { conversationId, messageId, params } }),
|
||||
editMessage: (
|
||||
conversationId: string,
|
||||
messageId: string,
|
||||
content: string,
|
||||
params: ChatParams,
|
||||
) => invoke<void>("edit_message", { conversationId, messageId, content, params }),
|
||||
) =>
|
||||
invoke<void>("edit_message", {
|
||||
payload: { conversationId, messageId, content, params },
|
||||
}),
|
||||
listMessageVersions: (messageId: string) =>
|
||||
invoke<MessageVersion[]>("list_message_versions", { messageId }),
|
||||
applyMessageVersion: (
|
||||
@@ -215,11 +218,13 @@ export const api = {
|
||||
source?: string,
|
||||
) =>
|
||||
invoke<string>("download_enqueue", {
|
||||
url,
|
||||
fileName,
|
||||
sha256: sha256 ?? null,
|
||||
repoId: repoId ?? null,
|
||||
source: source ?? null,
|
||||
payload: {
|
||||
url,
|
||||
fileName,
|
||||
sha256: sha256 ?? null,
|
||||
repoId: repoId ?? null,
|
||||
source: source ?? null,
|
||||
},
|
||||
}),
|
||||
serverStart: (port: number, apiKey: string) =>
|
||||
invoke<ServerStatus>("server_start", { port, apiKey }),
|
||||
|
||||
@@ -718,15 +718,19 @@ function MessageBubble({
|
||||
) : isUser ? (
|
||||
<>
|
||||
<div className="whitespace-pre-wrap">{message.content}</div>
|
||||
{!streaming ? (
|
||||
<div
|
||||
className={`mt-1 flex justify-end transition-opacity ${
|
||||
streaming ? "opacity-0" : "opacity-0 group-hover:opacity-100"
|
||||
}`}
|
||||
>
|
||||
<button
|
||||
className="absolute -left-8 top-2 hidden rounded p-1 text-slate-500 hover:text-slate-200 group-hover:block"
|
||||
className="rounded px-1.5 py-0.5 text-[10px] text-white/60 hover:bg-white/10 hover:text-white"
|
||||
onClick={() => onEditStart(message)}
|
||||
title="编辑并重新提交"
|
||||
title="编辑并重新提交(清空之后的生成)"
|
||||
>
|
||||
✎
|
||||
编辑
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
</>
|
||||
) : message.content ? (
|
||||
<ReactMarkdown remarkPlugins={[remarkGfm]}>{message.content}</ReactMarkdown>
|
||||
|
||||
Reference in New Issue
Block a user