[agents] Show agent sessions on homepage with first-prompt title
Some checks failed
ci / build-and-deploy (push) Has been cancelled
ci / test (push) Has been cancelled

This commit is contained in:
2026-07-31 00:26:58 -04:00
parent 0c92174440
commit eb991dbf0e
3 changed files with 24 additions and 0 deletions

View File

@ -451,6 +451,19 @@ def test_agent_session_list_view(mock_delay, client, user):
assert settings.LLM_MODEL.encode() in response.content
@patch("scrobbles.tasks.scrobble_agent_session_prompt.delay")
def test_homepage_shows_agent_sessions_with_first_prompt_title(mock_delay, client, user):
first_prompt = "tell me about the history of cheese making in europe"
_mk_scrobble(user, in_progress=False, title=first_prompt)
client.force_login(user)
response = client.get(reverse("vrobbler-home"))
assert response.status_code == 200
assert b"Agent Sessions" in response.content
assert first_prompt.encode() in response.content
assert settings.LLM_MODEL.encode() not in response.content
@patch("scrobbles.tasks.scrobble_agent_session_prompt.delay")
def test_agent_session_detail_view(mock_delay, client, user):
scrobble = _mk_scrobble(user, in_progress=True)

View File

@ -102,6 +102,15 @@
<p>No tasks today</p>
{% endif %}
<h3><a href="{% url 'agents:agent_session_list' %}">Agent Sessions</a></h3>
{% if AgentSession %}
{% with scrobbles=AgentSession count=AgentSession_count time=AgentSession_time %}
{% include "scrobbles/_scrobble_table.html" %}
{% endwith %}
{% else %}
<p>No agent sessions today</p>
{% endif %}
<h3><a href="{% url 'videos:video_list' %}">Videos</a></h3>
{% if Video %}
{% with scrobbles=Video count=Video_count time=Video_time %}

View File

@ -7,6 +7,8 @@
<p><em><a href="{{scrobble.media_obj.get_absolute_url}}">{{scrobble.media_obj.title|truncatechars_html:45}} - {% if scrobble.logdata %}{% if scrobble.logdata.title %}{{scrobble.logdata.title}}{% endif %}{% endif %}</a></em></p>
{% elif scrobble.media_type == "GeoLocation" %}
<p><a href="{{scrobble.media_obj.get_absolute_url}}">{{scrobble.media_obj|truncatechars_html:45}} - {{scrobble.logdata.movement_type}}</a></>
{% elif scrobble.media_type == "AgentSession" %}
<p><a href="{{scrobble.media_obj.get_absolute_url}}">{% if scrobble.logdata.title %}{{scrobble.logdata.title|truncatechars_html:100}}{% else %}{{scrobble.media_obj|truncatechars_html:100}}{% endif %}</a></p>
{% else %}
<p><a href="{{scrobble.media_obj.get_absolute_url}}">{{scrobble.media_obj|truncatechars_html:45}}</a></>
{% endif %}