mirror of
https://github.com/mruwnik/memory.git
synced 2025-11-13 08:14:05 +01:00
properly handle bot prompts
This commit is contained in:
parent
afdff1708b
commit
9182f15c45
@ -260,11 +260,13 @@ def call_llm(
|
|||||||
if allowed_tools is not None:
|
if allowed_tools is not None:
|
||||||
tools = {name: tool for name, tool in tools.items() if name in allowed_tools}
|
tools = {name: tool for name, tool in tools.items() if name in allowed_tools}
|
||||||
|
|
||||||
|
if bot_user.system_prompt:
|
||||||
|
system_prompt = bot_user.system_prompt + "\n\n" + (system_prompt or "")
|
||||||
message_content = [m.as_content() for m in prev_messages] + messages
|
message_content = [m.as_content() for m in prev_messages] + messages
|
||||||
return provider.run_with_tools(
|
return provider.run_with_tools(
|
||||||
messages=provider.as_messages(message_content),
|
messages=provider.as_messages(message_content),
|
||||||
tools=tools,
|
tools=tools,
|
||||||
system_prompt=bot_user.system_prompt + "\n\n" + system_prompt,
|
system_prompt=system_prompt,
|
||||||
max_iterations=settings.DISCORD_MAX_TOOL_CALLS,
|
max_iterations=settings.DISCORD_MAX_TOOL_CALLS,
|
||||||
).response
|
).response
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user