We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
代码: public async IAsyncEnumerable<(ResultType resultType, string result)> SendMessageStream(ApiChatInput input) { Credential cred = new Credential { SecretId = SecretId, SecretKey = SecretKey }; HunyuanClient _client = new HunyuanClient(cred, "ap-guangzhou"); var req = new ChatProRequest() { Messages = GetMsgBody(input) }; var resp = await _client.ChatPro(req); foreach (var sse in resp) { var o = JObject.Parse(sse.Data); yield return (ResultType.Answer, o["Choices"][0]["Delta"]["Content"].Value()); } } 在IAsyncEnumerable类型的方法内部不允许使用try catch,但如果这个请求过程中出现参数错误之类的它又会直接抛出异常,我如何获取到请求异常后的Message呢?比如地域不支持,或者余额不足之类的。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
代码:
public async IAsyncEnumerable<(ResultType resultType, string result)> SendMessageStream(ApiChatInput input)
{
Credential cred = new Credential {
SecretId = SecretId,
SecretKey = SecretKey
};
HunyuanClient _client = new HunyuanClient(cred, "ap-guangzhou");
var req = new ChatProRequest()
{
Messages = GetMsgBody(input)
};
var resp = await _client.ChatPro(req);
foreach (var sse in resp)
{
var o = JObject.Parse(sse.Data);
yield return (ResultType.Answer, o["Choices"][0]["Delta"]["Content"].Value());
}
}
在IAsyncEnumerable类型的方法内部不允许使用try catch,但如果这个请求过程中出现参数错误之类的它又会直接抛出异常,我如何获取到请求异常后的Message呢?比如地域不支持,或者余额不足之类的。
The text was updated successfully, but these errors were encountered: