mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
sync
This commit is contained in:
parent
38e83b509e
commit
cd74c6eeea
1 changed files with 25 additions and 25 deletions
|
|
@ -54,6 +54,12 @@ export function Session() {
|
|||
}, 50)
|
||||
}
|
||||
|
||||
// snap to bottom when revert position changes
|
||||
createEffect((old) => {
|
||||
if (old !== session()?.revert?.messageID) toBottom()
|
||||
return session()?.revert?.messageID
|
||||
})
|
||||
|
||||
const local = useLocal()
|
||||
|
||||
const command = useCommandDialog()
|
||||
|
|
@ -115,16 +121,14 @@ export function Session() {
|
|||
const revert = session().revert?.messageID
|
||||
const message = messages().findLast((x) => (!revert || x.id < revert) && x.role === "user")
|
||||
if (!message) return
|
||||
sdk.session
|
||||
.revert({
|
||||
path: {
|
||||
id: route.sessionID,
|
||||
},
|
||||
body: {
|
||||
messageID: message.id,
|
||||
},
|
||||
})
|
||||
.then(toBottom)
|
||||
sdk.session.revert({
|
||||
path: {
|
||||
id: route.sessionID,
|
||||
},
|
||||
body: {
|
||||
messageID: message.id,
|
||||
},
|
||||
})
|
||||
dialog.clear()
|
||||
},
|
||||
},
|
||||
|
|
@ -138,25 +142,21 @@ export function Session() {
|
|||
if (!messageID) return
|
||||
const message = messages().find((x) => x.role === "user" && x.id > messageID)
|
||||
if (!message) {
|
||||
sdk.session
|
||||
.unrevert({
|
||||
path: {
|
||||
id: route.sessionID,
|
||||
},
|
||||
})
|
||||
.then(toBottom)
|
||||
return
|
||||
}
|
||||
sdk.session
|
||||
.revert({
|
||||
sdk.session.unrevert({
|
||||
path: {
|
||||
id: route.sessionID,
|
||||
},
|
||||
body: {
|
||||
messageID: message.id,
|
||||
},
|
||||
})
|
||||
.then(toBottom)
|
||||
return
|
||||
}
|
||||
sdk.session.revert({
|
||||
path: {
|
||||
id: route.sessionID,
|
||||
},
|
||||
body: {
|
||||
messageID: message.id,
|
||||
},
|
||||
})
|
||||
},
|
||||
},
|
||||
])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue