最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

ChatGPT通過api簡單整合進(jìn)入Word

2023-03-20 16:19 作者:且念著  | 我要投稿

Sub ChatGPT()

Dim selectedText As String

Dim apiKey As String

Dim response As Object, re As String

Dim midString As String

Dim ans As String

If Selection.Type = wdSelectionNormal Then

selectedText = Selection.Text

selectedText = Replace(selectedText, ChrW$(13), "")

apiKey = "只用把這里改成自己的APIkey就行"

URL = "https://api.openai.com/v1/chat/completions"

Set response = CreateObject("MSXML2.XMLHTTP")

response.Open "POST", URL, False

response.setRequestHeader "Content-Type", "application/json"

response.setRequestHeader "Authorization", "Bearer " + apiKey

response.Send "{""model"":""gpt-3.5-turbo"", ""messages"":[{""role"":""user"",""content"":""" & selectedText & """}], ""temperature"":0.7}"

re = response.responseText

midString = Mid(re, InStr(re, """content"":""") + 11)

ans = Split(midString, """")(0)

ans = Replace(ans, "\n", "")

Selection.Text = selectedText & vbNewLine & ans

Else

Exit Sub

End If

End Sub

ChatGPT通過api簡單整合進(jìn)入Word的評論 (共 條)

使用qq登录你需要登录后才可以评论。
洛浦县| 肥城市| 杂多县| 嘉禾县| 张家界市| 沅江市| 英德市| 台江县| 吴堡县| 永胜县| 凌云县| 卢氏县| 亳州市| 玉山县| 泽州县| 城固县| 衡阳县| 永康市| 武城县| 通化县| 资讯 | 庆云县| 红原县| 岐山县| 集贤县| 壤塘县| 平山县| 重庆市| 慈利县| 勐海县| 灵山县| 上思县| 庐江县| 阿合奇县| 盐源县| 商城县| 岗巴县| 札达县| 天祝| 伽师县| 深水埗区|