Difference between revisions of "Dreamily API"
Chaosconst (talk | contribs) (Tag: Visual edit) |
Chaosconst (talk | contribs) (remove os:type) (Tag: Visual edit) |
||
Line 9: | Line 9: | ||
#创建新文章 | #创建新文章 | ||
− | curl -d '{"content":"","title":"文章标题","text | + | curl -d '{"content":"","title":"文章标题","text":""}' http://if.caiyunai.com/v1/dream/$UID/novel_save |
{"status":0,"data":{"nid":"6064092f660f63133b940725"}} | {"status":0,"data":{"nid":"6064092f660f63133b940725"}} | ||
Line 17: | Line 17: | ||
* 选择模型,在这里,选“小梦0号” | * 选择模型,在这里,选“小梦0号” | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | curl -d ' | + | curl -d '' http://if.caiyunai.com/v1/dream/model_list |
MID=60094a2a9661080dc490f75a | MID=60094a2a9661080dc490f75a | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 23: | Line 23: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | curl "http://if.caiyunai.com/v1/dream/$UID/novel_ai" -d '{"nid":"$NID","content":"你好","uid":"$UID","mid":"$MID","title | + | curl "http://if.caiyunai.com/v1/dream/$UID/novel_ai" -d '{"nid":"$NID","content":"你好","uid":"$UID","mid":"$MID","title":""}'; |
#返回例子如下:{"status":0,"msg":"ok","data":{"xid":"60640b0c9dda21a5586494a0"}} | #返回例子如下:{"status":0,"msg":"ok","data":{"xid":"60640b0c9dda21a5586494a0"}} | ||
#记录下续写id(xid) | #记录下续写id(xid) | ||
Line 31: | Line 31: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | curl "http://if.caiyunai.com/v1/dream/6041e624f98b7c8fd02b05f4/novel_dream_loop" -d '{"nid":"$NID","xid":"$XID | + | curl "http://if.caiyunai.com/v1/dream/6041e624f98b7c8fd02b05f4/novel_dream_loop" -d '{"nid":"$NID","xid":"$XID"}' |
− | # 请求体样例:{"nid":"602f3a7cb499433a1a16a458","xid":"602f3dfe84f40329800a3760 | + | # 请求体样例:{"nid":"602f3a7cb499433a1a16a458","xid":"602f3dfe84f40329800a3760"} |
# 返回体样例: | # 返回体样例: | ||
# 计算中:{"status":0,"data":{"rows":[],"count":1}} | # 计算中:{"status":0,"data":{"rows":[],"count":1}} |
Revision as of 05:55, 31 March 2021
大家好,在这里介绍彩云小梦 API 的调用。
- 账户注册:通过 http://if.caiyunapp.com/dream 注册一个彩云小梦的普通用户
- 注册完成后:在浏览器地址栏输入:javascript:alert(localStorage.cy_dream_user),得到你的uid
- 创建文章,通过如下命令
#!/bin/bash
UID=你刚才得到的UID
#创建新文章
curl -d '{"content":"","title":"文章标题","text":""}' http://if.caiyunai.com/v1/dream/$UID/novel_save
{"status":0,"data":{"nid":"6064092f660f63133b940725"}}
#得到nid为你的文章,记下你的nid
NID=6064092f660f63133b940725
- 选择模型,在这里,选“小梦0号”
curl -d '' http://if.caiyunai.com/v1/dream/model_list
MID=60094a2a9661080dc490f75a
- 发送续写请求
curl "http://if.caiyunai.com/v1/dream/$UID/novel_ai" -d '{"nid":"$NID","content":"你好","uid":"$UID","mid":"$MID","title":""}';
#返回例子如下:{"status":0,"msg":"ok","data":{"xid":"60640b0c9dda21a5586494a0"}}
#记录下续写id(xid)
XID=60640b0c9dda21a5586494a0
- 等待,然后获取续写结果
curl "http://if.caiyunai.com/v1/dream/6041e624f98b7c8fd02b05f4/novel_dream_loop" -d '{"nid":"$NID","xid":"$XID"}'
# 请求体样例:{"nid":"602f3a7cb499433a1a16a458","xid":"602f3dfe84f40329800a3760"}
# 返回体样例:
# 计算中:{"status":0,"data":{"rows":[],"count":1}}
# 计算完毕:{"status":0,"data":{"rows":[
# {"content":"第一条联想结果","_id":"602f3dfe84f40329800a3761","mid":"60094a2a9661080dc490f75a"},
# {"content":"第二条联想结果","_id":"602f3dfe84f40329800a3761","mid":"60094a2a9661080dc490f75a"},
# {"content":"第三条联想结果","_id":"602f3dfe84f40329800a3761","mid":"60094a2a9661080dc490f75a"}
# ],"count":0}}