mirror of
				https://github.com/linux-do/new-api.git
				synced 2025-11-04 13:23:42 +08:00 
			
		
		
		
	fix: add missing id,object,created
This commit is contained in:
		@@ -1,8 +1,10 @@
 | 
			
		||||
package dto
 | 
			
		||||
 | 
			
		||||
type TextResponseWithError struct {
 | 
			
		||||
	Choices []OpenAITextResponseChoice    `json:"choices"`
 | 
			
		||||
	Id      string                        `json:"id"`
 | 
			
		||||
	Object  string                        `json:"object"`
 | 
			
		||||
	Created int64                         `json:"created"`
 | 
			
		||||
	Choices []OpenAITextResponseChoice    `json:"choices"`
 | 
			
		||||
	Data    []OpenAIEmbeddingResponseItem `json:"data"`
 | 
			
		||||
	Model   string                        `json:"model"`
 | 
			
		||||
	Usage   `json:"usage"`
 | 
			
		||||
@@ -10,6 +12,9 @@ type TextResponseWithError struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type TextResponse struct {
 | 
			
		||||
	Id      string                     `json:"id"`
 | 
			
		||||
	Object  string                     `json:"object"`
 | 
			
		||||
	Created int64                      `json:"created"`
 | 
			
		||||
	Model   string                     `json:"model"`
 | 
			
		||||
	Choices []OpenAITextResponseChoice `json:"choices"`
 | 
			
		||||
	Usage   `json:"usage"`
 | 
			
		||||
 
 | 
			
		||||
@@ -192,6 +192,8 @@ func OpenaiHandler(c *gin.Context, resp *http.Response, promptTokens int, model
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		textResponse := &dto.TextResponse{
 | 
			
		||||
			Id:      responseWithError.Id,
 | 
			
		||||
			Object:  responseWithError.Object,
 | 
			
		||||
			Choices: responseWithError.Choices,
 | 
			
		||||
			Model:   responseWithError.Model,
 | 
			
		||||
			Usage:   *usage,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user