rename agents/main→assistant, role-based default entry agent
Nightly Build / build (push) Successful in 6m31s
Nightly Build / build (push) Successful in 6m31s
This commit is contained in:
@@ -585,7 +585,9 @@ impl ChatSessionHandler {
|
||||
let stack = match chat_sessions_stack::active_for_session(pool, self.session_id).await? {
|
||||
Some(s) => s,
|
||||
None => {
|
||||
chat_sessions_stack::create(pool, self.session_id, "main", None, 0, None).await?
|
||||
// Lazy root frame: run this session's own entry agent (the same id
|
||||
// `build_agent_config` resolves the prompt from), never a hardcoded default.
|
||||
chat_sessions_stack::create(pool, self.session_id, &self.agent_id, None, 0, None).await?
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -132,8 +132,12 @@ impl ChatSessionManager {
|
||||
if let Some(rc) = run_context {
|
||||
chat_sessions::set_run_context(&self.db, session.id, Some(&rc.to_db())).await?;
|
||||
}
|
||||
// The root stack frame runs the session's own entry agent — not a hardcoded
|
||||
// default. Using the wrong id here would silently run that agent's prompt
|
||||
// regardless of what the session was created with (llm_loop resolves the
|
||||
// prompt from `config.agent_id`, which comes from the stack frame).
|
||||
let stack = chat_sessions_stack::create(
|
||||
&self.db, session.id, "main", None, 0, None,
|
||||
&self.db, session.id, agent_id, None, 0, None,
|
||||
).await?;
|
||||
Ok((session.id, stack.id))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user