Warning: Trying to access array offset on value of type bool in /www/wwwroot/gpts.yundongfang.com/wp-content/themes/onenav/inc/clipimage.php on line 29
Word文档加入ChatGPT功能命令-GPTs大全汇总

Word文档加入ChatGPT功能命令

工具软件2年前 (2023)发布 gpts
60 0
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

 

Word文档加入ChatGPT功能命令
© 版权声明

相关文章