|
|
@@ -47,7 +47,7 @@ class Talk: |
|
|
|
@classmethod |
|
|
|
def __get_message ( |
|
|
|
cls, |
|
|
|
message: str, |
|
|
|
message: str | list, |
|
|
|
name: str | None, |
|
|
|
histories: list, |
|
|
|
goatoh_mode: bool = False, |
|
|
@@ -234,10 +234,17 @@ class Talk: |
|
|
|
|
|
|
|
messages += histories + [{'role': 'user', 'content': message}] |
|
|
|
|
|
|
|
# デバッグ用 |
|
|
|
print (messages) |
|
|
|
|
|
|
|
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: |
|
|
|
return None |
|
|
|
|
|
|
|