mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-28 08:14:48 +08:00
feat: support SSE write_file(0
This commit is contained in:
21
frontend/src/components/workspace/messages/context.ts
Normal file
21
frontend/src/components/workspace/messages/context.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { UseStream } from "@langchain/langgraph-sdk/react";
|
||||
import { createContext, useContext } from "react";
|
||||
|
||||
import type { AgentThreadState } from "@/core/threads";
|
||||
|
||||
export interface ThreadContextType {
|
||||
threadId: string;
|
||||
thread: UseStream<AgentThreadState>;
|
||||
}
|
||||
|
||||
export const ThreadContext = createContext<ThreadContextType | undefined>(
|
||||
undefined,
|
||||
);
|
||||
|
||||
export function useThread() {
|
||||
const context = useContext(ThreadContext);
|
||||
if (context === undefined) {
|
||||
throw new Error("useThread must be used within a ThreadContext");
|
||||
}
|
||||
return context;
|
||||
}
|
||||
Reference in New Issue
Block a user