MIXSHARE
commited on
Commit
·
417ef43
1
Parent(s):
6e7f238
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ openai.api_key = os.getenv("openai_key")
|
|
7 |
|
8 |
|
9 |
# 如果你只打算通过 prompt 来定制机器人的行为,只需要修改这段 prompt 就够了。
|
10 |
-
prompt = '
|
11 |
|
12 |
history = {}
|
13 |
|
@@ -54,7 +54,7 @@ def callapi(p, msgs):
|
|
54 |
iface = gr.Interface(fn=chat,
|
55 |
inputs=["text", "text", "text"],
|
56 |
outputs=["text", "text"],
|
57 |
-
description="""
|
58 |
已添加多轮对话的极简示范,能将该 uid 的最近八条消息一起发给openai。本实现是内存中的,一旦重启即被清空。如需可持久的多轮对话,需要改用数据库等方式。
|
59 |
注意:duplicate 本项目后,需要将你自己的 openai apikey 设置到 settings 的 Repository Secrets 里,否则运行会报错。[了解详情](https://huggingface.co/spaces/baixing/hackathon_chatbot_openai_api/blob/main/%E6%B7%BB%E5%8A%A0%20secret%20%E7%9A%84%E6%96%B9%E6%B3%95.jpg)
|
60 |
[对话测试](https://huggingface.co/spaces/BaixingAI/hackathon_test) [参考文档](https://huggingface.co/spaces/baixing/hackathon_test/blob/main/bot-api.md) [Q & A](https://huggingface.co/spaces/baixing/hackathon_test/blob/main/qna.md)
|
|
|
7 |
|
8 |
|
9 |
# 如果你只打算通过 prompt 来定制机器人的行为,只需要修改这段 prompt 就够了。
|
10 |
+
prompt = '请你调用你能获取的所有的博物百科资源库,用小助手的口吻来回答问题,开头第一句是你好啊,好奇宝宝!由于是面向青少年儿童,请务必做到内容有理有据语言风格有趣生动,附上来源出处'
|
11 |
|
12 |
history = {}
|
13 |
|
|
|
54 |
iface = gr.Interface(fn=chat,
|
55 |
inputs=["text", "text", "text"],
|
56 |
outputs=["text", "text"],
|
57 |
+
description="""这是一个面向青少年儿童的博物百科全书问答助手,希望能够让你天马行空的想象力和好奇心得到满足!
|
58 |
已添加多轮对话的极简示范,能将该 uid 的最近八条消息一起发给openai。本实现是内存中的,一旦重启即被清空。如需可持久的多轮对话,需要改用数据库等方式。
|
59 |
注意:duplicate 本项目后,需要将你自己的 openai apikey 设置到 settings 的 Repository Secrets 里,否则运行会报错。[了解详情](https://huggingface.co/spaces/baixing/hackathon_chatbot_openai_api/blob/main/%E6%B7%BB%E5%8A%A0%20secret%20%E7%9A%84%E6%96%B9%E6%B3%95.jpg)
|
60 |
[对话测试](https://huggingface.co/spaces/BaixingAI/hackathon_test) [参考文档](https://huggingface.co/spaces/baixing/hackathon_test/blob/main/bot-api.md) [Q & A](https://huggingface.co/spaces/baixing/hackathon_test/blob/main/qna.md)
|