API: Add ability to use request IDs
Identify which request is being processed to help users disambiguate which logs correspond to which request. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
parent
38185a1ff4
commit
cae94b920c
6 changed files with 112 additions and 57 deletions
|
|
@ -51,11 +51,13 @@ def log_generation_params(**kwargs):
|
|||
logger.info(f"Generation options: {kwargs}\n")
|
||||
|
||||
|
||||
def log_prompt(prompt: str, negative_prompt: Optional[str]):
|
||||
def log_prompt(prompt: str, request_id: str, negative_prompt: Optional[str]):
|
||||
"""Logs the prompt to console."""
|
||||
if PREFERENCES.prompt:
|
||||
formatted_prompt = "\n" + prompt
|
||||
logger.info(f"Prompt: {formatted_prompt if prompt else 'Empty'}\n")
|
||||
logger.info(
|
||||
f"Prompt (ID: {request_id}): {formatted_prompt if prompt else 'Empty'}\n"
|
||||
)
|
||||
|
||||
if negative_prompt:
|
||||
formatted_negative_prompt = "\n" + negative_prompt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue