2// Run this script manually to add new columns to the memories table
34export default async function migrateMemoriesDb() {
5try {
6// Import SQLite module
2// Run this script manually to set createdBy based on memory content
34export default async function populateCreatedBy() {
5try {
6// Import SQLite module
4import { nanoid } from "https://esm.sh/nanoid@5.0.5";
56export default async function populateMemoryIds() {
7try {
8// Import SQLite module
2// Run this script manually to create the database table
34export default async function setupTelegramChatDb() {
5try {
6// Import SQLite module
a8b48747537_README.md2 matches
16In a normal server environment, you would likely use a middleware [like this one](https://hono.dev/docs/getting-started/nodejs#serve-static-files) to serve static files. Some frameworks or deployment platforms automatically make any content inside a `public/` folder public.
1718However in Val Town you need to handle this yourself, and it can be suprisingly difficult to read and serve files in a Val Town Project. This template uses helper functions from [stevekrouse/utils/serve-public](https://www.val.town/x/stevekrouse/utils/branch/main/code/serve-public/README.md), which handle reading project files in a way that will work across branches and forks, automatically transpiles typescript to javascript, and assigns content-types based on the file's extension.
1920### `index.html`
26## CRUD API Routes
2728This app has two CRUD API routes: for reading and inserting into the messages table. They both speak JSON, which is standard. They import their functions from `/backend/database/queries.ts`. These routes are called from the React app to refresh and update data.
2930## Errors
a8b48747537_queries.ts4 matches
6const tableName = "memories_demo";
78export async function getAllMemories(): Promise<Memory[]> {
9const result = await sqlite.execute(
10`SELECT id, date, text, createdBy, createdDate, tags FROM ${tableName}
23}
2425export async function createMemory(
26memory: Omit<Memory, "id">
27): Promise<Memory> {
51}
5253export async function updateMemory(
54id: string,
55memory: Partial<Omit<Memory, "id">>
70}
7172export async function deleteMemory(id: string): Promise<void> {
73await sqlite.execute(`DELETE FROM ${tableName} WHERE id = ?`, [id]);
74}
a8b48747537_README.md2 matches
45* `migrations.ts` - code to set up the database tables the app needs
6* `queries.ts` - functions to run queries against those tables, which are imported and used in the main Hono server in `/backend/index.ts`
78## Migrations
18The queries file is where running the migrations happen in this app. It'd also be reasonable for that to happen in index.ts, or as is said above, for that line to be commented out, and only run when actual changes are made to your database schema.
1920The queries file exports functions to get and write data. It relies on shared types and data imported from the `/shared` directory.
a8b48747537_NotebookView.tsx1 match
54}
5556export function NotebookView({ onClose, avatarUrl }: NotebookViewProps) {
57const [memories, setMemories] = useState<Memory[]>([]);
58const [loading, setLoading] = useState(true);
a8b48747537_App.tsx2 matches
62};
6364export function App() {
65const [memories, setMemories] = useState<Memory[]>([]);
66const [loading, setLoading] = useState(true);
139const data = await response.json();
140141// Change the sorting function to show memories in chronological order
142const sortedMemories = [...data].sort((a, b) => {
143const dateA = a.createdDate || 0;
resume-parserresumeParser.ts12 matches
1617/**
18* Helper function to create a confidence field with a value and confidence score
19*/
20function createConfidenceField<T>(
21value: T,
22confidence: number,
37* @returns Structured resume data with confidence scores
38*/
39export async function extractResumeData(
40resumeText: string,
41options?: ResumeParserOptions
96* @returns Finalized resume data
97*/
98function postProcessResumeData(data: any, confidenceThreshold: number = 0.3): ParsedResume {
99try {
100// Ensure we have all required sections with at least empty arrays
220* Create a default personal info object with empty fields
221*/
222function createDefaultPersonalInfo(): PersonalInfo {
223return {
224name: createConfidenceField('', 0),
236* Calculate months between two dates
237*/
238function calculateMonthsBetween(startDate: Date, endDate: Date): number {
239return (endDate.getFullYear() - startDate.getFullYear()) * 12 +
240(endDate.getMonth() - startDate.getMonth());
247* @returns Validated and standardized resume data
248*/
249export function validateAndStandardize(data: ParsedResume): ParsedResume {
250// This function is now deprecated in favor of the validateResumeWithAI function
251// which uses OpenAI to validate and standardize the data
252return data;
261* @returns Confidence score between 0 and 1
262*/
263export function calculateConfidence(
264value: any,
265fieldType: string,
285* @returns Standardized value and standardization notes
286*/
287export function standardizeTerminology(
288value: string,
289fieldType: 'degree' | 'jobTitle' | 'skill' | 'language' | string
302* @returns Resume data with confidence scores added
303*/
304export function addConfidenceScores(data: any): ParsedResume {
305// This function would iterate through the resume data and add
306// confidence scores to each field based on various factors
307