mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-04-25 00:16:29 +02:00
Merge e0ca073f82 into 2133d7226f
This commit is contained in:
commit
988a460673
3 changed files with 14 additions and 3 deletions
|
|
@ -29,7 +29,8 @@ export class InMemoryBus implements IBus {
|
|||
}
|
||||
this.subscribers.get(runId)!.push(handler);
|
||||
return () => {
|
||||
this.subscribers.get(runId)!.splice(this.subscribers.get(runId)!.indexOf(handler), 1);
|
||||
const idx = this.subscribers.get(runId)!.indexOf(handler);
|
||||
if (idx !== -1) this.subscribers.get(runId)!.splice(idx, 1);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,15 @@ export async function GET(request: Request, props: { params: Promise<{ streamId:
|
|||
// get user data
|
||||
const user = await requireAuth();
|
||||
|
||||
// Validate auth token
|
||||
const apiKey = request.headers.get("Authorization")?.split(" ")[1];
|
||||
if (!apiKey) {
|
||||
return new Response(JSON.stringify({ error: "Missing or invalid Authorization header" }), {
|
||||
status: 401,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
}
|
||||
|
||||
const runCopilotCachedTurnController = container.resolve<IRunCopilotCachedTurnController>("runCopilotCachedTurnController");
|
||||
|
||||
const encoder = new TextEncoder();
|
||||
|
|
@ -21,7 +30,7 @@ export async function GET(request: Request, props: { params: Promise<{ streamId:
|
|||
for await (const event of runCopilotCachedTurnController.execute({
|
||||
caller: "user",
|
||||
userId: user.id,
|
||||
apiKey: request.headers.get("Authorization")?.split(" ")[1],
|
||||
apiKey,
|
||||
key: params.streamId,
|
||||
})) {
|
||||
// Check if this is a content event
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@ export class InMemoryBus implements IBus {
|
|||
}
|
||||
this.subscribers.get(runId)!.push(handler);
|
||||
return () => {
|
||||
this.subscribers.get(runId)!.splice(this.subscribers.get(runId)!.indexOf(handler), 1);
|
||||
const idx = this.subscribers.get(runId)!.indexOf(handler);
|
||||
if (idx !== -1) this.subscribers.get(runId)!.splice(idx, 1);
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue