Commit Graph

258 Commits

Author SHA1 Message Date
Antonio Scandurra
9674b03855 Make scoring more precise by using floats when diffing AI refactors 2023-08-24 12:45:44 +02:00
Antonio Scandurra
481bcbf204 Normalize indentation when refactoring 2023-08-24 12:45:21 +02:00
Antonio Scandurra
985397b55c 📝 2023-08-24 09:52:07 +02:00
Antonio Scandurra
f22acb602e Apply a score boost when consecutive triplets of characters match 2023-08-23 19:21:44 +02:00
Antonio Scandurra
301a12923f Merge transactions into the original assistant transaction
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Kyle Caverly <kyle@zed.dev>
2023-08-23 18:22:17 +02:00
Antonio Scandurra
a69461dba2 Don't score whitespace matches
Co-Authored-By: Kyle Caverly <kyle@zed.dev>
2023-08-23 17:19:07 +02:00
Antonio Scandurra
e4f49746e1 Group modal assistant edits into the same transaction
Co-Authored-By: Kyle Caverly <kyle@zed.dev>
2023-08-23 17:09:15 +02:00
Antonio Scandurra
d3238441ce 🎨 2023-08-23 16:13:37 +02:00
Antonio Scandurra
2e1a4b2591 Adjust scoring 2023-08-23 13:26:30 +02:00
Antonio Scandurra
aa6d6582fd Add basic styling 2023-08-23 13:09:02 +02:00
Antonio Scandurra
a2671a29a0 Highlight text when the diff is the same 2023-08-23 10:28:43 +02:00
Antonio Scandurra
a93583065b Delete unused imports 2023-08-23 09:59:07 +02:00
Antonio Scandurra
c2935056e8 Support multi-byte characters in diff 2023-08-23 09:46:33 +02:00
Antonio Scandurra
a9871a7a70 Add randomized tests for incremental diff 2023-08-23 09:09:01 +02:00
Antonio Scandurra
3a511db5c9 🎨 2023-08-22 18:41:22 +02:00
Antonio Scandurra
69b6967838 Integrate the new diff algorithm into the modal assistant 2023-08-22 13:59:45 +02:00
Antonio Scandurra
1ae5a909cd Start on a custom diff implementation 2023-08-22 12:07:41 +02:00
Joseph T. Lyons
a836f9c23d
Add a default_open_ai_model setting for the assistant (#2876)
[This PR has been sitting around for a
bit](https://github.com/zed-industries/zed/pull/2845). I received a bit
of mixed opinions from the team on how this setting should work, if it
should use the full model names or some simpler form of it, etc. I went
ahead and made the decision to do the following:

- Use the full model names in settings - ex: `gpt-4-0613`
- Default to `gpt-4-0613` when no setting is present
- Save the full model names in the conversation history files (this is
how it was prior) - ex: `gpt-4-0613`
- Display the shortened model names in the assistant - ex: `gpt-4`
- Not worry about adding an option to add custom models (can add in a
follow-up PR)
- Not query what models are available to the user via their api key (can
add in a follow-up PR)

Release Notes:

- Added a `default_open_ai_model` setting for the assistant (defaults to
`gpt-4-0613`).

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2023-08-22 02:55:27 -04:00
Antonio Scandurra
5453553cfa WIP 2023-08-22 08:16:22 +02:00
Antonio Scandurra
5b9d48d723 Avoid diffing when the length is too small 2023-08-21 15:53:43 +02:00
Antonio Scandurra
42f02eb4e7 Incrementally diff input coming from GPT 2023-08-21 15:13:26 +02:00
Antonio Scandurra
3ad7f528cb Start on a refactoring assistant 2023-08-18 17:58:22 +02:00
Mikayla
afebe3faf8
Merge branch 'main' into project_search_design 2023-08-17 01:56:05 -07:00
Mikayla
2f16147055
Fix dock resizing 2023-08-16 19:47:54 -07:00
KCaverly
d727ba18f2 Merge branch 'main' of github.com:zed-industries/zed into project_search_design 2023-08-16 12:43:04 +01:00
Nate Butler
a56747af8c Update assistant status bar icon 2023-08-15 18:36:30 -04:00
Mikayla
111e17b220
Merge branch 'main' into collab-panel 2023-08-15 03:25:45 -07:00
Mikayla
e5eed29c72
Add components example
Re-arrange generics on mouse event handler
Add TypeTag struct for dynamically tagged components
2023-08-15 03:06:43 -07:00
Piotr Osiewicz
6be73e46bf Merge branch 'main' into project_search_design 2023-08-12 21:57:21 +02:00
Mikayla
a90c0e0326
Merge branch 'main' into collab-panel 2023-08-12 12:44:22 -07:00
Piotr Osiewicz
ffffbbea1f
chore: use Cow instead of String for tooltips (#2838)
A QoL change to align `Tooltip` with other elements like `Label`
Release Notes:

- N/A
2023-08-11 15:29:55 +02:00
Mikayla
8980a9f1c1
Add settings for removing the assistant and collaboration panel buttons
Add a not-logged-in state to the collaboration panel

co-authored-by: max <max@zed.dev>
2023-08-07 16:27:47 -07:00
Piotr Osiewicz
8831e03eba Remove reference to pane from a toolbar.
Co-authored-by: Kyle <kyle@zed.dev>
2023-08-03 16:09:26 +02:00
Mikayla Maki
d58f031696
disable wrap guides in the assitant panel 2023-07-28 22:27:36 -07:00
Conrad Irwin
c9bf407431 Avoid optional on select_match 2023-07-17 12:49:59 -06:00
Conrad Irwin
f887a17ffe Merge branch 'main' into vim-search 2023-07-17 09:27:02 -06:00
Nate Butler
4029481fd0 Merge branch 'main' into update-assistant-styles 2023-07-10 10:22:18 -04:00
Conrad Irwin
b4b0f622de Rebuild vim search experience on refactored code 2023-07-07 15:57:54 -06:00
Conrad Irwin
232d14a3ae Make search less magic
Co-Authored-By: Antonio <antonio@zed.dev>
2023-07-07 15:57:54 -06:00
Antonio Scandurra
5408275c7a Filter out non-json files when loading conversations 2023-07-06 14:38:05 +02:00
Antonio Scandurra
f6c96ec892 Fix panic when saved conversations directory changes
We were updating the view's state but missed a `notify`, which caused
the `UniformList` responsible for rendering the saved conversations
to panic when some files were deleted.
2023-07-06 09:53:34 +02:00
Antonio Scandurra
d5f0df94f7 Support assistant: quote selection on multibuffers 2023-07-05 11:41:24 +02:00
Nate Butler
77b120323b Add low_tokens_remaining case to the assistant 2023-06-29 17:44:47 -04:00
Antonio Scandurra
2cb4616609 Enable assistant on stable
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-06-28 12:09:49 +02:00
Nathan Sobo
83fc7b9b7c Avoid scrolling to the new cursor position so the assistant's output is stable
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-28 10:32:06 +02:00
Nathan Sobo
f52d3ea5ef Clean up tooltips, create conversation on cmd-n
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-28 10:27:29 +02:00
Antonio Scandurra
43723168fc Remove assistant panel zoom test
The test was testing pretty straightforward logic, but for some strange reason
it was failing on CI (but passed locally). I think it's fine to delete it and
make progress, if zooming regresses we'll find out pretty quickly.
2023-06-26 19:10:59 +02:00
Antonio Scandurra
d46d3e6d15 Try fixing test on CI 2023-06-26 18:18:22 +02:00
Antonio Scandurra
e77abbf64f Add hover state to assistant buttons 2023-06-26 17:48:43 +02:00
Antonio Scandurra
723c8b98b3 Show quote selection button 2023-06-26 17:24:31 +02:00
Antonio Scandurra
e723686b72 Shwo tooltips for assistant buttons 2023-06-26 17:17:45 +02:00
Antonio Scandurra
edc7f30660 Add assistant icons to the toolbar
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-06-26 16:49:33 +02:00
Antonio Scandurra
9d4dd5c42b Insert empty user message when assisting with the current last message
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-06-26 15:57:36 +02:00
Antonio Scandurra
92d7b6aa3b Allow toggling back and forth between conversation list and editor
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-06-26 15:43:21 +02:00
Antonio Scandurra
5c5d598623 Insert new message right before the next valid one 2023-06-23 11:13:52 +02:00
Antonio Scandurra
6c7271c633 Test serialization roundtrip 2023-06-23 10:42:15 +02:00
Antonio Scandurra
c38bf2de33 Sort conversations in descending chronological order 2023-06-23 10:05:21 +02:00
Antonio Scandurra
5ea5368c07 Re-enable buffer search in assistant 2023-06-23 09:57:31 +02:00
Antonio Scandurra
6f0efec146 Merge remote-tracking branch 'origin/main' into save-conversations 2023-06-23 09:09:42 +02:00
Antonio Scandurra
ff07d0c2ed Fix Conversation::messages_for_offsets with empty message at the end 2023-06-23 08:58:30 +02:00
Nathan Sobo
1707652643 Always focus a panel when zooming it
This allows us to zoom a panel when clicking a button, even if the
panel isn't currently focused.
2023-06-22 06:55:31 -06:00
Nathan Sobo
a49189a704 Add Zoom button to assistant panel 2023-06-21 19:50:22 -06:00
Nathan Sobo
a75341db97 Move model and remaining tokens to assistant toolbar 2023-06-21 19:01:30 -06:00
Nathan Sobo
d78fbbc63e Add title to assistant panel and move + to right 2023-06-21 09:54:49 -06:00
Antonio Scandurra
a011ced698 Allow loading a previously-saved conversation 2023-06-21 16:06:09 +02:00
Antonio Scandurra
06701e78aa WIP 2023-06-21 11:44:32 +02:00
Antonio Scandurra
9217224fa6 Finish renaming AssistantEditor to ConversationEditor 2023-06-21 09:00:26 +02:00
Nathan Sobo
3a61fd503f WIP: Trying to display the toolbar but tired. May be worth discarding this. 2023-06-20 20:11:37 -06:00
Nathan Sobo
23bc11f8b3 Remove the nested Pane from the assistant
Since we don't want tabs, I think it would be better to render the toolbar
for ourselves directly and handle switching between conversations.

Co-Authored-By: Julia Risley <julia@zed.dev>
2023-06-20 18:52:48 -06:00
Piotr Osiewicz
e92015b12f
Split out Interactive<T> into Toggle<T> and Interactive<T> 2023-06-20 16:05:20 -07:00
Nathan Sobo
bd7f8e8b38 Scan conversations dir on assistant panel open and on changes
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-06-20 16:19:43 -06:00
Nathan Sobo
230b4d237e Add SavedConversation::list() method
Co-Authored-By: Kyle Caverly <kyle@zed.dev>
2023-06-20 13:29:34 -06:00
Nathan Sobo
9f783944a7 Wait until we have a summary before saving a conversation
Also, avoid collisions by adding a discriminant.

Co-Authored-By: Kyle Caverly <kyle@zed.dev>
2023-06-20 13:03:23 -06:00
Antonio Scandurra
c416551318 Don't use the summary as the filename if it's not done yet 2023-06-20 19:19:02 +02:00
Antonio Scandurra
f904698457 Use the OPENAI_API_KEY environment variable when present 2023-06-20 19:18:49 +02:00
Antonio Scandurra
31a70efe66 Autosave conversations 2023-06-20 19:10:52 +02:00
Antonio Scandurra
c83a918a7e Merge remote-tracking branch 'origin/main' into save-conversations 2023-06-20 18:16:40 +02:00
Antonio Scandurra
1d84da1d33 Improve prompt 2023-06-20 15:32:51 +02:00
Antonio Scandurra
8673b0b75b Avoid including pending or errored messages on assist 2023-06-20 11:59:51 +02:00
Antonio Scandurra
cb55356106 WIP 2023-06-19 17:53:05 +02:00
Antonio Scandurra
75e2329028 Allow for multi-cursor assist and cycle_role actions
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Kyle Caverly <kyle@zed.dev>
2023-06-19 17:23:40 +02:00
Antonio Scandurra
9191a82447 Remove Assistant::open_ai_request_messages 2023-06-19 14:35:33 +02:00
Antonio Scandurra
dc9231d5a3 Merge remote-tracking branch 'origin/main' into replies 2023-06-19 14:28:21 +02:00
Antonio Scandurra
c9df963142 Allow message splitting with multiple cursors 2023-06-19 12:00:45 +02:00
Nathan Sobo
882009bc75 Save conversations to ~/.config/zed/conversations
Still need to implement loading / listing.
I'd really be rather write operations to a database. Maybe we
should be auto-saving? Integrating with panes? I just did
the simple thing for now.
2023-06-16 16:15:07 -06:00
Nathan Sobo
54c71c1a35 Insert reply after the currently selected user message 2023-06-16 12:41:07 -06:00
Nathan Sobo
75b5ac8488 Cycle message roles on ctrl-r 2023-06-16 11:50:18 -06:00
Nathan Sobo
c179dd9990 Remove redundant tests 2023-06-16 11:43:16 -06:00
Nathan Sobo
6c0f65cfe0 Avoid inserting redundant newlines
Co-Authored-By: Piotr Osiewicz <piotr@zed.dev>
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-16 10:36:42 -06:00
Piotr Osiewicz
ef6cb11d5c Emit editor event whether we insert a newline or not. 2023-06-16 13:29:12 +02:00
Nathan Sobo
8c6ba13fef Never insert an empty prefix when splitting a message with a non-empty range
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
Co-Authored-By: Piotr Osiewicz <piotr@zed.dev>
2023-06-15 09:02:15 -06:00
Antonio Scandurra
21e8e8763e Allow splitting of messages using shift-enter 2023-06-15 14:05:26 +02:00
Antonio Scandurra
4efe62b3e5 Use robot icon for assistant to prevent confusion with conversations 2023-06-14 12:14:43 +02:00
Antonio Scandurra
049c987310 Avoid loading the assistant panel on stable 2023-06-14 12:08:49 +02:00
Antonio Scandurra
56b0bf8601 Save cursor scroll position when the editor is auto-scrolled 2023-06-14 12:00:27 +02:00
Antonio Scandurra
1aa1774688 Avoid auto-scrolling the editor when inserting/removing headers 2023-06-14 10:49:23 +02:00
Antonio Scandurra
f8b9417406 Keep cursor stable as autocompletions are being streamed 2023-06-14 10:41:18 +02:00
Antonio Scandurra
75ad76bfb2 💄 2023-06-14 09:47:30 +02:00
Antonio Scandurra
7dab17e233 Re-enable copy support in the assistant 2023-06-14 09:40:43 +02:00
Antonio Scandurra
9b7617403d Parse buffer as Markdown 2023-06-14 09:31:41 +02:00
Antonio Scandurra
0db0a1ccef Skip merged messages when inserting new ones
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-06-13 16:06:50 +02:00
Antonio Scandurra
6e5de2fbbb Update blocks when cycling the message role
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-06-13 16:00:13 +02:00
Antonio Scandurra
00cede63a8 Show message headers again
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-06-13 15:55:52 +02:00
Antonio Scandurra
2842fc2b1d Merge messages whose header has been invalidated 2023-06-13 15:16:04 +02:00
Antonio Scandurra
2ae8b558b9 Get back to a compiling state with Buffer backing the assistant 2023-06-13 13:43:06 +02:00
Antonio Scandurra
7db690b713 WIP 2023-06-12 17:50:13 +02:00
Antonio Scandurra
d3e0d38bef Fix assistant panel tests 2023-06-07 15:24:08 +02:00
Antonio Scandurra
d26cc2c897 Maintain scroll bottom when streaming assistant responses 2023-06-07 15:01:50 +02:00
Antonio Scandurra
0dae8f2dd8 Merge remote-tracking branch 'origin/main' into assistant-2 2023-06-07 09:34:16 +02:00
Antonio Scandurra
a6feaf1300 Allow search assistant editors 2023-06-07 09:24:18 +02:00
Max Brunsfeld
dbbd0558c3 Eliminate assets crate 2023-06-06 11:46:46 -07:00
Antonio Scandurra
16090c35ae Insert reply after assistant message when hitting cmd-enter
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-06-06 19:15:06 +02:00
Antonio Scandurra
ef7ec265c8 Cycle message roles on click
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-06-06 18:45:08 +02:00
Antonio Scandurra
ac7178068f Include message headers in copied assistant text
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-06-06 18:18:04 +02:00
Antonio Scandurra
093ce8a9ac Simplify prompt
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-06-06 17:45:58 +02:00
Antonio Scandurra
2b1aeb07bc Show error message when requests to OpenAI fail
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-06-06 16:53:56 +02:00
Antonio Scandurra
9c59146026 Set assistant editor's title based on the first question/answer pair
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-06-06 15:59:10 +02:00
Antonio Scandurra
69b8267b6b Show the current model and allow clicking on it to change it 2023-06-06 13:13:44 +02:00
Antonio Scandurra
ada222078c Insert a user reply when hitting cmd-enter in an assistant message 2023-06-06 13:13:41 +02:00
Antonio Scandurra
337dda8e3a Only remove excerpts when an edit touches them 2023-06-06 12:27:05 +02:00
Nathan Sobo
23836eb251 Not working yet: Remove empty messages unless they contain the cursor
Problem is, I'm trying to trust the excerpt id of the selection head,
but it's a sentinel value and not the actual excerpt id of the message.
I think we probably need to resolve to offsets instead.
2023-06-05 22:58:08 -06:00
Antonio Scandurra
bef6932da7 Avoid accidentally taking the api_key when requesting an assist 2023-06-05 11:25:21 +02:00
Antonio Scandurra
f00f16fe37 Show remaining tokens 2023-06-02 17:27:21 +02:00
Antonio Scandurra
3750e64d9f Save OpenAI API key in the keychain 2023-06-02 12:15:25 +02:00
Antonio Scandurra
a81d164ea6 Allow saving the OpenAI API key in the assistant panel 2023-06-02 11:38:02 +02:00
Antonio Scandurra
d0aff65b1c Allow moving the assistant panel to other docks 2023-06-02 10:55:19 +02:00
Antonio Scandurra
55c8c6d3fb Allow adding new contexts 2023-06-02 10:29:22 +02:00
Antonio Scandurra
cf934ab696 Fix compile errors 2023-06-02 10:08:06 +02:00
Antonio Scandurra
69e8a166e4 Start on assistant::QuoteSelection 2023-05-30 15:25:53 +02:00
Antonio Scandurra
dc365472a6 Merge remote-tracking branch 'origin/main' into assistant-2 2023-05-30 15:11:06 +02:00
Antonio Scandurra
890c42a75a Show time in assistant messages 2023-05-29 16:23:16 +02:00
Antonio Scandurra
52e8bf2928 Show custom header for assistant messages 2023-05-29 15:57:55 +02:00
Antonio Scandurra
404bebab63 Set markdown as the assistant's buffer languages 2023-05-29 11:34:26 +02:00
Nathan Sobo
ffbfbe422b WIP: Not sure I actually want to rip this out 2023-05-26 16:11:58 -06:00
Nathan Sobo
3904971bd8 Hide assistant gutter 2023-05-26 15:38:03 -06:00
Nathan Sobo
8f6e67f440 Cancel assists on escape 2023-05-26 14:49:27 -06:00
Nathan Sobo
80080a43e4 Start on an assistant panel based on multi-buffers
Each message is represented as a multibuffer excerpt to allow for
fluid editing of the conversation transcript.

Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-05-26 10:09:55 -06:00
Kirill Bulatov
2fdc960704 Properly display labels for currently opened external files 2023-05-26 15:44:44 +03:00
Antonio Scandurra
7e1ea8f274 Remove stray dbg! 2023-05-25 12:04:41 +02:00
Nathan Sobo
26051de160 Clean up 2023-05-24 11:08:00 -06:00
Nathan Sobo
d495c1b804 Only run AI agent on dev and preview 2023-05-24 10:58:33 -06:00
Nathan Sobo
ba79a8ba94 WIP 2023-05-24 10:26:14 -06:00
Nathan Sobo
50e1e17d09 WIP 2023-05-24 09:53:08 -06:00
Nathan Sobo
051c7566cc WIP 2023-05-24 09:38:37 -06:00
Nathan Sobo
6368ade1da WIP 2023-05-24 09:12:16 -06:00
Nathan Sobo
637ed79603 WIP 2023-05-23 18:16:49 -06:00
Nathan Sobo
65fc50745b WIP 2023-05-23 18:04:33 -06:00
Nathan Sobo
d934da1905 WIP 2023-05-23 15:25:34 -06:00
Nathan Sobo
7be41e19f7 WIP 2023-05-23 08:52:21 -06:00
Nathan Sobo
073967c80b WIP 2023-05-23 01:56:28 -06:00