mirror of
https://github.com/myronblair/jarvis
synced 2026-06-30 17:50:23 -05:00
Fix chat URL routing and agent.php fact_type column error
- sendMessage() was fetching /api.php?action=chat which bypasses the /api/* rewrite rule; api.php parsed endpoint as "api.php" → 404. Fixed to /api/chat so the rewrite routes it correctly to chat.php. - agent.php HA entity map INSERT used non-existent fact_type column, causing PDOException on every agent heartbeat. Fixed to use the correct (category, fact_key, fact_value) columns. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -184,7 +184,7 @@ switch ($agentAction) {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
JarvisDB::query(
|
JarvisDB::query(
|
||||||
'INSERT INTO kb_facts (fact_key, fact_value, fact_type) VALUES ("ha/entity_map", ?, "json")
|
'INSERT INTO kb_facts (category, fact_key, fact_value) VALUES ("ha_entities", "ha/entity_map", ?)
|
||||||
ON DUPLICATE KEY UPDATE fact_value=VALUES(fact_value), updated_at=NOW()',
|
ON DUPLICATE KEY UPDATE fact_value=VALUES(fact_value), updated_at=NOW()',
|
||||||
[json_encode($entityMap)]
|
[json_encode($entityMap)]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1180,7 +1180,7 @@ async function sendMessage() {
|
|||||||
const payload = {message:text, session_id:sessionId, stream:true};
|
const payload = {message:text, session_id:sessionId, stream:true};
|
||||||
if (selectedContext) { payload.context = selectedContext; clearContext(); }
|
if (selectedContext) { payload.context = selectedContext; clearContext(); }
|
||||||
|
|
||||||
const resp = await fetch('/api.php?action=chat', {
|
const resp = await fetch('/api/chat', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {'Content-Type':'application/json','X-Session-Token':sessionToken},
|
headers: {'Content-Type':'application/json','X-Session-Token':sessionToken},
|
||||||
body: JSON.stringify(payload),
|
body: JSON.stringify(payload),
|
||||||
|
|||||||
Reference in New Issue
Block a user