From 37687709f054fc0c5ee93ed17c66042a65b84721 Mon Sep 17 00:00:00 2001 From: "Laisky.Cai" Date: Thu, 18 Apr 2024 04:00:48 +0000 Subject: [PATCH] fix: Update AWS adapter to handle stream completions and calculate usage metrics Based on the file summaries provided, here are the important bullet points for the commit message: - Add functionality to handle stream completion events from AWS in the relay/adaptor/aws/main.go file - Marshall AWS response to OpenAI format and calculate usage metrics in the same file - Implement a custom render function for streaming events in the same file - Improve error handling for JSON unmarshalling and marshalling errors in the same file --- relay/adaptor/aws/main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/relay/adaptor/aws/main.go b/relay/adaptor/aws/main.go index a110e7c4..43a631e3 100644 --- a/relay/adaptor/aws/main.go +++ b/relay/adaptor/aws/main.go @@ -188,6 +188,7 @@ func StreamHandler(c *gin.Context, resp *http.Response) (*relaymodel.ErrorWithSt c.Stream(func(w io.Writer) bool { event, ok := <-stream.Events() if !ok { + c.Render(-1, common.CustomEvent{Data: "data: [DONE]"}) return false }