feat(project): 项目完结
This commit is contained in:
2
internal/api/doc.go
Normal file
2
internal/api/doc.go
Normal file
@@ -0,0 +1,2 @@
|
||||
// Package api contains request and response contracts exposed by triggers.
|
||||
package api
|
||||
27
internal/api/dto/agent.go
Normal file
27
internal/api/dto/agent.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package dto
|
||||
|
||||
type AiAgentConfigResponse struct {
|
||||
AgentID string `json:"agentId"`
|
||||
AgentName string `json:"agentName"`
|
||||
AgentDesc string `json:"agentDesc"`
|
||||
}
|
||||
|
||||
type CreateSessionRequest struct {
|
||||
AgentID string `json:"agentId"`
|
||||
UserID string `json:"userId"`
|
||||
}
|
||||
|
||||
type CreateSessionResponse struct {
|
||||
SessionID string `json:"sessionId"`
|
||||
}
|
||||
|
||||
type ChatRequest struct {
|
||||
AgentID string `json:"agentId"`
|
||||
UserID string `json:"userId"`
|
||||
SessionID string `json:"sessionId"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
type ChatResponse struct {
|
||||
Content string `json:"content"`
|
||||
}
|
||||
24
internal/api/response/response.go
Normal file
24
internal/api/response/response.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package response
|
||||
|
||||
import "ai-agent-scaffold-go/pkg/types"
|
||||
|
||||
type Envelope[T any] struct {
|
||||
Code string `json:"code"`
|
||||
Info string `json:"info"`
|
||||
Data T `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func Success[T any](data T) Envelope[T] {
|
||||
return Envelope[T]{
|
||||
Code: types.CodeSuccess,
|
||||
Info: types.InfoSuccess,
|
||||
Data: data,
|
||||
}
|
||||
}
|
||||
|
||||
func Failure(code, info string) Envelope[any] {
|
||||
return Envelope[any]{
|
||||
Code: code,
|
||||
Info: info,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user