Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
size limit (#418, #423)
- `getFilesToDelete` and `deleteFiles` take a `lastTouchedBefore` cutoff to
clean up recent unreferenced files (#361, #437)
- Save every step the AI SDK runs, fail the generation when a step save fails,
and keep provider errors in `fullStream` with `saveStreamDeltas`. A caller's
`onStepEnd` now runs before its step is saved, its `onEnd` after the last one,
and a step cut off by `stopStream` fails instead of staying pending (#388,
#419, #428)
- Aborting a stream no longer fails a step that already finished, reversing #326

## 0.7.9

Expand Down
10 changes: 9 additions & 1 deletion src/component/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
finishHandler,
releaseStreamFileOwnershipByIds,
abortStreamsAtOrder,
abortById,
} from "./streams.js";
import { partial } from "convex-helpers/validators";
import {
Expand Down Expand Up @@ -208,6 +209,7 @@ const addMessagesArgs = {
hideFromUserIdSearch: v.optional(v.boolean()),
// If provided, finish this stream atomically with the message save.
// This prevents UI flickering from separate mutations (issue #181).
// Failed messages abort it instead.
finishStreamId: v.optional(v.id("streamingMessages")),
};
export const addMessages = mutation({
Expand Down Expand Up @@ -426,7 +428,13 @@ async function addMessagesHandler(
}
// Atomically finish the stream if requested, preventing UI flickering
// from separate mutations for message save and stream finish (issue #181).
if (finishStreamId) {
const failed = toReturn.find((m) => m.status === "failed");
if (finishStreamId && failed) {
await abortById(ctx, {
streamId: finishStreamId,
reason: failed.error ?? "The generation failed",
});
} else if (finishStreamId) {
await finishHandler(ctx, {
streamId: finishStreamId,
});
Expand Down
2 changes: 1 addition & 1 deletion src/component/streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export const abort = mutation({
handler: abortById,
});

async function abortById(
export async function abortById(
ctx: MutationCtx,
args: {
streamId: Id<"streamingMessages">;
Expand Down
Loading
Loading