mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Fix
This commit is contained in:
@@ -253,7 +253,7 @@ class koboldai_vars(object):
|
|||||||
used_tokens+=wi_length
|
used_tokens+=wi_length
|
||||||
used_world_info.append(wi['uid'])
|
used_world_info.append(wi['uid'])
|
||||||
self.worldinfo_v2.set_world_info_used(wi['uid'])
|
self.worldinfo_v2.set_world_info_used(wi['uid'])
|
||||||
wi_text = wi['content']+" " if wi['content'][-1] not in [" ", "\n"] else wi['content']
|
wi_text = wi['content']+" " if wi['content'] != "" and wi['content'][-1] not in [" ", "\n"] else wi['content']
|
||||||
wi_tokens = self.tokenizer.encode(wi_text)
|
wi_tokens = self.tokenizer.encode(wi_text)
|
||||||
context.append({
|
context.append({
|
||||||
"type": "world_info",
|
"type": "world_info",
|
||||||
@@ -309,7 +309,7 @@ class koboldai_vars(object):
|
|||||||
if used_tokens+wi_length <= token_budget:
|
if used_tokens+wi_length <= token_budget:
|
||||||
used_tokens+=wi_length
|
used_tokens+=wi_length
|
||||||
used_world_info.append(wi['uid'])
|
used_world_info.append(wi['uid'])
|
||||||
wi_text = wi['content']+" " if wi['content'][-1] not in [" ", "\n"] else wi['content']
|
wi_text = wi['content']+" " if wi['content'] != "" and wi['content'][-1] not in [" ", "\n"] else wi['content']
|
||||||
wi_tokens = self.tokenizer.encode(wi_text)
|
wi_tokens = self.tokenizer.encode(wi_text)
|
||||||
context.append({
|
context.append({
|
||||||
"type": "world_info",
|
"type": "world_info",
|
||||||
@@ -398,7 +398,7 @@ class koboldai_vars(object):
|
|||||||
if used_tokens+wi_length <= token_budget:
|
if used_tokens+wi_length <= token_budget:
|
||||||
used_tokens+=wi_length
|
used_tokens+=wi_length
|
||||||
used_world_info.append(wi['uid'])
|
used_world_info.append(wi['uid'])
|
||||||
wi_text = wi['content']+" " if wi['content'][-1] not in [" ", "\n"] else wi['content']
|
wi_text = wi['content']+" " if wi['content'] != "" and wi['content'][-1] not in [" ", "\n"] else wi['content']
|
||||||
wi_tokens = self.tokenizer.encode(wi_text)
|
wi_tokens = self.tokenizer.encode(wi_text)
|
||||||
if method == 1:
|
if method == 1:
|
||||||
context.append({
|
context.append({
|
||||||
@@ -1144,11 +1144,10 @@ class KoboldStoryRegister(object):
|
|||||||
action = self.actions[action_id]['wi_highlighted_text']
|
action = self.actions[action_id]['wi_highlighted_text']
|
||||||
else:
|
else:
|
||||||
action = self.story_settings.prompt_wi_highlighted_text
|
action = self.story_settings.prompt_wi_highlighted_text
|
||||||
if action['text'] == "":
|
|
||||||
return
|
|
||||||
i=0
|
i=0
|
||||||
while i < len(action):
|
while i < len(action):
|
||||||
if action[i]['WI matches'] is None and key in action[i]['text']:
|
if action[i]['WI matches'] is None and key in action[i]['text'] and action[i]['text'] != "":
|
||||||
chunk = action[i]
|
chunk = action[i]
|
||||||
for j in range(len(chunk['text'])-1, -1, -1):
|
for j in range(len(chunk['text'])-1, -1, -1):
|
||||||
if key in chunk['text'][j:]:
|
if key in chunk['text'][j:]:
|
||||||
|
Reference in New Issue
Block a user