Fix: Date-Panic in Wissensbasis (chrono::NaiveDateTime)

- mysql_async mit chrono-Feature für NaiveDateTime-Support
- 7 SELECTs in knowledge.rs von String auf NaiveDateTime umgestellt
- Timestamps werden jetzt korrekt formatiert statt Panic

Getestet:
- Wissens-Suche funktioniert ohne Crash
- Handlanger-Modus Chat-Antwort erscheint
- VSCodium-Extension Verbindung OK

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Eddy 2026-04-15 12:43:41 +02:00
parent 0c095a4d49
commit a203589eda
4 changed files with 32 additions and 15 deletions

1
.gitignore vendored
View file

@ -30,3 +30,4 @@ package-lock.json
.claude/scheduled_tasks.lock .claude/scheduled_tasks.lock
vscode-extension/out/ vscode-extension/out/
vscode-extension/node_modules/ vscode-extension/node_modules/
*.vsix

1
src-tauri/Cargo.lock generated
View file

@ -2521,6 +2521,7 @@ dependencies = [
"byteorder", "byteorder",
"bytes", "bytes",
"cc", "cc",
"chrono",
"cmake", "cmake",
"crc32fast", "crc32fast",
"flate2", "flate2",

View file

@ -21,7 +21,7 @@ tokio = { version = "1", features = ["full"] }
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4", features = ["serde"] }
uuid = { version = "1", features = ["v4", "serde"] } uuid = { version = "1", features = ["v4", "serde"] }
rusqlite = { version = "0.31", features = ["bundled"] } rusqlite = { version = "0.31", features = ["bundled"] }
mysql_async = "0.34" mysql_async = { version = "0.34", features = ["chrono"] }
reqwest = { version = "0.12", features = ["json", "multipart"] } reqwest = { version = "0.12", features = ["json", "multipart"] }
base64 = "0.22" base64 = "0.22"
tokio-tungstenite = "0.23" tokio-tungstenite = "0.23"

View file

@ -3,6 +3,7 @@
use mysql_async::{Pool, prelude::*}; use mysql_async::{Pool, prelude::*};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use chrono::NaiveDateTime;
/// Verbindungskonfiguration /// Verbindungskonfiguration
const MYSQL_HOST: &str = "192.168.155.11"; const MYSQL_HOST: &str = "192.168.155.11";
@ -91,11 +92,13 @@ pub async fn search_knowledge(
LIMIT ?"#, LIMIT ?"#,
(&query, &query, &cat, limit), (&query, &query, &cat, limit),
|(id, category, title, content, tags, priority, status, related_ids, source, created_at, updated_at, relevance): |(id, category, title, content, tags, priority, status, related_ids, source, created_at, updated_at, relevance):
(i64, String, String, String, Option<String>, i32, String, Option<String>, Option<String>, String, String, f64)| { (i64, String, String, String, Option<String>, i32, String, Option<String>, Option<String>, NaiveDateTime, NaiveDateTime, f64)| {
SearchResult { SearchResult {
entry: KnowledgeEntry { entry: KnowledgeEntry {
id, category, title, content, tags, priority, status, id, category, title, content, tags, priority, status,
related_ids, source, created_at, updated_at, related_ids, source,
created_at: created_at.format("%Y-%m-%d %H:%M:%S").to_string(),
updated_at: updated_at.format("%Y-%m-%d %H:%M:%S").to_string(),
}, },
relevance, relevance,
} }
@ -113,11 +116,13 @@ pub async fn search_knowledge(
LIMIT ?"#, LIMIT ?"#,
(&query, &query, limit), (&query, &query, limit),
|(id, category, title, content, tags, priority, status, related_ids, source, created_at, updated_at, relevance): |(id, category, title, content, tags, priority, status, related_ids, source, created_at, updated_at, relevance):
(i64, String, String, String, Option<String>, i32, String, Option<String>, Option<String>, String, String, f64)| { (i64, String, String, String, Option<String>, i32, String, Option<String>, Option<String>, NaiveDateTime, NaiveDateTime, f64)| {
SearchResult { SearchResult {
entry: KnowledgeEntry { entry: KnowledgeEntry {
id, category, title, content, tags, priority, status, id, category, title, content, tags, priority, status,
related_ids, source, created_at, updated_at, related_ids, source,
created_at: created_at.format("%Y-%m-%d %H:%M:%S").to_string(),
updated_at: updated_at.format("%Y-%m-%d %H:%M:%S").to_string(),
}, },
relevance, relevance,
} }
@ -145,10 +150,12 @@ pub async fn get_knowledge(id: i64) -> Result<Option<KnowledgeEntry>, String> {
(id,) (id,)
).await.map_err(|e| e.to_string())? ).await.map_err(|e| e.to_string())?
.map(|(id, category, title, content, tags, priority, status, related_ids, source, created_at, updated_at): .map(|(id, category, title, content, tags, priority, status, related_ids, source, created_at, updated_at):
(i64, String, String, String, Option<String>, i32, String, Option<String>, Option<String>, String, String)| { (i64, String, String, String, Option<String>, i32, String, Option<String>, Option<String>, NaiveDateTime, NaiveDateTime)| {
KnowledgeEntry { KnowledgeEntry {
id, category, title, content, tags, priority, status, id, category, title, content, tags, priority, status,
related_ids, source, created_at, updated_at, related_ids, source,
created_at: created_at.format("%Y-%m-%d %H:%M:%S").to_string(),
updated_at: updated_at.format("%Y-%m-%d %H:%M:%S").to_string(),
} }
}); });
@ -223,10 +230,12 @@ pub async fn get_recent_knowledge(
LIMIT ?"#, LIMIT ?"#,
(&cat, limit), (&cat, limit),
|(id, category, title, content, tags, priority, status, related_ids, source, created_at, updated_at): |(id, category, title, content, tags, priority, status, related_ids, source, created_at, updated_at):
(i64, String, String, String, Option<String>, i32, String, Option<String>, Option<String>, String, String)| { (i64, String, String, String, Option<String>, i32, String, Option<String>, Option<String>, NaiveDateTime, NaiveDateTime)| {
KnowledgeEntry { KnowledgeEntry {
id, category, title, content, tags, priority, status, id, category, title, content, tags, priority, status,
related_ids, source, created_at, updated_at, related_ids, source,
created_at: created_at.format("%Y-%m-%d %H:%M:%S").to_string(),
updated_at: updated_at.format("%Y-%m-%d %H:%M:%S").to_string(),
} }
} }
).await.map_err(|e| e.to_string())? ).await.map_err(|e| e.to_string())?
@ -240,10 +249,12 @@ pub async fn get_recent_knowledge(
LIMIT ?"#, LIMIT ?"#,
(limit,), (limit,),
|(id, category, title, content, tags, priority, status, related_ids, source, created_at, updated_at): |(id, category, title, content, tags, priority, status, related_ids, source, created_at, updated_at):
(i64, String, String, String, Option<String>, i32, String, Option<String>, Option<String>, String, String)| { (i64, String, String, String, Option<String>, i32, String, Option<String>, Option<String>, NaiveDateTime, NaiveDateTime)| {
KnowledgeEntry { KnowledgeEntry {
id, category, title, content, tags, priority, status, id, category, title, content, tags, priority, status,
related_ids, source, created_at, updated_at, related_ids, source,
created_at: created_at.format("%Y-%m-%d %H:%M:%S").to_string(),
updated_at: updated_at.format("%Y-%m-%d %H:%M:%S").to_string(),
} }
} }
).await.map_err(|e| e.to_string())? ).await.map_err(|e| e.to_string())?
@ -322,10 +333,12 @@ pub async fn get_tool_hints(
LIMIT 3"#, LIMIT 3"#,
(&cat, &query_string), (&cat, &query_string),
|(id, category, title, content, tags, priority, status, related_ids, source, created_at, updated_at): |(id, category, title, content, tags, priority, status, related_ids, source, created_at, updated_at):
(i64, String, String, String, Option<String>, i32, String, Option<String>, Option<String>, String, String)| { (i64, String, String, String, Option<String>, i32, String, Option<String>, Option<String>, NaiveDateTime, NaiveDateTime)| {
KnowledgeEntry { KnowledgeEntry {
id, category, title, content, tags, priority, status, id, category, title, content, tags, priority, status,
related_ids, source, created_at, updated_at, related_ids, source,
created_at: created_at.format("%Y-%m-%d %H:%M:%S").to_string(),
updated_at: updated_at.format("%Y-%m-%d %H:%M:%S").to_string(),
} }
} }
).await.map_err(|e| e.to_string())? ).await.map_err(|e| e.to_string())?
@ -340,10 +353,12 @@ pub async fn get_tool_hints(
LIMIT 3"#, LIMIT 3"#,
(&query_string,), (&query_string,),
|(id, category, title, content, tags, priority, status, related_ids, source, created_at, updated_at): |(id, category, title, content, tags, priority, status, related_ids, source, created_at, updated_at):
(i64, String, String, String, Option<String>, i32, String, Option<String>, Option<String>, String, String)| { (i64, String, String, String, Option<String>, i32, String, Option<String>, Option<String>, NaiveDateTime, NaiveDateTime)| {
KnowledgeEntry { KnowledgeEntry {
id, category, title, content, tags, priority, status, id, category, title, content, tags, priority, status,
related_ids, source, created_at, updated_at, related_ids, source,
created_at: created_at.format("%Y-%m-%d %H:%M:%S").to_string(),
updated_at: updated_at.format("%Y-%m-%d %H:%M:%S").to_string(),
} }
} }
).await.map_err(|e| e.to_string())? ).await.map_err(|e| e.to_string())?