Urgent.News

What's breaking now, across hundreds of outlets.

AI

Aborting Mid-Token: Streaming Chat with the Vercel AI SDK and React 19

Aborting Mid-Token: Streaming Chat with the Vercel AI SDK and React 19 At 3:12 a.m. the page is not a model outage. A tab never released its SSE reader after a relay blip, so Chrome sits pegged while a half-rendered assistant message freezes the thread. Quota cuts look the same from the client: the socket dies mid-token, optimistic bubbles stay wrong, and the next send stacks another fetch. I…

At 3:12 a.m., a tab remains stuck due to an SSE reader that never released after a relay blip. Chrome displays a frozen thread with a half-rendered assistant message, while quota cuts cause the socket to die mid-token, leaving optimistic bubbles incorrect and the next send adding another fetch to the stack. The UI retains its client-side React 19 setup.

The @ai-sdk/react library parses tokens, while a thin fetch wrapper manages transport, ensuring the component never blocks on I/O. The wire communication occurs via an unbuffered SSE proxy at https://b-lost.com/v1, which fronts self-hosted OpenBot-style agents. No intermediary buffer is present, causing timeouts to fail fast and the AbortSignal to reach the browser.

Cancellation stops the reader's streamText from processing tokens, but without an AbortSignal, a dropped link or a Stop click leaves the reader draining state updates. The snippet demonstrates how to use React state and refs alongside the @ai-sdk/react library to implement a streaming chat interface.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in AI

A checklist for reviewing a pull request an AI agent wrote

Reviewing a pull request from a colleague, you lean on context: you know how they work, what they were asked to do, and where they usually cut corners. A PR from a coding agent has none of that.

  • Revisit the stated task and summarize it in one concise sentence
  • Examine diff statistics to assess file changes and line additions
  • Approach PR description skeptically, verify claims and raise suspicions

How Multi-Route Failover Makes AI Video Generation Production-Ready

Most AI video tutorials show a happy path: send a prompt, get a video. Production is different. Upstreams go down, queues back up, and rate limits hit at the worst time.

  • Multi-route failover ensures uninterrupted AI video generation despite upstream service failures.
  • Careful failure classification prevents wasted resources by only retrying on transient errors.
  • Persisting route decisions aids debugging and issuing refunds, making the system production-ready.

AI Is Your Lab Assistant. You Are the Head of the Lab

Originally published at scouthub.dev . A second-year PhD student wrote on Reddit this month: "I can't tell if I'm learning or just handing everything to AI" [1].

  • AI acts as lab assistant while humans remain primary investigators
  • Researchers use AI for plotting, coding, reviewing studies but not final conclusions
  • AI excels at time-consuming tasks but requires human oversight for accuracy

More from Monday 23 November →