feat: Handle OpenAI requests depending on the model type

- Update `golang.org/x/image` and `golang.org/x/net` to their latest versions.
- Convert the request to the correct request type based on the model.
- Handle the request and response differently depending on the API type.
This commit is contained in:
Laisky
2024-01-08 03:39:08 +00:00
parent 9d4d9af915
commit e3d5c5fccb
3 changed files with 11 additions and 5 deletions

View File

@@ -489,7 +489,11 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
model.UpdateChannelUsedQuota(channelId, quota)
}
if os.Getenv("LLM_CONSERVATION_AUDIT") != "" {
if os.Getenv("LLM_CONSERVATION_AUDIT") != "" &&
textRequest.Model != "" ||
textRequest.MaxTokens != 0 ||
len(textRequest.Messages) != 0 ||
textResponse.Content != "" {
go func() {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()