fix(gateway): remove app-specific Athabasca references from vision enrichment (#1529)
Salvaged from PR #1428 by jplew. Removes Athabasca-specific persistence guidance accidentally merged in PR #1422: - Drop Athabasca docstring and injected note from _enrich_message_with_vision - Delete tests/gateway/test_image_enrichment.py (asserted app-specific behavior) Co-authored-by: jplew <jplew@users.noreply.github.com>
This commit is contained in:
parent
ee579af566
commit
ce660a4413
2 changed files with 2 additions and 37 deletions
|
|
@ -3620,13 +3620,9 @@ class GatewayRunner:
|
||||||
1. Immediately understand what the user sent (no extra tool call).
|
1. Immediately understand what the user sent (no extra tool call).
|
||||||
2. Re-examine the image with vision_analyze if it needs more detail.
|
2. Re-examine the image with vision_analyze if it needs more detail.
|
||||||
|
|
||||||
Athabasca persistence should happen through Athabasca's own POST
|
|
||||||
/api/uploads flow, using the returned asset.publicUrl rather than local
|
|
||||||
cache paths.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
user_text: The user's original caption / message text.
|
user_text: The user's original caption / message text.
|
||||||
image_paths: List of local file paths to cached images.
|
image_paths: List of local file paths to cached images.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The enriched message string with vision descriptions prepended.
|
The enriched message string with vision descriptions prepended.
|
||||||
|
|
@ -3651,16 +3647,10 @@ class GatewayRunner:
|
||||||
result = _json.loads(result_json)
|
result = _json.loads(result_json)
|
||||||
if result.get("success"):
|
if result.get("success"):
|
||||||
description = result.get("analysis", "")
|
description = result.get("analysis", "")
|
||||||
athabasca_note = (
|
|
||||||
"\n[If this image needs to persist in Athabasca state, upload the cached file "
|
|
||||||
"through Athabasca POST /api/uploads and use the returned asset.publicUrl. "
|
|
||||||
"Do not store the local cache path as the canonical imageUrl.]"
|
|
||||||
)
|
|
||||||
enriched_parts.append(
|
enriched_parts.append(
|
||||||
f"[The user sent an image~ Here's what I can see:\n{description}]\n"
|
f"[The user sent an image~ Here's what I can see:\n{description}]\n"
|
||||||
f"[If you need a closer look, use vision_analyze with "
|
f"[If you need a closer look, use vision_analyze with "
|
||||||
f"image_url: {path} ~]"
|
f"image_url: {path} ~]"
|
||||||
f"{athabasca_note}"
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
enriched_parts.append(
|
enriched_parts.append(
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
from unittest.mock import patch
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
|
||||||
async def test_image_enrichment_uses_athabasca_upload_guidance_without_stale_r2_warning():
|
|
||||||
from gateway.run import GatewayRunner
|
|
||||||
|
|
||||||
runner = object.__new__(GatewayRunner)
|
|
||||||
|
|
||||||
with patch(
|
|
||||||
"tools.vision_tools.vision_analyze_tool",
|
|
||||||
return_value='{"success": true, "analysis": "A painted serpent warrior."}',
|
|
||||||
):
|
|
||||||
enriched = await runner._enrich_message_with_vision(
|
|
||||||
"caption",
|
|
||||||
["/tmp/test.jpg"],
|
|
||||||
)
|
|
||||||
|
|
||||||
assert "R2 not configured" not in enriched
|
|
||||||
assert "Gateway media URL available for reference" not in enriched
|
|
||||||
assert "POST /api/uploads" in enriched
|
|
||||||
assert "Do not store the local cache path" in enriched
|
|
||||||
assert "caption" in enriched
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue