Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChatGPT対応 #2364

Merged
merged 9 commits into from
Mar 3, 2023
Merged

ChatGPT対応 #2364

merged 9 commits into from
Mar 3, 2023

Conversation

Goryudyuma
Copy link
Member

スクリーンショット 2023-03-03 3 46 49

ローカルでは動いてそうな気配


def chat_gpt(message: str) -> str:
openai.api_key = conf.OPENAI_API_KEY
result = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=[{"role": "user", "content": message}])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本当は過去の会話とかも送った方がいいっぽいけど、一旦これで。

@@ -35,6 +35,7 @@ def analyze_message(message: str) -> Callable[[BaseClient], None]:
"version": lambda m: hato.version,
"にゃーん": lambda m: hato.yoshiyoshi,
"おみくじ": lambda m: hato.omikuji,
"chat": lambda m: partial(hato.chat, message=m[len("chat") :].strip()),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コマンドは再考の余地あり

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ai とかそれっぽい説。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hato ai hogehoge か、うーん。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chatが他と被らなさそうであれば、chatのほうがいいかな〜

@Goryudyuma Goryudyuma marked this pull request as ready for review March 2, 2023 18:49
Copy link
Member

@massongit massongit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

かなり簡潔な実装で実現できてすごいって感じ。

@Goryudyuma Goryudyuma merged commit 9059f23 into develop Mar 3, 2023
@Goryudyuma Goryudyuma deleted the add_chat_gpt branch March 3, 2023 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants