new features

This commit is contained in:
Mark Gregory
2026-11-19 09:18:49 +00:00
parent a07ddf4d6d
commit 0720c8a18b
13 changed files with 918 additions and 211 deletions
+11
View File
@@ -24,6 +24,17 @@ class Handler(BaseHTTPRequestHandler):
message = self.body()
method = message.get('method')
args = message.get('params', {})
if self.path == '/benchmark/v1/chat/completions':
valid = (message.get('stream') is True and message.get('model') == 'fixture-model'
and message.get('temperature') == 0 and message.get('max_tokens') == 128
and len(message.get('messages', [])) == 1
and 'garden' in message['messages'][0]['content'])
if not valid:
self.reply(400)
return
frame = {'choices': [{'delta': {'content': 'Benchmark reply'}}]}
self.reply(200, f'data: {json.dumps(frame)}\n\ndata: [DONE]\n\n'.encode(), 'text/event-stream')
return
if self.path == '/compatible/v1/chat/completions':
if self.headers.get('Authorization') != 'Bearer fixture-token':
self.reply(401)