diff --git a/aiserver.py b/aiserver.py index daeae33c..1802a502 100644 --- a/aiserver.py +++ b/aiserver.py @@ -17,6 +17,7 @@ os.environ['TOKENIZERS_PARALLELISM'] = 'false' from eventlet import tpool import logging +logging.basicConfig(format='%(levelname)s - %(module)s:%(lineno)d - %(message)s',level=logging.WARNING) logging.getLogger("urllib3").setLevel(logging.ERROR) from os import path, getcwd @@ -5207,7 +5208,7 @@ def sendtocluster(txt, min, max): set_aibusy(0) return gen_servers = [(cgen['server_name'],cgen['server_id']) for cgen in js] - print(f"Generations by: {gen_servers}") + print(f"{colors.GREEN}Generations by: {gen_servers}{colors.END}") # Just in case we want to announce it to the user if len(js) == 1: warnmsg = f"Text generated by {js[0]['server_name']}" @@ -7408,6 +7409,7 @@ class GenerationInputSchema(SamplerSettingsSchema): singleline: Optional[bool] = fields.Boolean(metadata={"description": "Output formatting option. When enabled, removes everything after the first line of the output, including the newline.\n\nIf `disable_output_formatting` is `true`, this defaults to `false` instead of the value in the KoboldAI GUI."}) disable_input_formatting: bool = fields.Boolean(load_default=True, metadata={"description": "When enabled, all input formatting options default to `false` instead of the value in the KoboldAI GUI"}) frmtadsnsp: Optional[bool] = fields.Boolean(metadata={"description": "Input formatting option. When enabled, adds a leading space to your input if there is no trailing whitespace at the end of the previous action.\n\nIf `disable_input_formatting` is `true`, this defaults to `false` instead of the value in the KoboldAI GUI."}) + quiet: Optional[bool] = fields.Boolean(metadata={"description": "When enabled, Generated output will not be displayed in the console."}) class GenerationResultSchema(KoboldSchema): text: str = fields.String(required=True, metadata={"description": "Generated output as plain text."}) @@ -7498,6 +7500,10 @@ def _generate_text(body: GenerationInputSchema): "msg": "Server is busy; please try again later.", "type": "service_unavailable", }}), mimetype="application/json", status=503)) + # This maps each property of the setting to use when sending the generate idempotently + # To the object which typically contains it's value + # This allows to set the property only for the API generation, and then revert the setting + # To what it was before. mapping = { "disable_input_formatting": ("vars", "disable_input_formatting", None), "disable_output_formatting": ("vars", "disable_output_formatting", None), @@ -7518,6 +7524,7 @@ def _generate_text(body: GenerationInputSchema): "max_length": ("vars", "genamt", None), "max_context_length": ("vars", "max_length", None), "n": ("vars", "numseqs", None), + "quiet": ("vars", "quiet", None), } saved_settings = {} set_aibusy(1)