|
楼主 |
发表于 2024-7-22 15:24
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test()
- Dim strText As String
- Dim strData As String
- strData = "{""model"": ""moonshot-v1-8k"", " _
- & """messages"": [" _
- & "{""role"": ""system"", ""content"": ""你是 Kimi,由 Moonshot AI 提供的人工智能助手,你更擅长中文和英文的对话。你会为用户提供安全,有帮助,准确的回答。同时,你会拒绝一切涉及恐怖主义,种族歧视,黄色暴力等问题的回答。Moonshot AI 为专有名词,不可翻译成其他语言。""}, " _
- & "{""role"": ""user"", ""content"": ""你好,我叫李雷,1+1等于多少?""}" _
- & "], ""temperature"": 0.3}"
- r
- With CreateObject("Microsoft.XMLHTTP")
- .Open "POST", "https://api.moonshot.cn/v1/chat/completions", False
- .SetRequestHeader "Content-Type", "application/json; charset=utf-8"
- .SetRequestHeader "Authorization", "Bearer sk-poFpFo8yaQCKcBkrCGntQgrYaPxJFMDyODuG1uLOmUudMFVS" '密钥改成自己的
- .send strData
- strText = .responseText
- End With
- Debug.Print Split(Split(strText, """content"":""")(1), """}")(0)
- End Sub
复制代码 |
|