Skip to content

Commit 433d77a

Browse files
committed
[update] llm-sys add unit call && msp add PATH
1 parent 0a0a37b commit 433d77a

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

ext_components/ax_msp/SConstruct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ with open(env['PROJECT_TOOL_S']) as f:
55
exec(f.read())
66

77
if 'CONFIG_AX_620E_MSP_ENABLED' in os.environ:
8-
MSP_PATH = check_wget_down("https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/linux/llm/m5stack_msp.tar.gz", 'm5stack_msp.tar.gz')
8+
MSP_PATH = os.environ.get('EXT_MSP_PATH', check_wget_down("https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/linux/llm/m5stack_msp.tar.gz", 'm5stack_msp.tar.gz'))
99
SRCS=[]
1010
INCLUDE=[]
1111
PRIVATE_INCLUDE=[]

projects/llm_framework/main_sys/src/event_loop.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,37 @@ int sys_hwinfo(int com_id, const nlohmann::json &json_obj)
196196
return out;
197197
}
198198

199+
int _sys_unit_call(int com_id, const nlohmann::json &json_obj)
200+
{
201+
std::string json_obj_raw = json_obj.dump();
202+
std::string object = sample_json_str_get(json_obj_raw, "object");
203+
std::string data = sample_json_str_get(json_obj_raw, "data");
204+
std::string out = unit_call(object.substr(0, object.find(".")), object.substr(object.find(".") + 1), data);
205+
{
206+
nlohmann::json out_body;
207+
out_body["request_id"] = json_obj["request_id"];
208+
out_body["work_id"] = json_obj["work_id"];
209+
out_body["created"] = time(NULL);
210+
out_body["object"] = json_obj["object"];
211+
try {
212+
out_body["data"] = nlohmann::json::parse(out);
213+
} catch (...) {
214+
out_body["data"] = out;
215+
}
216+
out_body["error"] = nlohmann::json::parse("{\"code\":0, \"message\":\"\"}");
217+
zmq_com_send(com_id, out_body.dump());
218+
}
219+
return 0;
220+
}
221+
222+
int sys_unit_call(int com_id, const nlohmann::json &json_obj)
223+
{
224+
int out = 0;
225+
std::thread t(_sys_unit_call, com_id, json_obj);
226+
t.detach();
227+
return out;
228+
}
229+
199230
int sys_lsmode(int com_id, const nlohmann::json &json_obj)
200231
{
201232
int out;
@@ -643,6 +674,7 @@ void server_work()
643674
key_sql["sys.reboot"] = sys_reboot;
644675
key_sql["sys.version"] = sys_version;
645676
key_sql["sys.rmmode"] = sys_rmmode;
677+
key_sql["sys.unit_call"] = sys_unit_call;
646678
}
647679

648680
void server_stop_work()

0 commit comments

Comments
 (0)