refactor(examples-chat): onTimelineFork uses ThreadsService.create()#265
Merged
Conversation
…instead of raw fetch The last remaining raw-fetch call against LangGraph in the example shell. ThreadsService.create() already does the same POST /threads through @langchain/langgraph-sdk's Client (added in Phase 3b), returning the new thread id. Saves 7 lines and removes the last inconsistency in how the example talks to LangGraph. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Last remaining raw-fetch call against LangGraph in the example shell.
ThreadsService.create()already does the samePOST /threadsthrough@langchain/langgraph-sdk'sClient(added in Phase 3b) and returns the new thread id.This closes out the SDK-audit follow-up tracked from Phase 3b — the codebase now uses the SDK Client uniformly for every thread CRUD operation.
async onTimelineFork(checkpointId: string): Promise<void> { - await fetch('http://localhost:2024/threads', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: '{}', - }) - .then((r) => r.json()) - .then((t: { thread_id: string }) => { - this.threadIdSignal.set(t.thread_id); - this.persistence.write('threadId', t.thread_id); - void this.agent.submit(null as never, { checkpointId } as never); - }); + const id = await this.threadsSvc.create(); + if (!id) return; + this.threadIdSignal.set(id); + this.persistence.write('threadId', id); + void this.agent.submit(null as never, { checkpointId } as never); }Test plan
nx run examples-chat-angular:build— cleanThreadsService.create()and is exercised every session.🤖 Generated with Claude Code