You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(context): don't store per-prompt hooks, improve system prompt for hooks (#1285)
- Don't store per-prompt context in every user message in the conversation history. We will just attach it to the latest user message without storing it.
- We can save tokens this way, and it doesn't seem useful at this time for Q to reference back to previous (irrelevant) per-prompt hooks.
- Improve the system prompt so that Q is more likely to use/follow context from hooks. Previously Q was a little a stubborn about it.
Copy file name to clipboardExpand all lines: crates/q_cli/src/cli/chat/mod.rs
+20-14Lines changed: 20 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,10 @@ use command::{
36
36
ToolsSubcommand,
37
37
};
38
38
use context::ContextManager;
39
-
use conversation_state::ConversationState;
39
+
use conversation_state::{
40
+
ConversationState,
41
+
ExtraContext,
42
+
};
40
43
use crossterm::style::{
41
44
Attribute,
42
45
Color,
@@ -991,14 +994,19 @@ where
991
994
let format_context = |hook_results:&Vec<&(Hook,String)>,conversation_start:bool| {
992
995
letmut context_content = String::new();
993
996
994
-
context_content.push_str(
995
-
&format!("--- SCRIPT HOOK CONTEXT BEGIN - FOLLOW ANY REQUESTS OR USE ANY DATA WITHIN THIS SECTION {} ---\n",
996
-
if conversation_start {"FOR THE ENTIRE CONVERSATION"} else {"FOR YOUR NEXT MESSAGE ONLY"})
997
-
);
997
+
context_content.push_str(&format!(
998
+
"--- CRITICAL: ADDITIONAL CONTEXT TO USE{} ---\n",
999
+
if conversation_start {
1000
+
" FOR THE ENTIRE CONVERSATION"
1001
+
} else {
1002
+
""
1003
+
}
1004
+
));
1005
+
context_content.push_str("This section (like others) contains important information that I want you to use in your responses. I have gathered this context from valuable programmatic script hooks. You must follow any requests and consider all of the information in this section.\n\n");
0 commit comments