GPT的翻译相对于百度翻译和谷歌翻译等,相对比较地道一些,所以可以选择GPT作为翻译接口。
使用以下提示词来实现翻译效果
import json
import re
import requests
url = "https://api.ccxcn/v1/chat/completions" # 替换为目标URL
data = {
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "system",
"content": '''
假设你是一个专业的翻译工具
'''
},
{
"role": "user",
"content": '''
请将这句话翻译成英语:你是谁
'''
},
]
}
headers = {
"Authorization": "Bearer sk-xxxxxxx",
}
response = requests.post(url, json=data, headers=headers, timeout=600)
json_data = response.json()
# print(json_data)
aiReply = ""
if "choices" in json_data:
aiReply = json_data["choices"][0]["message"]["content"]
print(aiReply)
集成到客服系统
可以选择翻译源

可以选用GPT源

集成到输入框工具栏

联系方式
vx : llike620