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:
2026-06-17 12:33:09 +00:00
parent 6195f9bd3b
commit f304ada4d3
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -184,7 +184,7 @@ switch ($agentAction) {
];
}
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()',
[json_encode($entityMap)]
);
+1 -1
View File
@@ -1180,7 +1180,7 @@ async function sendMessage() {
const payload = {message:text, session_id:sessionId, stream:true};
if (selectedContext) { payload.context = selectedContext; clearContext(); }
const resp = await fetch('/api.php?action=chat', {
const resp = await fetch('/api/chat', {
method: 'POST',
headers: {'Content-Type':'application/json','X-Session-Token':sessionToken},
body: JSON.stringify(payload),