mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 18:53:58 +01:00
disabled prompt logging
This commit is contained in:
parent
7ae9918758
commit
7fffcf124b
|
@ -34,13 +34,6 @@ async def log_api_request(user: dict, incoming_request, target_url: str):
|
||||||
if 'JSONDecodeError' in str(exc):
|
if 'JSONDecodeError' in str(exc):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
last_prompt = None
|
|
||||||
if 'messages' in payload:
|
|
||||||
last_prompt = payload['messages'][-1]['content'][:50]
|
|
||||||
|
|
||||||
if len(last_prompt) == 50:
|
|
||||||
last_prompt += '...'
|
|
||||||
|
|
||||||
model = payload.get('model')
|
model = payload.get('model')
|
||||||
ip_address = await network.get_ip(incoming_request)
|
ip_address = await network.get_ip(incoming_request)
|
||||||
useragent = await replacer(incoming_request.headers.get('User-Agent'), UA_SIMPLIFY)
|
useragent = await replacer(incoming_request.headers.get('User-Agent'), UA_SIMPLIFY)
|
||||||
|
@ -56,7 +49,6 @@ async def log_api_request(user: dict, incoming_request, target_url: str):
|
||||||
},
|
},
|
||||||
'details': {
|
'details': {
|
||||||
'model': model,
|
'model': model,
|
||||||
'last_prompt': last_prompt,
|
|
||||||
'target_url': target_url
|
'target_url': target_url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,9 +83,9 @@ def test_all():
|
||||||
|
|
||||||
# print(test_server())
|
# print(test_server())
|
||||||
# print(test_api())
|
# print(test_api())
|
||||||
# print(test_library())
|
print(test_library())
|
||||||
# print(test_library_moderation())
|
# print(test_library_moderation())
|
||||||
print(test_models())
|
# print(test_models())
|
||||||
|
|
||||||
def test_api_moderation(model: str=MODEL, messages: List[dict]=None) -> dict:
|
def test_api_moderation(model: str=MODEL, messages: List[dict]=None) -> dict:
|
||||||
"""Tests an API api_endpoint."""
|
"""Tests an API api_endpoint."""
|
||||||
|
|
Loading…
Reference in a new issue