Use the same prompt as agent thread summary for text threads (#35669)
This was causing text thread summarization to be counted as a usage of 1 prompt Release Notes: - Fixed bug with agent text threads (not chat threads) counting summarization as a usage of 1 prompt. Co-authored-by: Oleksiy <oleksiy@zed.dev>
This commit is contained in:
parent
42699411f6
commit
86957a5614
3 changed files with 7 additions and 9 deletions
|
@ -8,7 +8,7 @@ use crate::{
|
||||||
},
|
},
|
||||||
tool_use::{PendingToolUse, ToolUse, ToolUseMetadata, ToolUseState},
|
tool_use::{PendingToolUse, ToolUse, ToolUseMetadata, ToolUseState},
|
||||||
};
|
};
|
||||||
use agent_settings::{AgentProfileId, AgentSettings, CompletionMode};
|
use agent_settings::{AgentProfileId, AgentSettings, CompletionMode, SUMMARIZE_THREAD_PROMPT};
|
||||||
use anyhow::{Result, anyhow};
|
use anyhow::{Result, anyhow};
|
||||||
use assistant_tool::{ActionLog, AnyToolCard, Tool, ToolWorkingSet};
|
use assistant_tool::{ActionLog, AnyToolCard, Tool, ToolWorkingSet};
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
|
@ -2112,12 +2112,10 @@ impl Thread {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let added_user_message = include_str!("./prompts/summarize_thread_prompt.txt");
|
|
||||||
|
|
||||||
let request = self.to_summarize_request(
|
let request = self.to_summarize_request(
|
||||||
&model.model,
|
&model.model,
|
||||||
CompletionIntent::ThreadSummarization,
|
CompletionIntent::ThreadSummarization,
|
||||||
added_user_message.into(),
|
SUMMARIZE_THREAD_PROMPT.into(),
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,9 @@ use std::borrow::Cow;
|
||||||
|
|
||||||
pub use crate::agent_profile::*;
|
pub use crate::agent_profile::*;
|
||||||
|
|
||||||
|
pub const SUMMARIZE_THREAD_PROMPT: &str =
|
||||||
|
include_str!("../../agent/src/prompts/summarize_thread_prompt.txt");
|
||||||
|
|
||||||
pub fn init(cx: &mut App) {
|
pub fn init(cx: &mut App) {
|
||||||
AgentSettings::register(cx);
|
AgentSettings::register(cx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
mod assistant_context_tests;
|
mod assistant_context_tests;
|
||||||
mod context_store;
|
mod context_store;
|
||||||
|
|
||||||
use agent_settings::AgentSettings;
|
use agent_settings::{AgentSettings, SUMMARIZE_THREAD_PROMPT};
|
||||||
use anyhow::{Context as _, Result, bail};
|
use anyhow::{Context as _, Result, bail};
|
||||||
use assistant_slash_command::{
|
use assistant_slash_command::{
|
||||||
SlashCommandContent, SlashCommandEvent, SlashCommandLine, SlashCommandOutputSection,
|
SlashCommandContent, SlashCommandEvent, SlashCommandLine, SlashCommandOutputSection,
|
||||||
|
@ -2688,10 +2688,7 @@ impl AssistantContext {
|
||||||
let mut request = self.to_completion_request(Some(&model.model), cx);
|
let mut request = self.to_completion_request(Some(&model.model), cx);
|
||||||
request.messages.push(LanguageModelRequestMessage {
|
request.messages.push(LanguageModelRequestMessage {
|
||||||
role: Role::User,
|
role: Role::User,
|
||||||
content: vec![
|
content: vec![SUMMARIZE_THREAD_PROMPT.into()],
|
||||||
"Generate a concise 3-7 word title for this conversation, omitting punctuation. Go straight to the title, without any preamble and prefix like `Here's a concise suggestion:...` or `Title:`"
|
|
||||||
.into(),
|
|
||||||
],
|
|
||||||
cache: false,
|
cache: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue