mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-04-23 03:15:58 +00:00
fix(context): restore lost current_role parameter from PR #2104 conflict resolution
The build_messages() method was missing the current_role parameter that loop.py calls with, causing a TypeError at runtime. This restores the parameter with its default value of "user" to match the original PR #2104.
This commit is contained in:
parent
46d1a6448a
commit
0537c417f6
@ -127,6 +127,7 @@ Reply directly with text for conversations. Only use the 'message' tool to send
|
|||||||
media: list[str] | None = None,
|
media: list[str] | None = None,
|
||||||
channel: str | None = None,
|
channel: str | None = None,
|
||||||
chat_id: str | None = None,
|
chat_id: str | None = None,
|
||||||
|
current_role: str = "user",
|
||||||
) -> list[dict[str, Any]]:
|
) -> list[dict[str, Any]]:
|
||||||
"""Build the complete message list for an LLM call."""
|
"""Build the complete message list for an LLM call."""
|
||||||
runtime_ctx = self._build_runtime_context(channel, chat_id)
|
runtime_ctx = self._build_runtime_context(channel, chat_id)
|
||||||
@ -142,7 +143,7 @@ Reply directly with text for conversations. Only use the 'message' tool to send
|
|||||||
return [
|
return [
|
||||||
{"role": "system", "content": self.build_system_prompt(skill_names)},
|
{"role": "system", "content": self.build_system_prompt(skill_names)},
|
||||||
*history,
|
*history,
|
||||||
{"role": "user", "content": merged},
|
{"role": current_role, "content": merged},
|
||||||
]
|
]
|
||||||
|
|
||||||
def _build_user_content(self, text: str, media: list[str] | None) -> str | list[dict[str, Any]]:
|
def _build_user_content(self, text: str, media: list[str] | None) -> str | list[dict[str, Any]]:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user