Misc fixes (#1298)

This commit is contained in:
Hayden Bleasel 2025-10-31 21:49:43 -07:00 committed by GitHub
parent e4142a976e
commit 31e6f41de9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 12 deletions

View file

@ -130,7 +130,7 @@ function PureMultimodalInput({
const [uploadQueue, setUploadQueue] = useState<string[]>([]);
const submitForm = useCallback(() => {
window.history.replaceState({}, "", `/chat/${chatId}`);
window.history.pushState({}, "", `/chat/${chatId}`);
sendMessage({
role: "user",

View file

@ -27,20 +27,16 @@ 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.",
inputSchema: z.union([
z.object({
latitude: z.number(),
longitude: z.number(),
}),
z.object({
city: z.string().describe("City name (e.g., 'San Francisco', 'New York', 'London')"),
}),
]),
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(),
}),
execute: async (input) => {
let latitude: number;
let longitude: number;
if ("city" in input) {
if (input.city) {
const coords = await geocodeCity(input.city);
if (!coords) {
return {
@ -49,9 +45,13 @@ export const getWeather = tool({
}
latitude = coords.latitude;
longitude = coords.longitude;
} else {
} else if (input.latitude !== undefined && input.longitude !== undefined) {
latitude = input.latitude;
longitude = input.longitude;
} else {
return {
error: "Please provide either a city name or both latitude and longitude coordinates.",
};
}
const response = await fetch(