-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat: reduce agent overhead #2953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
90d7245
530df00
f9e2373
52a6f70
41dbcc2
db7962a
aabd9a9
f5931ac
908d79f
2a5e75a
3c05398
b696e4c
79f3670
7746ddf
5b5ff0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -36,13 +36,7 @@ export const conversationRouter = createTRPCRouter({ | |||||||||||||||||||
| upsert: protectedProcedure | ||||||||||||||||||||
| .input(conversationInsertSchema) | ||||||||||||||||||||
| .mutation(async ({ ctx, input }) => { | ||||||||||||||||||||
| const [conversation] = await ctx.db.insert(conversations).values(input).onConflictDoUpdate({ | ||||||||||||||||||||
| target: [conversations.id], | ||||||||||||||||||||
| set: { | ||||||||||||||||||||
| ...input, | ||||||||||||||||||||
| updatedAt: new Date(), | ||||||||||||||||||||
| }, | ||||||||||||||||||||
| }).returning(); | ||||||||||||||||||||
| const [conversation] = await ctx.db.insert(conversations).values(input).returning(); | ||||||||||||||||||||
| if (!conversation) { | ||||||||||||||||||||
| throw new Error('Conversation not created'); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
@@ -51,11 +45,10 @@ export const conversationRouter = createTRPCRouter({ | |||||||||||||||||||
| update: protectedProcedure | ||||||||||||||||||||
| .input(conversationUpdateSchema) | ||||||||||||||||||||
| .mutation(async ({ ctx, input }) => { | ||||||||||||||||||||
| const [conversation] = await ctx.db.update(conversations) | ||||||||||||||||||||
| .set({ | ||||||||||||||||||||
| ...input, | ||||||||||||||||||||
| updatedAt: new Date(), | ||||||||||||||||||||
| }) | ||||||||||||||||||||
| const [conversation] = await ctx.db.update({ | ||||||||||||||||||||
| ...conversations, | ||||||||||||||||||||
| updatedAt: new Date(), | ||||||||||||||||||||
| }).set(input) | ||||||||||||||||||||
|
Comment on lines
+48
to
+51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix Drizzle update call Spreading the table into a plain object strips the symbols Drizzle needs, so this will throw at runtime (table name becomes undefined) and - const [conversation] = await ctx.db.update({
- ...conversations,
- updatedAt: new Date(),
- }).set(input)
+ const [conversation] = await ctx.db.update(conversations)
+ .set({
+ ...input,
+ updatedAt: new Date(),
+ })📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| .where(eq(conversations.id, input.id)).returning(); | ||||||||||||||||||||
| if (!conversation) { | ||||||||||||||||||||
| throw new Error('Conversation not updated'); | ||||||||||||||||||||
|
|
@@ -75,7 +68,7 @@ export const conversationRouter = createTRPCRouter({ | |||||||||||||||||||
| content: z.string(), | ||||||||||||||||||||
| })) | ||||||||||||||||||||
| .mutation(async ({ ctx, input }) => { | ||||||||||||||||||||
| const { model, providerOptions, headers } = initModel({ | ||||||||||||||||||||
| const { model, providerOptions, headers } = await initModel({ | ||||||||||||||||||||
| provider: LLMProvider.OPENROUTER, | ||||||||||||||||||||
| model: OPENROUTER_MODELS.CLAUDE_3_5_HAIKU, | ||||||||||||||||||||
| }); | ||||||||||||||||||||
|
|
||||||||||||||||||||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.