try to avoid persisting empty thinking/text blocks

This commit is contained in:
Dax Raad
2025-10-16 10:53:49 -04:00
parent 542b9fa342
commit d8a15e7bc9
2 changed files with 33 additions and 13 deletions

View File

@@ -342,6 +342,23 @@ export namespace Session {
return part
})
export const removePart = fn(
z.object({
sessionID: Identifier.schema("session"),
messageID: Identifier.schema("message"),
partID: Identifier.schema("part"),
}),
async (input) => {
await Storage.remove(["part", input.messageID, input.partID])
Bus.publish(MessageV2.Event.PartRemoved, {
sessionID: input.sessionID,
messageID: input.messageID,
partID: input.partID,
})
return input.partID
},
)
export const getUsage = fn(
z.object({
model: z.custom<ModelsDev.Model>(),