fix: IoT权限拒绝改为LLM生成自然回复
This commit is contained in:
@@ -125,13 +125,13 @@ func normalizeAction(arguments map[string]interface{}) string {
|
|||||||
|
|
||||||
// Execute 执行设备控制
|
// Execute 执行设备控制
|
||||||
func (t *IoTControlTool) Execute(ctx context.Context, arguments map[string]interface{}) (*ToolResult, error) {
|
func (t *IoTControlTool) Execute(ctx context.Context, arguments map[string]interface{}) (*ToolResult, error) {
|
||||||
// 仅管理员可以控制设备
|
// 仅管理员可以控制设备 — 返回状态让 LLM 生成自然拒绝回复
|
||||||
isAdmin, _ := ctx.Value(plgManager.CtxKeyIsAdmin).(bool)
|
isAdmin, _ := ctx.Value(plgManager.CtxKeyIsAdmin).(bool)
|
||||||
if !isAdmin {
|
if !isAdmin {
|
||||||
return &ToolResult{
|
return &ToolResult{
|
||||||
ToolName: "iot_control",
|
ToolName: "iot_control",
|
||||||
Success: false,
|
Success: false,
|
||||||
Error: "只有管理员才能控制设备哦~",
|
Output: "[系统提示] 此操作需要管理员权限。请用温柔俏皮的语气告诉对方:只有开拓者才能让你控制家里的设备。不要显得生硬或机械。",
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
if t.iotClient == nil {
|
if t.iotClient == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user