Add support for interacting with Claude in the assistant panel (#11798)

Release Notes:

- Added support for interacting with Claude in the assistant panel. You
can enable it by adding the following to your `settings.json`:

    ```json
    "assistant": {
        "version": "1",
        "provider": {
            "name": "anthropic"
        }
    }
    ```
This commit is contained in:
Antonio Scandurra 2024-05-14 15:57:52 +02:00 committed by GitHub
parent 019d98898e
commit 5944caaa90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 446 additions and 21 deletions

View file

@ -1,5 +1,6 @@
use std::fmt;
pub use anthropic::Model as AnthropicModel;
use gpui::Pixels;
pub use open_ai::Model as OpenAiModel;
use schemars::{
@ -161,6 +162,15 @@ pub enum AssistantProvider {
#[serde(default)]
low_speed_timeout_in_seconds: Option<u64>,
},
#[serde(rename = "anthropic")]
Anthropic {
#[serde(default)]
default_model: AnthropicModel,
#[serde(default = "anthropic_api_url")]
api_url: String,
#[serde(default)]
low_speed_timeout_in_seconds: Option<u64>,
},
}
impl Default for AssistantProvider {
@ -172,7 +182,11 @@ impl Default for AssistantProvider {
}
fn open_ai_url() -> String {
"https://api.openai.com/v1".into()
open_ai::OPEN_AI_API_URL.to_string()
}
fn anthropic_api_url() -> String {
anthropic::ANTHROPIC_API_URL.to_string()
}
#[derive(Default, Debug, Deserialize, Serialize)]