LLM call logging, plan persistence API, quote-to-feedback UX, requirement input improvements
- Add llm_call_log table and per-call timing/token tracking in agent loop
- New GET /workflows/{id}/plan endpoint to restore plan from snapshots on page load
- New GET /workflows/{id}/llm-calls endpoint + WS LlmCallLog broadcast
- Parse Usage from LLM API response (prompt_tokens, completion_tokens)
- Detailed mode toggle in execution log showing LLM call cards with phase/tokens/latency
- Quote-to-feedback: hover quote buttons on plan steps and log entries, multi-quote chips in comment input
- Requirement input: larger textarea, multi-line display with pre-wrap and scroll
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
42
src/db.rs
42
src/db.rs
@@ -158,6 +158,32 @@ impl Database {
|
||||
.execute(&self.pool)
|
||||
.await?;
|
||||
|
||||
sqlx::query(
|
||||
"CREATE TABLE IF NOT EXISTS llm_call_log (
|
||||
id TEXT PRIMARY KEY,
|
||||
workflow_id TEXT NOT NULL REFERENCES workflows(id),
|
||||
step_order INTEGER NOT NULL,
|
||||
phase TEXT NOT NULL,
|
||||
messages_count INTEGER NOT NULL,
|
||||
tools_count INTEGER NOT NULL,
|
||||
tool_calls TEXT NOT NULL DEFAULT '[]',
|
||||
text_response TEXT NOT NULL DEFAULT '',
|
||||
prompt_tokens INTEGER,
|
||||
completion_tokens INTEGER,
|
||||
latency_ms INTEGER NOT NULL,
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
||||
)"
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await?;
|
||||
|
||||
// Migration: add text_response column to llm_call_log
|
||||
let _ = sqlx::query(
|
||||
"ALTER TABLE llm_call_log ADD COLUMN text_response TEXT NOT NULL DEFAULT ''"
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await;
|
||||
|
||||
sqlx::query(
|
||||
"CREATE TABLE IF NOT EXISTS timers (
|
||||
id TEXT PRIMARY KEY,
|
||||
@@ -237,3 +263,19 @@ pub struct Timer {
|
||||
pub last_run_at: String,
|
||||
pub created_at: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct LlmCallLogEntry {
|
||||
pub id: String,
|
||||
pub workflow_id: String,
|
||||
pub step_order: i32,
|
||||
pub phase: String,
|
||||
pub messages_count: i32,
|
||||
pub tools_count: i32,
|
||||
pub tool_calls: String,
|
||||
pub text_response: String,
|
||||
pub prompt_tokens: Option<i32>,
|
||||
pub completion_tokens: Option<i32>,
|
||||
pub latency_ms: i32,
|
||||
pub created_at: String,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user