moved authentication for the semantic index into the EmbeddingProvider
This commit is contained in:
parent
1e8b23d8fb
commit
a2c3971ad6
14 changed files with 200 additions and 206 deletions
|
@ -10,7 +10,7 @@ use ai::{
|
|||
auth::ProviderCredential,
|
||||
completion::{CompletionProvider, CompletionRequest},
|
||||
providers::open_ai::{
|
||||
stream_completion, OpenAICompletionProvider, OpenAIRequest, RequestMessage, OPENAI_API_URL,
|
||||
stream_completion, OpenAICompletionProvider, OpenAIRequest, RequestMessage,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -48,7 +48,7 @@ use semantic_index::{SemanticIndex, SemanticIndexStatus};
|
|||
use settings::SettingsStore;
|
||||
use std::{
|
||||
cell::{Cell, RefCell},
|
||||
cmp, env,
|
||||
cmp,
|
||||
fmt::Write,
|
||||
iter,
|
||||
ops::Range,
|
||||
|
@ -210,7 +210,6 @@ impl AssistantPanel {
|
|||
// Defaulting currently to GPT4, allow for this to be set via config.
|
||||
let completion_provider = Box::new(OpenAICompletionProvider::new(
|
||||
"gpt-4",
|
||||
ProviderCredential::NoCredentials,
|
||||
cx.background().clone(),
|
||||
));
|
||||
|
||||
|
@ -298,7 +297,6 @@ impl AssistantPanel {
|
|||
cx: &mut ViewContext<Self>,
|
||||
project: &ModelHandle<Project>,
|
||||
) {
|
||||
let credential = self.credential.borrow().clone();
|
||||
let selection = editor.read(cx).selections.newest_anchor().clone();
|
||||
if selection.start.excerpt_id() != selection.end.excerpt_id() {
|
||||
return;
|
||||
|
@ -330,7 +328,6 @@ impl AssistantPanel {
|
|||
let inline_assist_id = post_inc(&mut self.next_inline_assist_id);
|
||||
let provider = Arc::new(OpenAICompletionProvider::new(
|
||||
"gpt-4",
|
||||
credential,
|
||||
cx.background().clone(),
|
||||
));
|
||||
|
||||
|
|
|
@ -335,7 +335,7 @@ fn strip_markdown_codeblock(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use ai::test::TestCompletionProvider;
|
||||
use ai::test::FakeCompletionProvider;
|
||||
use futures::stream::{self};
|
||||
use gpui::{executor::Deterministic, TestAppContext};
|
||||
use indoc::indoc;
|
||||
|
@ -379,7 +379,7 @@ mod tests {
|
|||
let snapshot = buffer.snapshot(cx);
|
||||
snapshot.anchor_before(Point::new(1, 0))..snapshot.anchor_after(Point::new(4, 5))
|
||||
});
|
||||
let provider = Arc::new(TestCompletionProvider::new());
|
||||
let provider = Arc::new(FakeCompletionProvider::new());
|
||||
let codegen = cx.add_model(|cx| {
|
||||
Codegen::new(
|
||||
buffer.clone(),
|
||||
|
@ -445,7 +445,7 @@ mod tests {
|
|||
let snapshot = buffer.snapshot(cx);
|
||||
snapshot.anchor_before(Point::new(1, 6))
|
||||
});
|
||||
let provider = Arc::new(TestCompletionProvider::new());
|
||||
let provider = Arc::new(FakeCompletionProvider::new());
|
||||
let codegen = cx.add_model(|cx| {
|
||||
Codegen::new(
|
||||
buffer.clone(),
|
||||
|
@ -511,7 +511,7 @@ mod tests {
|
|||
let snapshot = buffer.snapshot(cx);
|
||||
snapshot.anchor_before(Point::new(1, 2))
|
||||
});
|
||||
let provider = Arc::new(TestCompletionProvider::new());
|
||||
let provider = Arc::new(FakeCompletionProvider::new());
|
||||
let codegen = cx.add_model(|cx| {
|
||||
Codegen::new(
|
||||
buffer.clone(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue