Use connected knowledge and Gitea from chat
This commit is contained in:
@@ -40,6 +40,17 @@ class Handler(BaseHTTPRequestHandler):
|
||||
payload = ''.join(f'data: {json.dumps(frame)}\n\n' for frame in frames)
|
||||
self.reply(200, (payload + 'data: [DONE]\n\n').encode(), 'text/event-stream')
|
||||
return
|
||||
if self.path == '/chat-tools/api/chat':
|
||||
system, user = message['messages']
|
||||
valid = (system['role'] == 'system' and 'fixture/visible-repo' in system['content']
|
||||
and 'source: knowledge.md' in system['content']
|
||||
and user == {'role': 'user', 'content': 'can you see my git repos'})
|
||||
if not valid:
|
||||
self.reply(400)
|
||||
return
|
||||
self.reply(200, b'{"message":{"content":"Repository and knowledge received."},"done":true}\n',
|
||||
'application/x-ndjson')
|
||||
return
|
||||
if self.path == '/gateway/api/chat':
|
||||
if self.headers.get('Authorization') != 'Bearer fixture-token':
|
||||
self.reply(401)
|
||||
|
||||
Reference in New Issue
Block a user