blob: b525785c1b58201a07f83425ff868230b2ec013e [file] [log] [blame]
Sean McCullough86b56862025-04-18 13:04:03 -07001<!DOCTYPE html>
2<html>
3 <head>
4 <meta charset="utf-8" />
5 <title>Sketch Charts Demo</title>
6 <script type="module" src="/dist/web-components/sketch-charts.js"></script>
7 <link rel="stylesheet" href="demo.css" />
8 <style>
9 sketch-charts {
10 margin: 20px;
11 max-width: 1000px;
12 }
13
14 body {
15 font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
16 Roboto, sans-serif;
17 }
18 </style>
19 </head>
20 <body>
21 <h1>Sketch Charts Demo</h1>
22 <sketch-charts id="charts"></sketch-charts>
23
24 <script>
25 // Sample data for testing
26 const sampleMessages = [
27 {
28 idx: 1,
29 type: "human",
30 content: "Hello, can you help me with a coding task?",
31 timestamp: new Date(Date.now() - 3600000).toISOString(),
32 usage: { cost_usd: 0.0001 },
33 },
34 {
35 idx: 2,
36 type: "assistant",
37 content:
38 "I'd be happy to help! What kind of coding task are you working on?",
39 timestamp: new Date(Date.now() - 3500000).toISOString(),
40 usage: { cost_usd: 0.0005 },
41 },
42 {
43 idx: 3,
44 type: "human",
45 content: "I need to create a web component using lit-element",
46 timestamp: new Date(Date.now() - 3400000).toISOString(),
47 usage: { cost_usd: 0.0001 },
48 },
49 {
50 idx: 4,
51 type: "assistant",
52 content:
53 "I can definitely help with that. Lit Element is a great library for building web components.",
54 timestamp: new Date(Date.now() - 3300000).toISOString(),
55 usage: { cost_usd: 0.0008 },
56 },
57 {
58 idx: 5,
59 type: "assistant",
60 tool_name: "bash",
61 input: "ls -la",
62 tool_result:
63 "total 16\ndrwxr-xr-x 4 user staff 128 Jan 10 12:34 .\ndrwxr-xr-x 10 user staff 320 Jan 10 12:34 ..\n-rw-r--r-- 1 user staff 123 Jan 10 12:34 file1.txt\n-rw-r--r-- 1 user staff 456 Jan 10 12:34 file2.txt",
64 start_time: new Date(Date.now() - 3200000).toISOString(),
65 end_time: new Date(Date.now() - 3190000).toISOString(),
66 timestamp: new Date(Date.now() - 3190000).toISOString(),
67 usage: { cost_usd: 0.0002 },
68 },
69 {
70 idx: 6,
71 type: "assistant",
72 content: "Let me create a basic web component for you.",
73 timestamp: new Date(Date.now() - 3100000).toISOString(),
74 usage: { cost_usd: 0.0015 },
75 },
76 {
77 idx: 7,
78 type: "human",
79 content: "Can you show me how to handle events in the web component?",
80 timestamp: new Date(Date.now() - 3000000).toISOString(),
81 usage: { cost_usd: 0.0001 },
82 },
83 {
84 idx: 8,
85 type: "assistant",
86 tool_name: "bash",
87 input: "cat example.ts",
88 tool_result:
89 "import { LitElement, html } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\n@customElement('my-element')\nexport class MyElement extends LitElement {\n render() {\n return html`<div>Hello World</div>`;\n }\n}",
90 start_time: new Date(Date.now() - 2900000).toISOString(),
91 end_time: new Date(Date.now() - 2800000).toISOString(),
92 timestamp: new Date(Date.now() - 2800000).toISOString(),
93 usage: { cost_usd: 0.0003 },
94 },
95 {
96 idx: 9,
97 type: "assistant",
98 content:
99 "Here's how you can handle events in a web component using Lit.",
100 timestamp: new Date(Date.now() - 2700000).toISOString(),
101 usage: { cost_usd: 0.002 },
102 },
103 {
104 idx: 10,
105 type: "human",
106 content: "Thank you! How about adding properties and attributes?",
107 timestamp: new Date(Date.now() - 2600000).toISOString(),
108 usage: { cost_usd: 0.0001 },
109 },
110 {
111 idx: 11,
112 type: "assistant",
113 content:
114 "You can use the @property decorator to define properties in your Lit Element component.",
115 timestamp: new Date(Date.now() - 2500000).toISOString(),
116 usage: { cost_usd: 0.0025 },
117 },
118 ];
119
120 // Set sample data as soon as the component is defined
121 document.addEventListener("DOMContentLoaded", () => {
122 console.time("chart-demo-load");
123 const chartsComponent = document.getElementById("charts");
124 chartsComponent.messages = sampleMessages;
125 console.timeEnd("chart-demo-load");
126 });
127 </script>
128 </body>
129</html>