mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-03-01 18:07:50 +01:00
Allows to specify to the API to go quiet
This commit is contained in:
parent
9405adb885
commit
f97d285f9f
@ -17,6 +17,7 @@ os.environ['TOKENIZERS_PARALLELISM'] = 'false'
|
|||||||
from eventlet import tpool
|
from eventlet import tpool
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
logging.basicConfig(format='%(levelname)s - %(module)s:%(lineno)d - %(message)s',level=logging.WARNING)
|
||||||
logging.getLogger("urllib3").setLevel(logging.ERROR)
|
logging.getLogger("urllib3").setLevel(logging.ERROR)
|
||||||
|
|
||||||
from os import path, getcwd
|
from os import path, getcwd
|
||||||
@ -5207,7 +5208,7 @@ def sendtocluster(txt, min, max):
|
|||||||
set_aibusy(0)
|
set_aibusy(0)
|
||||||
return
|
return
|
||||||
gen_servers = [(cgen['server_name'],cgen['server_id']) for cgen in js]
|
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
|
# Just in case we want to announce it to the user
|
||||||
if len(js) == 1:
|
if len(js) == 1:
|
||||||
warnmsg = f"Text generated by {js[0]['server_name']}"
|
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."})
|
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"})
|
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."})
|
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):
|
class GenerationResultSchema(KoboldSchema):
|
||||||
text: str = fields.String(required=True, metadata={"description": "Generated output as plain text."})
|
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.",
|
"msg": "Server is busy; please try again later.",
|
||||||
"type": "service_unavailable",
|
"type": "service_unavailable",
|
||||||
}}), mimetype="application/json", status=503))
|
}}), 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 = {
|
mapping = {
|
||||||
"disable_input_formatting": ("vars", "disable_input_formatting", None),
|
"disable_input_formatting": ("vars", "disable_input_formatting", None),
|
||||||
"disable_output_formatting": ("vars", "disable_output_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_length": ("vars", "genamt", None),
|
||||||
"max_context_length": ("vars", "max_length", None),
|
"max_context_length": ("vars", "max_length", None),
|
||||||
"n": ("vars", "numseqs", None),
|
"n": ("vars", "numseqs", None),
|
||||||
|
"quiet": ("vars", "quiet", None),
|
||||||
}
|
}
|
||||||
saved_settings = {}
|
saved_settings = {}
|
||||||
set_aibusy(1)
|
set_aibusy(1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user