Skip to content

Commit 75dfad2

Browse files
committed
fixed noscript (+1 squashed commits)
Squashed commits: [dba2839] fixed noscript
1 parent 12c2efd commit 75dfad2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

koboldcpp.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,7 +2632,8 @@ def noscript_webui(self):
26322632
bodycontent += f'''<p>Generated Image: {prompt if prompt else "None"}</p>
26332633
{'<img src="view.png" width="320" width="320">' if prompt else ""}<br>
26342634
<label>Image Prompt: </label><input type="text" size="40" value="" name="imgprompt">
2635-
<input type="submit" name="generate" value="Generate"> (Be patient)'''
2635+
<input type="hidden" name="generate" value="Generate" />
2636+
<input type="submit" value="Generate"> (Be patient)'''
26362637
elif chatmode:
26372638
oldconvo = prompt.strip().replace(f"{human_name}:",f"<b>{human_name}:</b>").replace(f"{bot_name}:",f"<b>{bot_name}:</b>").replace("\n","<br>")
26382639
oldconvo += f'''<input type="hidden" name="human_name" value="{human_name}"><input type="hidden" name="bot_name" value="{bot_name}">'''
@@ -2643,11 +2644,13 @@ def noscript_webui(self):
26432644
bodycontent += f'''<p>{newconvo if prompt=="" else oldconvo}</p>
26442645
<input type="hidden" name="prompt" value="{clnprompt}">
26452646
<label>Say: </label><input type="text" size="40" value="" name="chatmsg">
2646-
<input type="submit" name="generate" value="Send"> (Be patient)'''
2647+
<input type="hidden" name="generate" value="Send" />
2648+
<input type="submit" value="Send"> (Be patient)'''
26472649
else:
26482650
bodycontent += f'''
26492651
<textarea name="prompt" cols="60" rows="8" wrap="soft" placeholder="Enter Prompt Here">{prompt}</textarea><br>
2650-
<input type="submit" name="generate" value="Generate"> (Be patient)
2652+
<input type="hidden" name="generate" value="Generate" />
2653+
<input type="submit" value="Generate"> (Be patient)
26512654
'''
26522655
if not imgmode:
26532656
optionscontent = f'''<label>Gen. Amount</label> <input type="text" size="4" value="{max_length}" name="max_length"><br>
@@ -2660,6 +2663,7 @@ def noscript_webui(self):
26602663
optionscontent = f'''<label>Steps</label> <input type="text" size="4" value="{steps}" name="steps"><br>
26612664
<label>Cfg. Scale</label> <input type="text" size="4" value="{cfg}" name="cfg"><br>'''
26622665

2666+
caps = get_capabilities()
26632667
finalhtml = f'''<!doctype html>
26642668
<html lang="en"><head>
26652669
<meta charset="utf-8">
@@ -2688,7 +2692,7 @@ def noscript_webui(self):
26882692
<input type="hidden" name="chatmode" value="1">
26892693
<input type="submit" value="Chat Mode">
26902694
</form>
2691-
{imgbtn if "txt2img" in get_capabilities() else ""}
2695+
{imgbtn if ("txt2img" in caps and caps["txt2img"]) else ""}
26922696
</div>
26932697
</div>
26942698
</body></html>'''

0 commit comments

Comments
 (0)