-
Notifications
You must be signed in to change notification settings - Fork 3.5k
improvement(copilot): edit old messages, aborts, reverts, model selection, context window #1675
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
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
9865592
Add exa to search online tool
Sg312 732b613
Larger font size
Sg312 ebbed53
Copilot UI improvements
Sg312 5efe404
Fix models options
Sg312 25b28dd
Add haiku 4.5 to copilot
Sg312 b90c239
Model ui for haiku
Sg312 d4fd007
Fix lint
Sg312 43d26f0
Revert
Sg312 8cd1949
Only allow one revert to message
Sg312 a7f3d87
Clear diff on revert
Sg312 c76e160
Fix welcome screen flash
Sg312 51ffcb3
Add focus onto the user input box when clicked
Sg312 e6dcb55
Fix grayout of new stream on old edit message
Sg312 52a1bc7
Lint
Sg312 a2173ca
Make edit message submit smoother
Sg312 5a551d0
Allow message sent while streaming
Sg312 ddf4cd4
Revert popup improvements: gray out stuff below, show cursor on revert
Sg312 81f5b2b
Fix lint
Sg312 e02db18
Improve chat history dropdown
Sg312 89c143b
Improve get block metadata tool
Sg312 f229cf9
Update update cost route
Sg312 c4a80ae
Fix env
Sg312 162a0b3
Context usage endpoint
Sg312 fdcbe2e
Make chat history scrollable
Sg312 960107b
Fix lint
Sg312 16efb15
Copilot revert popup updates
Sg312 7639865
Fix lint
Sg312 5fb6227
Merge branch 'staging' into improvement/copilot-2
Sg312 3f6ca39
Fix tests and lint
Sg312 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { db } from '@sim/db' | ||
| import { copilotChats } from '@sim/db/schema' | ||
| import { eq } from 'drizzle-orm' | ||
| import { type NextRequest, NextResponse } from 'next/server' | ||
| import { z } from 'zod' | ||
| import { getSession } from '@/lib/auth' | ||
| import { createLogger } from '@/lib/logs/console/logger' | ||
|
|
||
| const logger = createLogger('DeleteChatAPI') | ||
|
|
||
| const DeleteChatSchema = z.object({ | ||
| chatId: z.string(), | ||
| }) | ||
|
|
||
| export async function DELETE(request: NextRequest) { | ||
| try { | ||
| const session = await getSession() | ||
| if (!session?.user?.id) { | ||
| return NextResponse.json({ success: false, error: 'Unauthorized' }, { status: 401 }) | ||
| } | ||
|
|
||
| const body = await request.json() | ||
| const parsed = DeleteChatSchema.parse(body) | ||
|
|
||
| // Delete the chat | ||
| await db.delete(copilotChats).where(eq(copilotChats.id, parsed.chatId)) | ||
|
|
||
| logger.info('Chat deleted', { chatId: parsed.chatId }) | ||
|
|
||
| return NextResponse.json({ success: true }) | ||
| } catch (error) { | ||
| logger.error('Error deleting chat:', error) | ||
| return NextResponse.json({ success: false, error: 'Failed to delete chat' }, { status: 500 }) | ||
| } | ||
| } | ||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import { db } from '@sim/db' | ||
| import { copilotChats } from '@sim/db/schema' | ||
| import { eq } from 'drizzle-orm' | ||
| import { type NextRequest, NextResponse } from 'next/server' | ||
| import { z } from 'zod' | ||
| import { getSession } from '@/lib/auth' | ||
| import { createLogger } from '@/lib/logs/console/logger' | ||
|
|
||
| const logger = createLogger('UpdateChatTitleAPI') | ||
|
|
||
| const UpdateTitleSchema = z.object({ | ||
| chatId: z.string(), | ||
| title: z.string(), | ||
| }) | ||
|
|
||
| export async function POST(request: NextRequest) { | ||
| try { | ||
| const session = await getSession() | ||
| if (!session?.user?.id) { | ||
| return NextResponse.json({ success: false, error: 'Unauthorized' }, { status: 401 }) | ||
| } | ||
|
|
||
| const body = await request.json() | ||
| const parsed = UpdateTitleSchema.parse(body) | ||
|
|
||
| // Update the chat title | ||
| await db | ||
| .update(copilotChats) | ||
| .set({ | ||
| title: parsed.title, | ||
| updatedAt: new Date(), | ||
| }) | ||
| .where(eq(copilotChats.id, parsed.chatId)) | ||
|
|
||
| logger.info('Chat title updated', { chatId: parsed.chatId, title: parsed.title }) | ||
|
|
||
| return NextResponse.json({ success: true }) | ||
| } catch (error) { | ||
| logger.error('Error updating chat title:', error) | ||
| return NextResponse.json( | ||
| { success: false, error: 'Failed to update chat title' }, | ||
| { status: 500 } | ||
| ) | ||
| } | ||
| } |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Delete without verifying ownership - any authenticated user can delete any chat
Prompt To Fix With AI