Browse Source

'talk.py' を更新

sicawke
みてるぞ 6 months ago
parent
commit
7277819b6e
1 changed files with 18 additions and 7 deletions
  1. +18
    -7
      talk.py

+ 18
- 7
talk.py View File

@@ -24,7 +24,13 @@ class Talk:
top_p: float = 1. top_p: float = 1.


@classmethod @classmethod
def main (cls, message: str, name: str | None = None, histories: list = [], goatoh_mode: bool = False) -> str:
def main (
cls,
message: str,
name: str | None = None,
histories: list = [],
goatoh_mode: bool = False,
) -> str:
# ChatGPT API Organisation ID # ChatGPT API Organisation ID
openai.organization = OPENAI_ORGANISATION openai.organization = OPENAI_ORGANISATION


@@ -38,8 +44,13 @@ class Talk:
return answer.content if answer is not None else cls.DUMMY_RESPONSE return answer.content if answer is not None else cls.DUMMY_RESPONSE


@classmethod @classmethod
def __get_message (cls, message: str, name: str | None, histories: list, goatoh_mode: bool = False) \
-> chat.chat_completion_message.ChatCompletionMessage | None:
def __get_message (
cls,
message: str,
name: str | None,
histories: list,
goatoh_mode: bool = False,
) -> chat.chat_completion_message.ChatCompletionMessage | None:
# プロンプト(JSON 等外部ファイルに置くことを検討) # プロンプト(JSON 等外部ファイルに置くことを検討)
if goatoh_mode: if goatoh_mode:
messages: list = [{'role': 'system', messages: list = [{'role': 'system',
@@ -203,13 +214,13 @@ class Talk:
+ 'ふざけるのはいい加減にするぬ゛ぬ゛ん゛。'))}, + 'ふざけるのはいい加減にするぬ゛ぬ゛ん゛。'))},


{'role': 'system', {'role': 'system',
'content': '洗歌(しーざおぐあ)歌って'},
'content': '洗歌(しーざおぐあ)歌って'},
{'role': 'assistant', {'role': 'assistant',
'content': ('おけだぬ゛~゛ん゛(苦笑)。' 'content': ('おけだぬ゛~゛ん゛(苦笑)。'
+ '毛巾浴帽小鸭鸭水温刚刚好♪'
+ '泼泼水来搓泡泡今天真是美妙♪'
+ '大声唱歌扭扭腰我爱洗洗澡♪'
+ '毛巾浴帽小鴨鴨水溫剛剛好♪'
+ '潑潑水來搓泡泡今天眞是美妙♪'
+ '大聲唱歌扭扭腰我愛洗洗澡♪'
+ 'だぬ゛ん♪')}, + 'だぬ゛ん♪')},


{'role': 'system', {'role': 'system',


Loading…
Cancel
Save