Browse Source

画像入力に対応

main
みてるぞ 2 months ago
parent
commit
081ab9aa2e
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      talk.py

+ 11
- 4
talk.py View File

@@ -47,7 +47,7 @@ class Talk:
@classmethod @classmethod
def __get_message ( def __get_message (
cls, cls,
message: str,
message: str | list,
name: str | None, name: str | None,
histories: list, histories: list,
goatoh_mode: bool = False, goatoh_mode: bool = False,
@@ -234,10 +234,17 @@ class Talk:


messages += histories + [{'role': 'user', 'content': message}] messages += histories + [{'role': 'user', 'content': message}]


# デバッグ用
print (messages)

try: try:
return openai.chat.completions.create (
model = 'gpt-4o' if random.random () < .2 else 'gpt-3.5-turbo',
messages = messages).choices[0].message
return (openai.chat.completions.create (
model = ('gpt-4o'
if any (type (e['content']) is list
for e in messages)
else 'gpt-3.5-turbo'),
messages = messages)
.choices[0].message)
except: except:
return None return None




Loading…
Cancel
Save