{displayTimes.map((time, index) => {
const hourTime = new Date(time);
- const isCurrentHour = hourTime.getHours() === new Date().getHours();
-
+ const isCurrentHour =
+ hourTime.getHours() === new Date().getHours();
+
return (
-
-
+
{index === 0 ? "Now" : format(hourTime, "ha")}
-
-
+
+
-
-
+
+
{n(displayTemperatures[index])}°
@@ -359,9 +418,15 @@ export function Weather({
-
-
Sunrise: {format(new Date(weatherAtLocation.daily.sunrise[0]), "h:mm a")}
-
Sunset: {format(new Date(weatherAtLocation.daily.sunset[0]), "h:mm a")}
+
+
+ Sunrise:{" "}
+ {format(new Date(weatherAtLocation.daily.sunrise[0]), "h:mm a")}
+
+
+ Sunset:{" "}
+ {format(new Date(weatherAtLocation.daily.sunset[0]), "h:mm a")}
+
diff --git a/lib/ai/prompts.ts b/lib/ai/prompts.ts
index 80b87e6..823fc7b 100644
--- a/lib/ai/prompts.ts
+++ b/lib/ai/prompts.ts
@@ -117,4 +117,4 @@ export const titlePrompt = `\n
- you will generate a short title based on the first message a user begins a conversation with
- ensure it is not more than 80 characters long
- the title should be a summary of the user's message
- - do not use quotes or colons`
+ - do not use quotes or colons`;
diff --git a/lib/ai/tools/get-weather.ts b/lib/ai/tools/get-weather.ts
index d83a269..3e616e0 100644
--- a/lib/ai/tools/get-weather.ts
+++ b/lib/ai/tools/get-weather.ts
@@ -1,20 +1,24 @@
import { tool } from "ai";
import { z } from "zod";
-async function geocodeCity(city: string): Promise<{ latitude: number; longitude: number } | null> {
+async function geocodeCity(
+ city: string
+): Promise<{ latitude: number; longitude: number } | null> {
try {
const response = await fetch(
`https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(city)}&count=1&language=en&format=json`
);
-
- if (!response.ok) return null;
-
+
+ if (!response.ok) {
+ return null;
+ }
+
const data = await response.json();
-
+
if (!data.results || data.results.length === 0) {
return null;
}
-
+
const result = data.results[0];
return {
latitude: result.latitude,
@@ -26,11 +30,15 @@ async function geocodeCity(city: string): Promise<{ latitude: number; longitude:
}
export const getWeather = tool({
- description: "Get the current weather at a location. You can provide either coordinates or a city name.",
+ description:
+ "Get the current weather at a location. You can provide either coordinates or a city name.",
inputSchema: z.object({
latitude: z.number().optional(),
longitude: z.number().optional(),
- city: z.string().describe("City name (e.g., 'San Francisco', 'New York', 'London')").optional(),
+ city: z
+ .string()
+ .describe("City name (e.g., 'San Francisco', 'New York', 'London')")
+ .optional(),
}),
execute: async (input) => {
let latitude: number;
@@ -50,7 +58,8 @@ export const getWeather = tool({
longitude = input.longitude;
} else {
return {
- error: "Please provide either a city name or both latitude and longitude coordinates.",
+ error:
+ "Please provide either a city name or both latitude and longitude coordinates.",
};
}
@@ -59,11 +68,11 @@ export const getWeather = tool({
);
const weatherData = await response.json();
-
+
if ("city" in input) {
weatherData.cityName = input.city;
}
-
+
return weatherData;
},
});
diff --git a/lib/db/queries.ts b/lib/db/queries.ts
index 2019514..6c0cf17 100644
--- a/lib/db/queries.ts
+++ b/lib/db/queries.ts
@@ -134,7 +134,7 @@ export async function deleteAllChatsByUserId({ userId }: { userId: string }) {
return { deletedCount: 0 };
}
- const chatIds = userChats.map(c => c.id);
+ const chatIds = userChats.map((c) => c.id);
await db.delete(vote).where(inArray(vote.chatId, chatIds));
await db.delete(message).where(inArray(message.chatId, chatIds));