努力赚钱
将来的你一定会感谢现在努力的自己!

Word文档加入ChatGPT功能命令

Spacemesh-浏览器

Sub ChatGPT()Dim selectedText As StringDim apiKey As StringDim response As Object, re As StringDim midString As StringDim ans As StringIf Selection.Type = wdSelectionNormal ThenselectedText = Selection.TextselectedText = Replace(selectedText, ChrW$(13), "")appKey = "我的AppKey"apiKey = "我的apiKey"URL = " Set response = CreateObject("MSXML2.XMLHTTP")response.Open "POST", URL, Falseresponse.setRequestHeader "Content-Type", "application/json"response.setRequestHeader "Authorization", appKeyresponse.Send "{""apiKey"":""" & apiKey & """,""model"":""gpt-3.5-turbo-0301"", ""messages"":[{""role"":""user"",""content"":""" & selectedText & """}], ""temperature"":0.3}"re = response.responseTextmidString = Mid(re, InStr(re, """content"":""") + 11)ans = Split(midString, """")(0)ans = Replace(ans, "\n", "" & vbCrLf & "")Selection.Text = selectedText & vbNewLine & ansElseExit SubEnd IfEnd Sub

 

9e53d8cdf23c94f977a397efa7120e6f

赞(0) 打赏
未经允许不得转载:我爱收益 » Word文档加入ChatGPT功能命令

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏