Changeset 0.22.1 (#95)

This commit is contained in:
2026-03-02 09:58:38 +00:00
parent 06c4e2a5a1
commit cae6fd9f93
16 changed files with 1030 additions and 40 deletions

View File

@@ -57,7 +57,7 @@ func streamWithToolLoop(
provider providers.Provider,
cfg providers.ProviderConfig,
req *providers.CompletionRequest,
model, userID, channelID, personaID, workspaceID, configID string,
model, providerType, userID, channelID, personaID, workspaceID, configID string,
hub *events.Hub,
health HealthRecorder,
) streamResult {
@@ -102,6 +102,11 @@ func streamWithToolLoop(
var toolCalls []providers.ToolCall
for event := range ch {
// Apply provider-specific post-processing hooks (v0.22.1)
if hooks := providers.GetHooks(providerType); hooks != nil {
hooks.PostStreamEvent(cfg, &event)
}
if event.Error != nil {
recordHealthFn(health, configID, callStart, event.Error)
sendSSE(fmt.Sprintf(`{"error":"%s"}`, escapeJSON(event.Error.Error())))
@@ -287,7 +292,7 @@ func streamModelResponse(
provider providers.Provider,
cfg providers.ProviderConfig,
req *providers.CompletionRequest,
model, displayName, userID, channelID, personaID, workspaceID, configID string,
model, providerType, displayName, userID, channelID, personaID, workspaceID, configID string,
hub *events.Hub,
health HealthRecorder,
) streamResult {
@@ -322,6 +327,11 @@ func streamModelResponse(
var toolCalls []providers.ToolCall
for event := range ch {
// Apply provider-specific post-processing hooks (v0.22.1)
if hooks := providers.GetHooks(providerType); hooks != nil {
hooks.PostStreamEvent(cfg, &event)
}
if event.Error != nil {
recordHealthFn(health, configID, callStart, event.Error)
sendSSE(fmt.Sprintf(`{"error":"%s"}`, escapeJSON(event.Error.Error())))