78e3f450c2
- Fix: Session history flash (race condition + WS guard) - Fix: Chat background overlay + sidebar transparency - Fix: IoT device control (Chinese action names, status field) - Feat: Independent memory-service (port 8091, 13 endpoints) - Feat: Independent tool-engine service (port 8092, 13 tools) - Feat: Tool call logs with paginated DevTools panel - Feat: Thinking log records with DevTools panel - Feat: Future development roadmap document - Chore: Updated .gitignore, go.work, DevTools config - Chore: 5-service health check, project review docs
42 lines
1.3 KiB
Go
42 lines
1.3 KiB
Go
package tools
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/yourname/cyrene-ai/tool-engine/internal/model"
|
|
)
|
|
|
|
// Tool 工具接口
|
|
type Tool interface {
|
|
Definition() model.ToolDefinition
|
|
Execute(ctx context.Context, arguments map[string]interface{}) (*model.ToolResult, error)
|
|
}
|
|
|
|
// IoTClientFactory 用于创建 IoT 客户端的工厂函数类型
|
|
type IoTClientFactory func() IoTClientInterface
|
|
|
|
// IoTClientInterface IoT 客户端接口(解耦对 ai-core 的依赖)
|
|
type IoTClientInterface interface {
|
|
GetAllDevices() ([]IoTDevice, error)
|
|
GetDevice(id string) (*IoTDevice, error)
|
|
ToggleDevice(id string) error
|
|
SetDeviceProperty(id string, field string, value interface{}) error
|
|
}
|
|
|
|
// IoTDevice IoT 设备结构体
|
|
type IoTDevice struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
Status string `json:"status"`
|
|
Brightness int `json:"brightness,omitempty"`
|
|
Color string `json:"color,omitempty"`
|
|
Temperature float64 `json:"temperature,omitempty"`
|
|
Mode string `json:"mode,omitempty"`
|
|
Position int `json:"position,omitempty"`
|
|
Value float64 `json:"value,omitempty"`
|
|
Unit string `json:"unit,omitempty"`
|
|
Battery int `json:"battery,omitempty"`
|
|
LastUpdated string `json:"last_updated"`
|
|
}
|