soul: remove room context injection from dharma_room_turn — soul reads transcript, not briefing
This commit is contained in:
Vendored
+8
-11
@@ -322,18 +322,16 @@ el_val_t handle_chat_as_soul(el_val_t body) {
|
||||
}
|
||||
|
||||
el_val_t handle_dharma_room_turn(el_val_t body) {
|
||||
el_val_t topic = json_get(body, EL_STR("topic"));
|
||||
el_val_t transcript = json_get(body, EL_STR("transcript"));
|
||||
el_val_t participants = json_get(body, EL_STR("participants"));
|
||||
el_val_t room_id = json_get(body, EL_STR("room_id"));
|
||||
el_val_t conv_id = json_get(body, EL_STR("conv_id"));
|
||||
el_val_t identity = state_get(EL_STR("soul_identity"));
|
||||
el_val_t cgi_id = state_get(EL_STR("soul_cgi_id"));
|
||||
el_val_t model = chat_default_model();
|
||||
el_val_t search_query = ({ el_val_t _if_result_35 = 0; if (str_eq(topic, EL_STR(""))) { _if_result_35 = (cgi_id); } else { _if_result_35 = (topic); } _if_result_35; });
|
||||
el_val_t engram_ctx = engram_compile(search_query);
|
||||
el_val_t engram_section = ({ el_val_t _if_result_36 = 0; if (str_eq(engram_ctx, EL_STR(""))) { _if_result_36 = (EL_STR("")); } else { _if_result_36 = (el_str_concat(EL_STR("\n\n[YOUR MEMORIES]\n"), engram_ctx)); } _if_result_36; });
|
||||
el_val_t system_prompt = el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(identity, EL_STR("\n\n[DHARMA ROOM: ")), topic), EL_STR("]")), EL_STR("\nOther participants: ")), participants), engram_section), EL_STR("\n\nRespond authentically as yourself. Be concise \xe2\x80\x94 match length to the moment. ")), EL_STR("If you want to address someone specifically, use @<their-slug>. No em dashes. No stage directions."));
|
||||
if (str_eq(transcript, EL_STR(""))) {
|
||||
return el_str_concat(el_str_concat(EL_STR("{\"error\":\"transcript is required\",\"response\":\"\",\"cgi_id\":\""), cgi_id), EL_STR("\"}"));
|
||||
}
|
||||
el_val_t engram_ctx = engram_compile(transcript);
|
||||
el_val_t system_prompt = ({ el_val_t _if_result_35 = 0; if (str_eq(engram_ctx, EL_STR(""))) { _if_result_35 = (identity); } else { _if_result_35 = (el_str_concat(el_str_concat(identity, EL_STR("\n\n")), engram_ctx)); } _if_result_35; });
|
||||
el_val_t raw_response = llm_call_system(model, system_prompt, transcript);
|
||||
el_val_t is_error = ((str_starts_with(raw_response, EL_STR("{\"error\"")) || str_starts_with(raw_response, EL_STR("{\"type\":\"error\""))) || str_contains(raw_response, EL_STR("authentication_error")));
|
||||
if (is_error) {
|
||||
@@ -341,10 +339,9 @@ el_val_t handle_dharma_room_turn(el_val_t body) {
|
||||
}
|
||||
el_val_t clean_response = clean_llm_response(raw_response);
|
||||
el_val_t snap_path = state_get(EL_STR("soul_snapshot_path"));
|
||||
el_val_t mem = el_str_concat(el_str_concat(el_str_concat(EL_STR("DHARMA room ["), topic), EL_STR("]. I said: ")), clean_response);
|
||||
el_val_t discard_id = engram_node(mem, EL_STR("episodic"), el_from_float(0.6));
|
||||
el_val_t discard_id = engram_node(clean_response, EL_STR("episodic"), el_from_float(0.6));
|
||||
if (!str_eq(snap_path, EL_STR(""))) {
|
||||
engram_save(snap_path);
|
||||
el_val_t discard_save = engram_save(snap_path);
|
||||
}
|
||||
el_val_t safe_response = json_safe(clean_response);
|
||||
return el_str_concat(el_str_concat(el_str_concat(el_str_concat(EL_STR("{\"response\":\""), safe_response), EL_STR("\",\"cgi_id\":\"")), cgi_id), EL_STR("\"}"));
|
||||
@@ -354,7 +351,7 @@ el_val_t handle_dharma_room_turn(el_val_t body) {
|
||||
el_val_t auto_persist(el_val_t req, el_val_t resp) {
|
||||
el_val_t message = json_get(req, EL_STR("message"));
|
||||
el_val_t reply = json_get(resp, EL_STR("response"));
|
||||
el_val_t reply2 = ({ el_val_t _if_result_37 = 0; if (str_eq(reply, EL_STR(""))) { _if_result_37 = (json_get(resp, EL_STR("reply"))); } else { _if_result_37 = (reply); } _if_result_37; });
|
||||
el_val_t reply2 = ({ el_val_t _if_result_36 = 0; if (str_eq(reply, EL_STR(""))) { _if_result_36 = (json_get(resp, EL_STR("reply"))); } else { _if_result_36 = (reply); } _if_result_36; });
|
||||
if (str_eq(message, EL_STR(""))) {
|
||||
return EL_STR("");
|
||||
}
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Reference in New Issue
Block a user