port ai crate to ai2, with all tests passing
This commit is contained in:
parent
204aba07f6
commit
04ab68502b
22 changed files with 1930 additions and 0 deletions
17
crates/ai2/src/auth.rs
Normal file
17
crates/ai2/src/auth.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
use async_trait::async_trait;
|
||||
use gpui2::AppContext;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum ProviderCredential {
|
||||
Credentials { api_key: String },
|
||||
NoCredentials,
|
||||
NotNeeded,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
pub trait CredentialProvider: Send + Sync {
|
||||
fn has_credentials(&self) -> bool;
|
||||
async fn retrieve_credentials(&self, cx: &mut AppContext) -> ProviderCredential;
|
||||
async fn save_credentials(&self, cx: &mut AppContext, credential: ProviderCredential);
|
||||
async fn delete_credentials(&self, cx: &mut AppContext);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue