办学质量监测教学评价系统
ageerle
2025-04-08 00f362acf194ba459b4d583860eb018179053961
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package org.ruoyi.common.chat.plugin;
 
import org.ruoyi.common.chat.openai.plugin.PluginAbstract;
 
import java.io.IOException;
 
public class CmdPlugin extends PluginAbstract<CmdReq, CmdResp> {
 
    public CmdPlugin(Class<?> r) {
        super(r);
    }
 
    @Override
    public CmdResp func(CmdReq args) {
        try {
            if("计算器".equals(args.getCmd())){
                Runtime.getRuntime().exec("calc");
            }else if("记事本".equals(args.getCmd())){
                Runtime.getRuntime().exec("notepad");
            }else if("命令行".equals(args.getCmd())){
                String [] cmd={"cmd","/C","start copy exel exe2"};
                Runtime.getRuntime().exec(cmd);
            }
        } catch (IOException e) {
           throw new RuntimeException("指令执行失败");
        }
        CmdResp resp = new CmdResp();
        resp.setResult(args.getCmd()+"指令执行成功!");
        return resp;
    }
 
    @Override
    public String content(CmdResp resp) {
        return resp.getResult();
    }
}