move api authentication to embedding provider
This commit is contained in:
parent
997f362cc2
commit
7b63369df2
3 changed files with 13 additions and 7 deletions
|
@ -281,12 +281,8 @@ impl SemanticIndex {
|
|||
settings::get::<SemanticIndexSettings>(cx).enabled
|
||||
}
|
||||
|
||||
pub fn has_api_key(&self) -> bool {
|
||||
OPENAI_API_KEY.as_ref().is_some()
|
||||
}
|
||||
|
||||
pub fn status(&self, project: &ModelHandle<Project>) -> SemanticIndexStatus {
|
||||
if !self.has_api_key() {
|
||||
if !self.embedding_provider.is_authenticated() {
|
||||
return SemanticIndexStatus::NotAuthenticated;
|
||||
}
|
||||
|
||||
|
@ -980,8 +976,8 @@ impl SemanticIndex {
|
|||
project: ModelHandle<Project>,
|
||||
cx: &mut ModelContext<Self>,
|
||||
) -> Task<Result<()>> {
|
||||
if !self.has_api_key() {
|
||||
return Task::ready(Err(anyhow!("no open ai key present")));
|
||||
if !self.embedding_provider.is_authenticated() {
|
||||
return Task::ready(Err(anyhow!("user is not authenticated")));
|
||||
}
|
||||
|
||||
if !self.projects.contains_key(&project.downgrade()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue