mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Add basic authentication option for webUI image generation
This commit is contained in:
@@ -9932,7 +9932,12 @@ def text2img_api(prompt, art_guide="") -> Image.Image:
|
||||
logger.debug(final_imgen_params)
|
||||
|
||||
try:
|
||||
submit_req = requests.post(url=apiaddress, data=payload_json)
|
||||
logger.info("Gen Image API: Username: {}".format(koboldai_vars.img_gen_api_username))
|
||||
if koboldai_vars.img_gen_api_username != "":
|
||||
basic = requests.auth.HTTPBasicAuth(koboldai_vars.img_gen_api_username, koboldai_vars.img_gen_api_password)
|
||||
submit_req = requests.post(url=apiaddress, data=payload_json, auth=basic)
|
||||
else:
|
||||
submit_req = requests.post(url=apiaddress, data=payload_json)
|
||||
except requests.exceptions.ConnectionError:
|
||||
show_error_notification(
|
||||
"SD Web API Failure",
|
||||
|
@@ -623,6 +623,34 @@ gensettingstf = [
|
||||
"ui_level": 2
|
||||
},
|
||||
{
|
||||
"UI_V2_Only": True,
|
||||
"uitype": "text",
|
||||
"unit": "text",
|
||||
"label": "Img API Username",
|
||||
"id": "img_gen_api_username",
|
||||
"default": "",
|
||||
"tooltip": "If your web-ui is behind basic web authentication, enter the username here",
|
||||
"menu_path": "Interface",
|
||||
"sub_path": "Images",
|
||||
"classname": "user",
|
||||
"name": "img_gen_api_username",
|
||||
"ui_level": 2
|
||||
},
|
||||
{
|
||||
"UI_V2_Only": True,
|
||||
"uitype": "password",
|
||||
"unit": "text",
|
||||
"label": "Img API Password",
|
||||
"id": "img_gen_api_password",
|
||||
"default": "",
|
||||
"tooltip": "If your web-ui is behind basic web authentication, enter the password here",
|
||||
"menu_path": "Interface",
|
||||
"sub_path": "Images",
|
||||
"classname": "user",
|
||||
"name": "img_gen_api_password",
|
||||
"ui_level": 2
|
||||
},
|
||||
{
|
||||
"UI_V2_Only": True,
|
||||
"uitype": "text",
|
||||
"unit": "text",
|
||||
@@ -740,7 +768,7 @@ gensettingstf = [
|
||||
},
|
||||
{
|
||||
"UI_V2_Only": True,
|
||||
"uitype": "text",
|
||||
"uitype": "password",
|
||||
"unit": "text",
|
||||
"label": "Privacy Password",
|
||||
"id": "privacy_password",
|
||||
|
@@ -1164,6 +1164,8 @@ class user_settings(settings):
|
||||
self.img_gen_api_url = "http://127.0.0.1:7860"
|
||||
self.img_gen_art_guide = "masterpiece, digital painting, <|>, dramatic lighting, highly detailed, trending"
|
||||
self.img_gen_negative_prompt = "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, artist name"
|
||||
self.img_gen_api_username = ""
|
||||
self.img_gen_api_password = ""
|
||||
self.img_gen_steps = 30
|
||||
self.img_gen_cfg_scale = 7.0
|
||||
self.cluster_requested_models = [] # The models which we allow to generate during cluster mode
|
||||
|
@@ -474,7 +474,7 @@
|
||||
</div>
|
||||
<div id="settings_footer" class="settings_footer">
|
||||
<span>Execution Time: <span id="Execution Time"></span></span> |
|
||||
<span>Remaining Time: <span class="var_sync_model_tqdm_rem_time"></span></span> |
|
||||
<span>Remaining Time: <span class="var_sync_model_tqdm_rem_time"></span></span> | <span class="var_sync_actions_Action_Count"></span>
|
||||
<a onclick='socket.emit("get_log", {});openPopup("log-popup");' class='cursor'>Log</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -31,6 +31,8 @@
|
||||
<option value="{{ option['value'] }}">{{ option["text"] }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% elif item['uitype'] == "password" %}
|
||||
<input type=password id="{{ item['classname'] }}_{{ item['name'] }}" class="settings_select var_sync_{{ item['classname'] }}_{{ item['name'] }}" onchange='sync_to_server(this);' value='{{ item['default'] }}'>
|
||||
{% elif item['uitype'] == "text" %}
|
||||
<input id="{{ item['classname'] }}_{{ item['name'] }}" class="settings_select var_sync_{{ item['classname'] }}_{{ item['name'] }}" onchange='sync_to_server(this);' value='{{ item['default'] }}'>
|
||||
{% endif %}
|
||||
|
Reference in New Issue
Block a user