7export const thinkTool = tool({
8 description:
9 "Use the tool to think about something. It will not obtain new information or change the database, but just append the thought to the log. Use it when complex reasoning or some cache memory is needed.",
10 parameters: z.object({
11 thought: z.string().describe("A thought to think about."),
149```
150โโโ backend/
151โ โโโ database/
152โ โ โโโ migrations.ts # Schema definitions
153โ โ โโโ queries.ts # DB query functions
208 ```
209
210### Database Patterns
211- Run migrations on startup or comment out for performance
212- Change table names when modifying schemas rather than altering
17```
18โโโ backend/
19โ โโโ database/
20โ โ โโโ migrations.ts # Database schema
21โ โ โโโ queries.ts # Database queries
22โ โโโ index.ts # Server entry point
23โโโ frontend/
9import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
10import { routes } from "../shared/routes.ts";
11import { initializeDatabase } from "./database/migrations.ts";
12
13// Initialize the database
14await initializeDatabase();
15
16// Create the Hono app
1import { ActionFunctionArgs, redirect } from "https://esm.sh/react-router@7.5.0?deps=react@18.2.0,react-dom@18.2.0";
2import { createTopic } from "../backend/database/queries.ts";
3
4export async function action({ request }: ActionFunctionArgs) {
1import { LoaderFunctionArgs } from "https://esm.sh/react-router@7.5.0?deps=react@18.2.0,react-dom@18.2.0";
2import { getTopicById, getMessageById, getMessagesByTopicId } from "../backend/database/queries.ts";
3
4export async function loader({ params }: LoaderFunctionArgs) {
1import { LoaderFunctionArgs } from "https://esm.sh/react-router@7.5.0?deps=react@18.2.0,react-dom@18.2.0";
2import { getTopicById, getMessagesByTopicId } from "../backend/database/queries.ts";
3
4export async function loader({ params }: LoaderFunctionArgs) {
1import { ActionFunctionArgs } from "https://esm.sh/react-router@7.5.0?deps=react@18.2.0,react-dom@18.2.0";
2import { createMessage } from "../backend/database/queries.ts";
3
4export async function action({ request }: ActionFunctionArgs) {
1import { LoaderFunctionArgs } from "https://esm.sh/react-router@7.5.0?deps=react@18.2.0,react-dom@18.2.0";
2import { search } from "../backend/database/queries.ts";
3
4export async function loader({ request }: LoaderFunctionArgs) {
17```
18โโโ backend/
19โ โโโ database/
20โ โ โโโ migrations.ts # Database schema
21โ โ โโโ queries.ts # Database queries
22โ โโโ index.ts # Server entry point
23โโโ frontend/