mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-26 21:51:03 +02:00
Fix non-backward-compatible agent changes
This commit is contained in:
parent
f22bf13aa6
commit
fed54795ac
2 changed files with 14 additions and 6 deletions
|
|
@ -132,16 +132,24 @@ class FlowInstance:
|
||||||
input
|
input
|
||||||
)["response"]
|
)["response"]
|
||||||
|
|
||||||
def agent(self, question, user="trustgraph", state="", group=None, history=None):
|
def agent(self, question, user="trustgraph", state=None, group=None, history=None):
|
||||||
|
|
||||||
# The input consists of a question and optional context
|
# The input consists of a question and optional context
|
||||||
input = {
|
input = {
|
||||||
"question": question,
|
"question": question,
|
||||||
"user": user,
|
"user": user,
|
||||||
"state": state,
|
|
||||||
"group": group or [],
|
|
||||||
"history": history or []
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Only include state if it has a value
|
||||||
|
if state is not None:
|
||||||
|
input["state"] = state
|
||||||
|
|
||||||
|
# Only include group if it has a value
|
||||||
|
if group is not None:
|
||||||
|
input["group"] = group
|
||||||
|
|
||||||
|
# Always include history (empty list if None)
|
||||||
|
input["history"] = history or []
|
||||||
|
|
||||||
return self.request(
|
return self.request(
|
||||||
"service/agent",
|
"service/agent",
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ class AgentRequestTranslator(MessageTranslator):
|
||||||
def to_pulsar(self, data: Dict[str, Any]) -> AgentRequest:
|
def to_pulsar(self, data: Dict[str, Any]) -> AgentRequest:
|
||||||
return AgentRequest(
|
return AgentRequest(
|
||||||
question=data["question"],
|
question=data["question"],
|
||||||
state=data.get("state", ""),
|
state=data.get("state", None),
|
||||||
group=data.get("group", []),
|
group=data.get("group", None),
|
||||||
history=data.get("history", []),
|
history=data.get("history", []),
|
||||||
user=data.get("user", "trustgraph")
|
user=data.get("user", "trustgraph")
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue