Skip to content

Commit a5c322f

Browse files
committed
submit code
1 parent 6139c66 commit a5c322f

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

chaoxi/twoai_chat/moli_chat.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import requests
2+
3+
send_data = {
4+
"question": '你的梦想是什么?', #构建发送的数据
5+
"api_key": "a6ec389908bcc23fceb2bbe998e3313e",
6+
"api_secret": "bsa0yv06pl1p"
7+
}
8+
api_url = 'http://i.itpk.cn/api.php'
9+
chat_content = requests.post(api_url, data=send_data) #发送请求数据
10+
print(chat_content.text)

chaoxi/twoai_chat/tuling_chat.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import requests
2+
3+
send_data = {
4+
"key": "9fd874929409453991db78f8b46a446b",
5+
"info": '我叫你一声你敢答应吗', #构建发送的数据
6+
"userid": "622952"
7+
}
8+
api_url = 'http://www.tuling123.com/openapi/api'
9+
chat_content = requests.post(api_url, data=send_data) #发送请求数据
10+
print(chat_content.text)

chaoxi/twoai_chat/twoai_chat.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import requests
2+
import time
3+
4+
question = input("请开始你们的表演:") # 输入问题开始表演
5+
6+
girl = "小姐姐"
7+
boy = "小哥哥"
8+
9+
print(boy+':'+question)
10+
11+
while True:
12+
boy_data = {
13+
"key": "9fd874929409453991db78f8b46a446b",
14+
"info": question, #构建发送的数据
15+
"userid": "622952"
16+
}
17+
boy_url = 'http://www.tuling123.com/openapi/api'
18+
boy_content = requests.post(boy_url, data=boy_data) #发送请求数据
19+
print(boy + ':' + eval(boy_content.text)["text"]) # 用eval函数处理一下图灵返回的消息
20+
question = eval(boy_content.text)["text"]
21+
22+
girl_data = {
23+
"question": question, # 构建发送的数据
24+
"api_key": "a6ec389908bcc23fceb2bbe998e3313e",
25+
"api_secret": "bsa0yv06pl1p"
26+
}
27+
girl_url = 'http://i.itpk.cn/api.php'
28+
girl_content = requests.post(girl_url, data=girl_data) # 发送请求数据
29+
print(girl + ':' + girl_content.text)
30+
time.sleep(3)

0 commit comments

Comments
 (0)