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>
This commit is contained in:
Joseph T. Lyons 2023-08-22 02:55:27 -04:00 committed by GitHub
parent 3a13795021
commit a836f9c23d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 72 additions and 20 deletions

View file

@ -3,6 +3,7 @@ mod assistant_settings;
use anyhow::Result;
pub use assistant::AssistantPanel;
use assistant_settings::OpenAIModel;
use chrono::{DateTime, Local};
use collections::HashMap;
use fs::Fs;
@ -60,7 +61,7 @@ struct SavedConversation {
messages: Vec<SavedMessage>,
message_metadata: HashMap<MessageId, MessageMetadata>,
summary: String,
model: String,
model: OpenAIModel,
}
impl SavedConversation {