Generate German prompt title and archive metadata
This commit is contained in:
+13
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user