mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-05-10 04:00:53 +00:00
minor fix
This commit is contained in:
parent
e469c9f934
commit
faf322c83f
1 changed files with 16 additions and 12 deletions
28
koboldcpp.py
28
koboldcpp.py
|
|
@ -3108,18 +3108,22 @@ ws ::= | " " | "\n" [ \t]{0,20}
|
|||
messages_string += curr_content
|
||||
elif isinstance(curr_content, list): #is an array
|
||||
for item in curr_content:
|
||||
if item['type']=="text":
|
||||
messages_string += item['text']
|
||||
elif item['type']=="image_url":
|
||||
if 'image_url' in item and item['image_url'] and item['image_url']['url'] and item['image_url']['url'].startswith("data:image"):
|
||||
images_added.append(item['image_url']['url'].split(",", 1)[1])
|
||||
attachedimgid += 1
|
||||
messages_string += f"\n(Attached Image {attachedimgid})\n"
|
||||
elif item['type']=="input_audio":
|
||||
if 'input_audio' in item and item['input_audio'] and item['input_audio']['data']:
|
||||
audio_added.append(item['input_audio']['data'])
|
||||
attachedaudid += 1
|
||||
messages_string += f"\n(Attached Audio {attachedaudid})\n"
|
||||
if isinstance(item, dict):
|
||||
if item['type']=="text":
|
||||
messages_string += item['text']
|
||||
elif item['type']=="image_url":
|
||||
if 'image_url' in item and item['image_url'] and item['image_url']['url'] and item['image_url']['url'].startswith("data:image"):
|
||||
images_added.append(item['image_url']['url'].split(",", 1)[1])
|
||||
attachedimgid += 1
|
||||
messages_string += f"\n(Attached Image {attachedimgid})\n"
|
||||
elif item['type']=="input_audio":
|
||||
if 'input_audio' in item and item['input_audio'] and item['input_audio']['data']:
|
||||
audio_added.append(item['input_audio']['data'])
|
||||
attachedaudid += 1
|
||||
messages_string += f"\n(Attached Audio {attachedaudid})\n"
|
||||
elif isinstance(item, str):
|
||||
messages_string += item # If item is just a string, append it directly
|
||||
|
||||
# If last message, add any tools calls after message content and before message end token if any
|
||||
if message_index == len(messages_array):
|
||||
used_tool_json = determine_tool_json_to_use(genparams, messages_string, assistant_message_start, (message['role'] == "tool"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue