Move to sqlite off cloud

This commit is contained in:
2026-03-06 18:49:41 +02:00
parent 27b7d87e68
commit 1b31f3194d
23 changed files with 266 additions and 655 deletions

View File

@@ -101,33 +101,16 @@ export const createActivityContent = async ({
: draw(user.preferences.data!.highlights!);
const length = match({ tone })
.with({ tone: "Minimalist" }, () => "short")
.otherwise(() => draw(["short", "medium", "a-little-more-than-medium"]));
.with({ tone: "Minimalist" }, () => "very short")
.otherwise(() => draw(["very short", "short"]));
const prompt = `
Generate a short title and a ${length}-lengthed description for my strava activity. Use my preferred language and unit system.
Use first person, as this will be posting for myself. Try to not exaggerate as I am using Strava often and I want my activites to be unique and easy to read. Don't use repeative language.
Depending the activity conditions and achievements, use one of the following tones to make things less boring:
${availableTones.join(", ")}. Accordingly, depending on the activity's conditions, highlight area exploration, athletic achievements, mood swings or weather conditions.
If there is nothing interesting to say, try making a mild joke or say an interesting fact about the route. Do not add fun facts if mentioned in the recent activities.
Take heart data, suffer score and weather into consideration if available, combine them to understand the effort. No need to mention suffer score every time.
Maybe comment if any interesting fact in comparison to previous activities.
NEVER use — symbol. Not for titles, not for descriptions.
Depending the length of the description, maybe add hashtags.
Language: ${user?.preferences.data!.language}
Unit system: ${user?.preferences.data!.units}
Activity notes:
Distance is in meters, time is in seconds, don't include average speed.
Convert time to hours or minutes, whatever's closer.
Convert distance to larger units when appropriate, we don't need accuracy. Better say almost 50 instead of 48.67 for example.
In the end of the description, add "${promo}" translated to my language.
Tone: ${tone}
Highlight: ${highlight}
Description length: ${length}
The activity data in json format from strava:
${stringifyActivity({ activity: currentActivity })}

View File

@@ -1,5 +1,10 @@
import { drizzle } from "drizzle-orm/neon-http";
export { sql, eq, and, or } from "drizzle-orm";
import { drizzle } from "drizzle-orm/bun-sqlite";
import { eq as _eq, and as _and, or as _or, sql as _sql } from "drizzle-orm";
export const sql = _sql;
export const eq = _eq;
export const and = _and;
export const or = _or;
import * as schema from "../database/schema";