mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 16:13:58 +01:00
idk
This commit is contained in:
parent
ea35674853
commit
bc5cd7122e
|
@ -86,6 +86,7 @@ async def stream(
|
||||||
'Sorry, the API has no working keys anymore.',
|
'Sorry, the API has no working keys anymore.',
|
||||||
'The admins have been messaged automatically.'
|
'The admins have been messaged automatically.'
|
||||||
)
|
)
|
||||||
|
return
|
||||||
|
|
||||||
for k, v in target_request.get('headers', {}).items():
|
for k, v in target_request.get('headers', {}).items():
|
||||||
headers[k] = v
|
headers[k] = v
|
||||||
|
@ -138,6 +139,7 @@ async def stream(
|
||||||
chunk = f'{chunk.decode("utf8")}\n\n'
|
chunk = f'{chunk.decode("utf8")}\n\n'
|
||||||
chunk = chunk.replace(os.getenv('MAGIC_WORD', 'novaOSScheckKeyword'), payload['model'])
|
chunk = chunk.replace(os.getenv('MAGIC_WORD', 'novaOSScheckKeyword'), payload['model'])
|
||||||
# chunk = chunk.replace(os.getenv('MAGIC_USER_WORD', 'novaOSSuserKeyword'), user['_id'])
|
# chunk = chunk.replace(os.getenv('MAGIC_USER_WORD', 'novaOSSuserKeyword'), user['_id'])
|
||||||
|
print(chunk)
|
||||||
|
|
||||||
if not chunk.strip():
|
if not chunk.strip():
|
||||||
send = False
|
send = False
|
||||||
|
@ -145,7 +147,6 @@ async def stream(
|
||||||
if is_chat and '{' in chunk:
|
if is_chat and '{' in chunk:
|
||||||
data = json.loads(chunk.split('data: ')[1])
|
data = json.loads(chunk.split('data: ')[1])
|
||||||
send = True
|
send = True
|
||||||
print(data)
|
|
||||||
|
|
||||||
if target_request['module'] == 'twa' and data.get('text'):
|
if target_request['module'] == 'twa' and data.get('text'):
|
||||||
chunk = chat.create_chat_chunk(
|
chunk = chat.create_chat_chunk(
|
||||||
|
|
Loading…
Reference in a new issue