Dedupe PromptBuilder construction (#23496)

This PR dedupes the construction of the `PromptBuilder`.

Previously this was constructed by both `assistant` and `assistant2`,
but now we construct it outside and pass it in.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-01-22 17:17:36 -05:00 committed by GitHub
parent aad04e078a
commit 51fcb710d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 36 additions and 35 deletions

View file

@ -25,6 +25,7 @@ use gpui::{
use http_client::{read_proxy_from_env, Uri};
use language::LanguageRegistry;
use log::LevelFilter;
use prompt_library::PromptBuilder;
use reqwest_client::ReqwestClient;
use assets::Assets;
@ -443,16 +444,17 @@ fn main() {
app_state.user_store.clone(),
cx,
);
let prompt_builder = assistant::init(
let prompt_builder = PromptBuilder::load(app_state.fs.clone(), stdout_is_a_pty(), cx);
assistant::init(
app_state.fs.clone(),
app_state.client.clone(),
stdout_is_a_pty(),
prompt_builder.clone(),
cx,
);
assistant2::init(
app_state.fs.clone(),
app_state.client.clone(),
stdout_is_a_pty(),
prompt_builder.clone(),
cx,
);
assistant_tools::init(cx);

View file

@ -3833,8 +3833,13 @@ mod tests {
app_state.fs.clone(),
cx,
);
let prompt_builder =
assistant::init(app_state.fs.clone(), app_state.client.clone(), false, cx);
let prompt_builder = PromptBuilder::load(app_state.fs.clone(), false, cx);
assistant::init(
app_state.fs.clone(),
app_state.client.clone(),
prompt_builder.clone(),
cx,
);
repl::init(app_state.fs.clone(), cx);
repl::notebook::init(cx);
tasks_ui::init(cx);