versioning: 0.0.6, ux: move buttons, feat: add cloud providers, feat: increese tool call limit
Build Release EXE / build-windows-exe (release) Successful in 51s
Build Release EXE / build-windows-exe (release) Successful in 51s
This commit is contained in:
@@ -64,6 +64,19 @@ class TitleAgent(OllamaAgent):
|
||||
return {"message": {"role": "assistant", "content": "Done"}}
|
||||
|
||||
|
||||
class ImageCaptureAgent(OllamaAgent):
|
||||
def __init__(self, memory):
|
||||
super().__init__("http://127.0.0.1:1", "missing-model", EmptyTools(), memory=memory)
|
||||
self.last_messages = None
|
||||
|
||||
async def ensure_available(self):
|
||||
return None
|
||||
|
||||
async def _chat_once(self, query="", messages=None, **kwargs):
|
||||
self.last_messages = messages
|
||||
return {"message": {"role": "assistant", "content": "Seen"}}
|
||||
|
||||
|
||||
class SlowToolTools(EmptyTools):
|
||||
schemas = [
|
||||
{
|
||||
@@ -229,6 +242,23 @@ async def test_first_chat_message_generates_thread_title(tmp_path):
|
||||
assert memory.get_thread(thread["id"])["title"] == "UEX Market Check"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_chat_includes_pasted_images_and_memory_note(tmp_path):
|
||||
memory = MemoryStore(str(tmp_path / "memory.sqlite3"))
|
||||
agent = ImageCaptureAgent(memory)
|
||||
|
||||
result = await agent.chat(
|
||||
"",
|
||||
images=[{"name": "listing.png", "content_type": "image/png", "image_data": "ZmFrZS1pbWFnZQ=="}],
|
||||
)
|
||||
|
||||
assert result["message"] == "Seen"
|
||||
user_message = next(message for message in reversed(agent.last_messages) if message.get("role") == "user")
|
||||
assert user_message["images"] == ["ZmFrZS1pbWFnZQ=="]
|
||||
assert user_message["content"] == "Please analyze the attached image."
|
||||
assert "[Attached 1 pasted image]" in memory.recent_conversation()[-2]["content"]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_chat_events_returns_fallback_after_slow_tool_and_empty_final_response(tmp_path):
|
||||
memory = MemoryStore(str(tmp_path / "memory.sqlite3"))
|
||||
|
||||
@@ -497,6 +497,32 @@ async def test_draft_marketplace_listing_with_cornerstone_image_adds_image_data_
|
||||
assert pending["metadata"]["cornerstone_image_status"] == "included"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_draft_marketplace_listing_can_reuse_pasted_chat_image():
|
||||
registry = ToolRegistry(FakeUEX())
|
||||
|
||||
with registry.chat_image_scope([{"name": "listing.png", "content_type": "image/png", "image_data": "ZmFrZS1pbWFnZQ=="}]):
|
||||
result = await registry.draft_marketplace_listing(
|
||||
id_category=3,
|
||||
operation="sell",
|
||||
type="item",
|
||||
unit="unit",
|
||||
title="Abrade Scraper Module",
|
||||
description="Clean module, ready for pickup.",
|
||||
price=21250,
|
||||
currency="UEC",
|
||||
language="en_US",
|
||||
use_attached_image=True,
|
||||
)
|
||||
|
||||
pending = result["pending_action"]
|
||||
stored = registry.pending_actions[pending["id"]]
|
||||
assert pending["payload"]["image_data"].startswith("<base64 image data redacted")
|
||||
assert stored.payload["image_data"] == "ZmFrZS1pbWFnZQ=="
|
||||
assert pending["metadata"]["attached_chat_image_name"] == "listing.png"
|
||||
assert pending["metadata"]["attached_chat_image_status"] == "included"
|
||||
|
||||
|
||||
def test_parse_cornerstone_item_page_extracts_locations():
|
||||
parsed = parse_cornerstone_item_page(
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user