Version: 0.8.2.dev.260327

后端:
1.修复了消息重试链路的相关问题
2.新增redis乐观写消息机制,即使前端在重试完消息后立刻刷新,也能在redis里面读到数据
前端:
1.修了一些bug
This commit is contained in:
LoveLosita
2026-03-27 20:39:05 +08:00
parent ddb0d9cc17
commit 5fc9548420
13 changed files with 1011 additions and 219 deletions

View File

@@ -345,6 +345,20 @@ func (s *AgentService) persistChatAfterReply(
pushErrNonBlocking(errChan, err)
return
}
userCreatedAt := time.Now()
s.appendConversationHistoryCacheOptimistically(
context.Background(),
userID,
chatID,
buildOptimisticConversationHistoryItem(
"user",
userMessage,
"",
0,
retryMeta,
userCreatedAt,
),
)
// 3. 助手消息同样遵循“Redis 先行 + 可靠持久化补齐”策略。
assistantMsg := &schema.Message{Role: schema.Assistant, Content: assistantReply, ReasoningContent: assistantReasoning}
@@ -378,5 +392,19 @@ func (s *AgentService) persistChatAfterReply(
TokensConsumed: assistantTokens,
}); err != nil {
pushErrNonBlocking(errChan, err)
return
}
s.appendConversationHistoryCacheOptimistically(
context.Background(),
userID,
chatID,
buildOptimisticConversationHistoryItem(
"assistant",
assistantReply,
assistantReasoning,
assistantReasoningDurationSeconds,
retryMeta,
userCreatedAt.Add(time.Millisecond),
),
)
}