yao/openapi/chat/chat.go
Max 1c502bfea8 Refactor context handling in agent API and assistant methods
- 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.
2025-11-10 17:30:53 +08:00

37 lines
929 B
Go

package chat
import (
"github.com/gin-gonic/gin"
"github.com/yaoapp/yao/openapi/oauth/types"
"github.com/yaoapp/yao/openapi/response"
)
// Attach attaches the agent handlers to the router
func Attach(group *gin.RouterGroup, oauth types.OAuth) {
// Protect all endpoints with OAuth
group.Use(oauth.Guard)
// List Chat Completions
group.GET("/completions", placeholder)
// Create Chat Completion
group.POST("/completions", GinCreateCompletions)
// Update Chat Completion Metadata
group.PUT("/completions", GinUpdateCompletions)
// Get Chat Completion Details
group.GET("/completions/:completion_id", placeholder)
// Get Chat Messages
group.GET("/completions/:completion_id/messages", placeholder)
// Delete Chat Completion
group.DELETE("/completions/:completion_id", placeholder)
}
func placeholder(c *gin.Context) {
response.RespondWithSuccess(c, response.StatusOK, gin.H{"message": "placeholder"})
}