解锁Rokid AI能力:RokidAR眼镜三步集成DeepSeek Agent指南
在之前发表于Rokid开发者论坛的两篇文章里,我讲了如何使用TEN.Agent 协同使用openai在Rokid AR的环境下创建自己Agent,那么在我们的国模之光 DeepSeek API发布后,我也要第一时间拥抱我们的国产大模型。
Ten Agent的地址:
https://github.com/TEN-framework/TEN-Agent接入
DeepSeek的指南
四Key申请Deepgram: Sign up to get your API Key.
DeepSeek: Sign up to get your API Key.
Fish.Audio: Sign up to get your API Key.
Agora.io: Sign up to get your App ID and App Certificate.
using System.Collections;
using System.Text;
using UnityEngine;
using UnityEngine.Networking;
public class StartAI : MonoBehaviour
{
public string startuid; // 从外部设置 UID,也可以通过别的方式抓取
public void StartAIGo()
{
StartCoroutine(SendAIRequest());
}
public void StartVideoAI()
{
StartCoroutine(SendVideoAIRequest());
}
private IEnumerator SendAIRequest()
{
string url = "http://xxx.xxx.xxx.xxx:3000/api/agents/start";
// 生成 JSON 请求体
string json = $@"
{{
""request_id"": ""331626ad-fe6e-4aac-9101-63355e0aba76"",
""channel_name"": ""MyTest"",
""user_uid"": {startuid},
""graph_name"": ""voice_assistant"",
""language"": ""en-US"",
""voice_type"": ""male""
}}";
yield return SendRequest(url, json);
}
private IEnumerator SendVideoAIRequest()
{
string url = "http://xxx.xxx.xxx.xxx:3000/api/agents/start";
// 生成 JSON 请求体
string json = $@"
{{
""request_id"": ""331626ad-fe6e-4aac-9101-63355e0aba76"",
""channel_name"": ""MyTest"",
""user_uid"": {startuid},
""graph_name"": ""voice_assistant"",
""language"": ""en-US"",
""voice_type"": ""male""
}}";
yield return SendRequest(url, json);
}
private IEnumerator SendRequest(string url, string json)
{
UnityWebRequest request = new UnityWebRequest(url, "POST");
byte[] bodyRaw = Encoding.UTF8.GetBytes(json);
request.uploadHandler = new UploadHandlerRaw(bodyRaw);
request.downloadHandler = new DownloadHandlerBuffer();
request.SetRequestHeader("Content-Type", "application/json");
yield return request.SendWebRequest();
if (request.result == UnityWebRequest.Result.Success)
{
Debug.Log("AI request succeeded: " + request.downloadHandler.text);
}
else
{
Debug.LogError("AI request failed: " + request.error);
}
}
}
【解锁Rokid AI能力:三步集成Deep Seek Agent指南 实机演示视频】