Changeset 0.22.1 (#95)
This commit is contained in:
@@ -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())))
|
||||
|
||||
Reference in New Issue
Block a user