agent: look at current info, its aUEC, feat: pull up notifcations.

This commit is contained in:
2026-05-05 20:05:33 -04:00
parent f7ac45ddd8
commit 761eda6155
11 changed files with 198 additions and 8 deletions
+13 -1
View File
@@ -12,7 +12,9 @@ from traderai.tools import ToolRegistry
SYSTEM_PROMPT = """You are TraderAI, a local assistant for UEX marketplace work.
Use tools when the user asks about listings, negotiations, messages, offers, or posting ads.
Use tools when the user asks about open/current listings, active negotiations, unread notifications, messages, offers, or posting ads.
Prefer open and current UEX marketplace information. Do not use historical sale data, completed sale records, or sale/average-history information unless the user explicitly asks for historical sales.
Treat UEX marketplace prices as in-game aUEC/UEC credits, never real-world dollars, unless the user explicitly says otherwise.
For marketplace writes, draft the exact pending action and tell the user what will be sent; never claim it was sent until approval succeeds.
Keep prices, listing ids, slugs, users, and UEX status codes precise. If data is missing, say what you need next."""
@@ -25,12 +27,14 @@ class OllamaAgent:
tools: ToolRegistry,
memory: MemoryStore | None = None,
user_name: str | None = None,
num_ctx: int | None = None,
) -> None:
self.base_url = base_url.rstrip("/")
self.model = model
self.tools = tools
self.memory = memory
self.user_name = user_name
self.num_ctx = num_ctx
self.messages: list[dict[str, Any]] = [{"role": "system", "content": SYSTEM_PROMPT}]
async def health(self) -> dict[str, Any]:
@@ -165,6 +169,7 @@ class OllamaAgent:
"model": self.model,
"messages": self._messages_with_context(query, previous_interaction=previous_interaction),
"tools": self.tools.schemas,
"options": self._ollama_options(),
"stream": False,
},
)
@@ -184,6 +189,7 @@ class OllamaAgent:
"model": self.model,
"messages": self._messages_with_context(query, previous_interaction=previous_interaction),
"tools": self.tools.schemas,
"options": self._ollama_options(),
"stream": True,
},
) as response:
@@ -258,6 +264,11 @@ class OllamaAgent:
for action in self.tools.pending_actions.values()
]
def _ollama_options(self) -> dict[str, Any]:
if not self.num_ctx:
return {}
return {"num_ctx": self.num_ctx}
@staticmethod
def _tool_status(name: str) -> str:
labels = {
@@ -267,6 +278,7 @@ class OllamaAgent:
"get_negotiation_messages": "Reading negotiation messages",
"draft_negotiation_message": "Drafting message for approval",
"draft_marketplace_listing": "Drafting listing for approval",
"check_uex_notifications": "Checking UEX notifications",
}
return labels.get(name, f"Running {name}")