Enhance highlight functionality
This commit is contained in:
@@ -44,12 +44,8 @@
|
||||
"name": "preferences_user_id_users_id_fk",
|
||||
"tableFrom": "preferences",
|
||||
"tableTo": "users",
|
||||
"columnsFrom": [
|
||||
"user_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["user_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -59,9 +55,7 @@
|
||||
"preferences_user_id_unique": {
|
||||
"name": "preferences_user_id_unique",
|
||||
"nullsNotDistinct": false,
|
||||
"columns": [
|
||||
"user_id"
|
||||
]
|
||||
"columns": ["user_id"]
|
||||
}
|
||||
},
|
||||
"policies": {},
|
||||
@@ -121,12 +115,8 @@
|
||||
"name": "tokens_user_id_users_id_fk",
|
||||
"tableFrom": "tokens",
|
||||
"tableTo": "users",
|
||||
"columnsFrom": [
|
||||
"user_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["user_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -136,9 +126,7 @@
|
||||
"tokens_user_id_unique": {
|
||||
"name": "tokens_user_id_unique",
|
||||
"nullsNotDistinct": false,
|
||||
"columns": [
|
||||
"user_id"
|
||||
]
|
||||
"columns": ["user_id"]
|
||||
}
|
||||
},
|
||||
"policies": {},
|
||||
@@ -225,4 +213,4 @@
|
||||
"schemas": {},
|
||||
"tables": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,12 +44,8 @@
|
||||
"name": "preferences_user_id_users_id_fk",
|
||||
"tableFrom": "preferences",
|
||||
"tableTo": "users",
|
||||
"columnsFrom": [
|
||||
"user_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["user_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -59,9 +55,7 @@
|
||||
"preferences_user_id_unique": {
|
||||
"name": "preferences_user_id_unique",
|
||||
"nullsNotDistinct": false,
|
||||
"columns": [
|
||||
"user_id"
|
||||
]
|
||||
"columns": ["user_id"]
|
||||
}
|
||||
},
|
||||
"policies": {},
|
||||
@@ -121,12 +115,8 @@
|
||||
"name": "tokens_user_id_users_id_fk",
|
||||
"tableFrom": "tokens",
|
||||
"tableTo": "users",
|
||||
"columnsFrom": [
|
||||
"user_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["user_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -136,9 +126,7 @@
|
||||
"tokens_user_id_unique": {
|
||||
"name": "tokens_user_id_unique",
|
||||
"nullsNotDistinct": false,
|
||||
"columns": [
|
||||
"user_id"
|
||||
]
|
||||
"columns": ["user_id"]
|
||||
}
|
||||
},
|
||||
"policies": {},
|
||||
@@ -225,4 +213,4 @@
|
||||
"schemas": {},
|
||||
"tables": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,4 +24,4 @@
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { chain, draw, get, isEmpty, omit, pick, tryit } from "radash";
|
||||
import { safeDestr } from "destr";
|
||||
import { match } from "ts-pattern";
|
||||
import { User } from "./drizzle";
|
||||
import { availableHighlights, availableTones } from "~/shared/constants";
|
||||
|
||||
@@ -123,19 +124,39 @@ export const createActivityContent = async ({
|
||||
const highlight = isEmpty(user.preferences.data?.highlights)
|
||||
? (draw(availableHighlights) as string)
|
||||
: draw(user.preferences.data!.highlights!);
|
||||
const highlightInstructions = match(highlight)
|
||||
.with(
|
||||
"Athletic",
|
||||
() =>
|
||||
"Highlight athletic properties and performance. Highlight PR's as well only if available.",
|
||||
)
|
||||
.with("Area Exploration", () => "Highlight area exploration properties.")
|
||||
.with(
|
||||
"Social",
|
||||
() =>
|
||||
"Highlight social properties such as friend participation and activities.",
|
||||
)
|
||||
.with(
|
||||
"Mood",
|
||||
() => "Highlight on how mood was swinging through the activity.",
|
||||
)
|
||||
.with("Conditions", () => "Highlight on weather conditions");
|
||||
|
||||
const length = draw(["short", "medium", "a-little-more-than-medium"]);
|
||||
const length = match({ tone })
|
||||
.with({ tone: "Minimalist" }, () => "short")
|
||||
.otherwise(() => draw(["short", "medium", "a-little-more-than-medium"]));
|
||||
|
||||
const prompt = `
|
||||
Generate a short title and a ${length}-lengthed description for my strava activity. Use my preferred language and unit system.
|
||||
Try to not exaggerate as I am using Strava often and I want my activites to be unique and easy to read. Don't say things like nothing too fancy or wild.
|
||||
Use a little bit of ${tone} tone to make things less boring. Highlight ${highlight} properties if available.
|
||||
Use a little bit of ${tone} tone to make things less boring.
|
||||
${highlightInstructions}
|
||||
Maybe comment if any interesting fact in comparison to previous activities.
|
||||
|
||||
Add #${tone} and #${highlight} at the end of the description. Depending the length of the description, maybe add more hashtags.
|
||||
|
||||
Language: ${user?.preferences.data.language}
|
||||
Unit system: ${user?.preferences.data.units}
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user