|
|
@@ -6,6 +6,7 @@ import { Locale } from "@/util/locale"
|
|
|
import { useSDK } from "@tui/context/sdk"
|
|
|
import { useRoute } from "@tui/context/route"
|
|
|
import { useDialog } from "../../ui/dialog"
|
|
|
+import type { PromptInfo } from "@tui/component/prompt/history"
|
|
|
|
|
|
export function DialogForkFromTimeline(props: { sessionID: string; onMove: (messageID: string) => void }) {
|
|
|
const sync = useSync()
|
|
|
@@ -35,9 +36,21 @@ export function DialogForkFromTimeline(props: { sessionID: string; onMove: (mess
|
|
|
sessionID: props.sessionID,
|
|
|
messageID: message.id,
|
|
|
})
|
|
|
+ const parts = sync.data.part[message.id] ?? []
|
|
|
+ const initialPrompt = parts.reduce(
|
|
|
+ (agg, part) => {
|
|
|
+ if (part.type === "text") {
|
|
|
+ if (!part.synthetic) agg.input += part.text
|
|
|
+ }
|
|
|
+ if (part.type === "file") agg.parts.push(part)
|
|
|
+ return agg
|
|
|
+ },
|
|
|
+ { input: "", parts: [] as PromptInfo["parts"] },
|
|
|
+ )
|
|
|
route.navigate({
|
|
|
sessionID: forked.data!.id,
|
|
|
type: "session",
|
|
|
+ initialPrompt,
|
|
|
})
|
|
|
dialog.clear()
|
|
|
},
|