c# 调用文心一言API
using Newtonsoft.Json;
using RestSharp;
using System;
using System.Collections.Generic;
namespace 文心一言
{
class Program
{
const string API_KEY = "";
const string SECRET_KEY = "";
static void Main(string[] args)
{
var token = GetAccessToken();
//文心一言会根据前面的问答回复信息
List<ChatVO> messages = new List<ChatVO>();
//用户问1
messages.Add(new ChatVO { role = "user", content = "父亲的英文是什么?" });
//温馨一言答1
messages.Add(new ChatVO { role = "assistant", content = "父亲是father" });
//用户问2
messages.Add(new ChatVO { role = "user", content = "那母亲呢?" });
var chatMsg = GetChat(token, "13900000011", messages);
Console.WriteLine(chatMsg);
Console.ReadLine();
}
static string GetChat(string accessToken, string userId, List<ChatVO> messages)
{