-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move all to chat router + local redis * redis pubsub * first attempt at ui impl * server side events works now for streaming in messages * auth callback with broken cookie dep * bumped fastify + deps to v5 * uses supabase cookies * fix login when identity already exists
- Loading branch information
1 parent
9e10c1d
commit 5edab15
Showing
39 changed files
with
1,010 additions
and
771 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,17 @@ | ||
import { requestContext } from '@fastify/request-context'; | ||
import type { User } from '@supabase/supabase-js'; | ||
import { TRPCError } from '@trpc/server'; | ||
import type { CreateFastifyContextOptions } from '@trpc/server/adapters/fastify'; | ||
|
||
export async function createContext({ req, res }: CreateFastifyContextOptions) { | ||
const user = requestContext.get('user'); | ||
console.log('NO USER'); | ||
if (!user) { | ||
throw new TRPCError({ | ||
code: 'UNAUTHORIZED', | ||
message: 'Unauthorized', | ||
}); | ||
} | ||
return { | ||
req, | ||
res, | ||
user, | ||
aiService: req.server.aiService, | ||
chatService: req.server.chatService, | ||
dbPool: req.server.dbPool, | ||
}; | ||
} | ||
|
||
export type Context = Awaited<ReturnType<typeof createContext>>; | ||
export type AuthedContext = Context & { user: User }; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
import { chatRouter } from './routers/chat'; | ||
import { chatMessagesRouter } from './routers/chatMessages'; | ||
import { router } from './trpc'; | ||
|
||
export const appRouter = router({ | ||
chat: chatRouter, | ||
chatMessages: chatMessagesRouter, | ||
}); | ||
|
||
export type AppRouter = typeof appRouter; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.