- Updated context creation in handleChat, handleGenerateTitle, and handleGeneratePrompts to use the request context, improving context management. - Commented out unused context settings for assistant ID, silent mode, history visibility, and client type to streamline the code. - Refactored context handling in assistant methods to enhance clarity and maintainability. - Removed deprecated functions and cleaned up the context structure for better performance and readability.
42 lines
992 B
Go
42 lines
992 B
Go
package openapi
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/yaoapp/yao/openapi/response"
|
|
)
|
|
|
|
// For compatibility with all platform clients, providing standard OpenAPI model interfaces
|
|
|
|
// GinGetModels handles GET /chat/models - Get all chat models
|
|
func GinGetModels(c *gin.Context) {
|
|
mockResponse := ModelsResponse{
|
|
Object: "list",
|
|
Data: []Model{
|
|
{
|
|
ID: "gpt-4o-1024",
|
|
Object: "model",
|
|
Created: 1686935002,
|
|
OwnedBy: "organization-owner",
|
|
},
|
|
{
|
|
ID: "model-id-1",
|
|
Object: "model",
|
|
Created: 1686935002,
|
|
OwnedBy: "organization-owner",
|
|
},
|
|
{
|
|
ID: "model-id-2",
|
|
Object: "model",
|
|
Created: 1686935002,
|
|
OwnedBy: "openai",
|
|
},
|
|
},
|
|
}
|
|
|
|
response.RespondWithSuccess(c, response.StatusOK, mockResponse)
|
|
}
|
|
|
|
// GinGetModelDetails handles GET /chat/models/:model_name - Get model details
|
|
func GinGetModelDetails(c *gin.Context) {
|
|
response.RespondWithSuccess(c, response.StatusOK, gin.H{"message": "placeholder"})
|
|
}
|