mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-18 17:46:37 +08:00
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
This commit is contained in:
parent
710a45565d
commit
5874035e42
@ -188,6 +188,7 @@ func StreamHandler(c *gin.Context, resp *http.Response) (*relaymodel.ErrorWithSt
|
|||||||
c.Stream(func(w io.Writer) bool {
|
c.Stream(func(w io.Writer) bool {
|
||||||
event, ok := <-stream.Events()
|
event, ok := <-stream.Events()
|
||||||
if !ok {
|
if !ok {
|
||||||
|
c.Render(-1, common.CustomEvent{Data: "data: [DONE]"})
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user