Skip to content

history-lab/convo-analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conversation Analytics Dashboard

A Cloudflare Worker that provides analytics and visualizations for conversation logs stored in KV storage.

Features

  • Fetches conversation log data from Cloudflare KV storage
  • Displays key metrics like message counts, tool calls, and character usage
  • Shows data grouped by day with interactive charts
  • Includes a refresh button to manually update the data
  • Provides a breakdown of tool usage across all conversations

Setup

  1. Clone this repository
  2. Install dependencies:
    npm install
    
  3. Configure the KV namespace in wrangler.jsonc (already set up with the provided namespace ID)
  4. Run locally:
    npm run dev
    
  5. Deploy to Cloudflare:
    npm run deploy
    

Implementation Details

The worker:

  1. Fetches all keys from the KV namespace
  2. Retrieves each log entry and processes the data
  3. Groups data by day based on the updatedAt timestamp
  4. Calculates aggregate metrics (total messages, tool calls, etc.)
  5. Generates HTML with embedded charts using Chart.js
  6. Returns a complete dashboard as a single HTML response

Dashboard Metrics

  • Total conversations
  • Total messages
  • Average messages per conversation
  • Total tool calls
  • Unique users
  • Input/output character counts
  • Daily breakdown of messages, tool calls, and users
  • Tool usage distribution

Development

This project uses:

  • TypeScript for type safety
  • Chart.js for data visualization
  • Cloudflare Workers KV for data storage
  • Wrangler for local development and deployment

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published