mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-01-28 08:09:30 +01:00
OAI Redo Fix
This commit is contained in:
parent
965b5b5b04
commit
b5a633e69b
20
aiserver.py
20
aiserver.py
@ -4405,15 +4405,23 @@ def oairequest(txt, min, max):
|
|||||||
if not vars.quiet:
|
if not vars.quiet:
|
||||||
print("{0}{1}{2}".format(colors.CYAN, genout, colors.END))
|
print("{0}{1}{2}".format(colors.CYAN, genout, colors.END))
|
||||||
vars.actions.append(genout)
|
vars.actions.append(genout)
|
||||||
if vars.actions.get_last_key() in vars.actions_metadata:
|
# we now need to update the actions_metadata
|
||||||
|
# we'll have two conditions.
|
||||||
|
# 1. This is totally new (user entered)
|
||||||
|
if vars.actions.get_last_key() not in vars.actions_metadata:
|
||||||
vars.actions_metadata[vars.actions.get_last_key()] = {"Selected Text": genout, "Alternative Text": []}
|
vars.actions_metadata[vars.actions.get_last_key()] = {"Selected Text": genout, "Alternative Text": []}
|
||||||
else:
|
else:
|
||||||
# 2. We've selected a chunk of text that is was presented previously
|
# 2. We've selected a chunk of text that is was presented previously
|
||||||
alternatives = [item['Text'] for item in vars.actions_metadata[vars.actions.get_last_key()]["Alternative Text"]]
|
try:
|
||||||
if genout in alternatives:
|
alternatives = [item['Text'] for item in vars.actions_metadata[len(vars.actions)-1]["Alternative Text"]]
|
||||||
alternatives = [item for item in vars.actions_metadata[vars.actions.get_last_key() ]["Alternative Text"] if item['Text'] != genout]
|
except:
|
||||||
vars.actions_metadata[vars.actions.get_last_key() ]["Alternative Text"] = alternatives
|
print(len(vars.actions))
|
||||||
vars.actions_metadata[vars.actions.get_last_key() ]["Selected Text"] = genout
|
print(vars.actions_metadata)
|
||||||
|
raise
|
||||||
|
if data in alternatives:
|
||||||
|
alternatives = [item for item in vars.actions_metadata[vars.actions.get_last_key() ]["Alternative Text"] if item['Text'] != data]
|
||||||
|
vars.actions_metadata[vars.actions.get_last_key()]["Alternative Text"] = alternatives
|
||||||
|
vars.actions_metadata[vars.actions.get_last_key()]["Selected Text"] = genout
|
||||||
update_story_chunk('last')
|
update_story_chunk('last')
|
||||||
emit('from_server', {'cmd': 'texteffect', 'data': vars.actions.get_last_key() + 1 if len(vars.actions) else 0}, broadcast=True)
|
emit('from_server', {'cmd': 'texteffect', 'data': vars.actions.get_last_key() + 1 if len(vars.actions) else 0}, broadcast=True)
|
||||||
send_debug()
|
send_debug()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user