mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 13:23:04 +00:00
feat(assistant): trip assistant chat with your own AI connection
Adds an in-app assistant that reads and plans the open trip. Users connect their own provider (Sign in with ChatGPT, or an Anthropic, OpenAI, Gemini or OpenRouter key) or use the one the admin set up, including a custom OpenAI-compatible server. It is an addon and only shows while a connection is usable. The chat runs on the existing MCP tools, pinned to the trip. Every change is held as a change card the user applies or discards, and applied changes can be undone. On the desktop it is a floating window that can be moved and resized; on the phone it is fullscreen. Search results show as place cards that can go onto a day, weather lookups as a strip, proposed places as ghost markers on the map with a before/after switch, and an answer can be shared into the trip chat. Booking files can be dropped in and are read into change cards.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { useSettingsStore } from '../../store/settingsStore';
|
||||
import { useToast } from '../shared/Toast';
|
||||
|
||||
/**
|
||||
* Whether the trip map follows the assistant: pans to where it searches and
|
||||
* frames the places it suggests. On unless switched off. Behind the switch in
|
||||
* both AI settings shells, the desktop section and the phone card.
|
||||
*/
|
||||
export function useAssistantMapFollow(): { on: boolean; set: (on: boolean) => Promise<void> } {
|
||||
const on = useSettingsStore((s) => s.settings.assistant_map_follow) !== false;
|
||||
const updateSetting = useSettingsStore((s) => s.updateSetting);
|
||||
const { t } = useTranslation();
|
||||
const toast = useToast();
|
||||
|
||||
const set = async (next: boolean) => {
|
||||
try {
|
||||
await updateSetting('assistant_map_follow', next);
|
||||
} catch (e: unknown) {
|
||||
toast.error(e instanceof Error ? e.message : t('common.error'));
|
||||
}
|
||||
};
|
||||
|
||||
return { on, set };
|
||||
}
|
||||
Reference in New Issue
Block a user