|
@@ -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 |
|
|
|
|
|
|
|
|