maine-bills-taxsummarize.ts2 matches
1314// Summarize the bills and update cache
15export function summarize(searchResults: SearchResult[]): Promise<string> {
16// Bill context
17const extractImportantInfo = JSON.stringify(searchResults.map(result => ({
3637// Convert the chat completion to a string
38function convertChatCompletionToString(chat: ChatCompletion) {
39return chat.choices[0].message.content;
40}
maine-bills-taxmain.tsx2 matches
1516// Main content body returned to the request
17export default function httpHandler(req: Request): Response {
18return new Response(renderToString(<Content />), { headers: { "content-type": "text/html" } });
19}
2021// Let's display it
22function Content() {
23return (
24<div>
maine-bills-taxsearch.ts2 matches
34// Inject the search term in to the URL
5function getSearchURL(term: string) {
6return `https://legislature.maine.gov/mrs-search/api/billtext?term=${term}&title=&legislature=132&lmSponsorPrimary=false&reqAmendExists=false&reqAmendAdoptH=false&reqAmendAdoptS=false&reqChapterExists=false&reqFNRequired=false&reqEmergency=false&reqGovernor=false&reqBond=false&reqMandate=false&reqPublicLand=false&showExtraParameters=false&mustHave=&mustNotHave=&offset=0&pageSize=12&sortByScore=false&showBillText=false&sortAscending=false&excludeOrders=false`;
7}
89// Query the Maine bill database
10export function search(term: string): Promise<SearchResult[]> {
11return fetchText(getSearchURL(term)).then((res) => {
12return JSON.parse(res).hits.hits;
7};
89export default async function(req: Request): Promise<Response> {
10const searchParams = new URL(req.url).searchParams;
11const discussionId = searchParams.get("discussion");
7677// This takes an array and chunks it.
78function chunkArray<T>(array: T[], chunkSize: number): T[][] {
79const chunks: T[][] = [];
80for (let i = 0; i < array.length; i += chunkSize) {
maine-bills-taxcache.ts3 matches
910// This is used as the `key` in our table
11function createIdHash(results: SearchResult[]) {
12return results.map((result) => result._id).sort((a, b) => a.localeCompare(b)).join("-");
13}
16* Check if the cache exists
17*/
18export function getCache(results: SearchResult[]): Promise<string | undefined> {
19const id = createIdHash(results);
20return sqlite.execute({ sql: `select value from bill_kv where key = ?`, args: [id] }).then((res) => {
35* Set the cache
36*/
37export function setCache(results: SearchResult[], value: string): Promise<any> {
38const id = createIdHash(results);
39return sqlite.execute({ sql: `insert into bill_kv(key, value) values(?, ?)`, args: [id, value] });
productpaneldashboard.http.ts5 matches
10* Handle the dashboardHome HTTP request
11*/
12export default async function (req: Request): Promise<Response> {
13// Only allow GET requests
14if (req.method !== "GET") {
64* Create a login page response
65*/
66function createLoginPage(): Response {
67const html = `<!DOCTYPE html>
68<html lang="en">
96
97<script>
98document.getElementById('loginForm').addEventListener('submit', function(e) {
99e.preventDefault();
100
124* Render the Vue-based dashboard HTML
125*/
126function renderVueDashboard(apps: any[]): string {
127return `<!DOCTYPE html>
128<html lang="en">
592* Render an error page
593*/
594function renderErrorPage(errorMessage: string): string {
595return `<!DOCTYPE html>
596<html lang="en">
productpanelREADME.md2 matches
20### Key Vue Features Used
2122- **Composition API**: Modern Vue 3 approach with `setup()` function
23- **Template syntax**: `v-for`, `v-if`, `v-model`, etc.
24- **Component props and emits**: Clean component API
551. Add new components to `components.ts` if they're reusable
562. Update the main dashboard template for layout changes
573. Add new reactive state and methods in the `setup()` function
5859## Benefits Over the Previous Implementation
sqliteExplorerAppREADME.md1 match
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query
37
productpaneldebug-client.http.ts12 matches
6*/
78export default function(req: Request): Response {
9return new Response(`
10// ProductPanel Dashboard Debug Utility
1112(function() {
13// Create debug panel
14const debugPanel = document.createElement('div');
45
46debugPanel.style.display = 'none';
47toggleButton.addEventListener('click', function() {
48debugPanel.style.display = debugPanel.style.display === 'none' ? 'block' : 'none';
49});
50
51// Debug log function
52window.debugLog = function(message) {
53const logDiv = document.getElementById('debug-log');
54const entry = document.createElement('div');
62
63// Fix app card event listeners
64window.fixAppCards = function() {
65debugLog('Fixing app card click handlers...');
66
70
71// Attach direct onclick handlers
72appCards.forEach(function(card, index) {
73const appId = card.getAttribute('data-app-id');
74debugLog('Processing card ' + index + ' with ID: ' + appId);
95});
96
97// Define the global handler function
98window.handleAppCardClick = function(card) {
99const appId = card.getAttribute('data-app-id');
100const index = card.getAttribute('data-index');
106
107// Update active card styling
108document.querySelectorAll('.app-card').forEach(function(c) {
109c.classList.remove('border-indigo-600');
110c.classList.add('border-gray-200');
128
129// Run automatic fixes when the page loads
130window.addEventListener('load', function() {
131debugLog('Page loaded, running automatic fixes...');
132
133// Wait a moment to ensure the DOM is fully loaded
134setTimeout(function() {
135window.fixAppCards();
136}, 1000);
32MCP (Model Context Protocol) is an open protocol developed by Anthropic that lets LLMs
33interact with external tools and data sources. It allows AI agents to access data and execute
34functionality in a standardized way across different applications.
35</p>
36
7778// Handler for our HTTP endpoint
79export default async function handler(req: Request): Promise<Response> {
80try {
81// Create a minimal MCP server