Generate German prompt title and archive metadata

This commit is contained in:
Mikei386
2026-09-24 22:44:14 +02:00
parent 9b61bc4b7b
commit ecce09c280
4 changed files with 21 additions and 9 deletions
+13 -2
View File
@@ -20,8 +20,9 @@ def fake_provider(request):
return httpx.Response(200, json={'data': vectors})
if request.url.path == '/v1/chat/completions':
assert data['model'] == 'local-chat'
if 'Ordne' in data['messages'][0]['content']:
return httpx.Response(200, json={'choices': [{'message': {'content': json.dumps({'category': 'Kommunikation', 'tags': ['Kunden'], 'description': 'Höfliche Absage'})}}]})
if 'Create archive metadata' in data['messages'][0]['content']:
assert 'Always write title, description, category and tags in German' in data['messages'][0]['content']
return httpx.Response(200, json={'choices': [{'message': {'content': json.dumps({'title': 'Kundenanfrage höflich absagen', 'category': 'Kommunikation', 'tags': ['Kunden'], 'description': 'Höfliche Absage'})}}]})
return httpx.Response(200, json={'choices': [{'message': {'content': 'Verbessert: {{Kunde}}'}}]})
return httpx.Response(404)
@@ -170,3 +171,13 @@ def test_recheck_endpoint_keeps_draft_and_requires_auth(client):
assert client.get('/api/prompts').json()['items']==[]
client.post('/api/logout')
assert client.post('/api/recheck',json={'body':'original','draft':'draft'}).status_code==401
def test_german_metadata_is_a_proposal_only(client):
configure(client)
before=client.get('/api/prompts').json()
response=client.post('/api/organize',json={'body':'Write a polite rejection email. Reply in English.'})
assert response.status_code == 200
assert response.json()['title'] == 'Kundenanfrage höflich absagen'
assert set(response.json()) == {'title','description','category','tags'}
assert client.get('/api/prompts').json() == before