2 Commits

Author SHA1 Message Date
Gsh
836ea90145 fix: Anthropic Claude 网页对话格式修改 2026-02-07 00:47:22 +08:00
chenchun
a040b7a16a fix: 修复bug
将 responseResult.Item1 的比较从严格等于改为包含判断,兼容部分 AI 工具返回带前后缀的异常字符串(例如 "exception: ..." 等),避免漏掉异常分支处理。修改文件:Yi.Framework.AiHub.Domain/Managers/AiGateWayManager.cs。
2026-02-06 16:56:37 +08:00
2 changed files with 4 additions and 3 deletions

View File

@@ -642,7 +642,7 @@ public class AiGateWayManager : DomainService
isFirst = false;
}
if (responseResult.Item1=="exception")
if (responseResult.Item1.Contains("exception"))
{
//兼容部分ai工具问题
continue;

View File

@@ -133,8 +133,9 @@ export function toClaudeFormat(messages: UnifiedMessage[]): { messages: ClaudeMe
for (const msg of messages) {
// Claude 的 system 消息需要单独提取
if (msg.role === 'system') {
systemPrompt = typeof msg.content === 'string' ? msg.content : msg.content.map(c => c.text || '').join('');
continue;
msg.role = 'assistant';
// systemPrompt = typeof msg.content === 'string' ? msg.content : msg.content.map(c => c.text || '').join('');
// continue;
}
const role = msg.role === 'model' ? 'assistant' : msg.role;