Commit Graph

1755 Commits

Author SHA1 Message Date
de8625c17f chore: ignore memory dirs and worktrees at repo root 2026-03-10 18:41:17 +00:00
78d2b3774e chore: remove accidental memory files from repo root
These were stashed basic-memory files that got staged. Memory files
belong in .memory/ (managed by basic-memory MCP), not the repo root.
2026-03-10 18:40:45 +00:00
c4b8f291f2 docs: update docs and AGENTS.md with chat tool loop fix patterns 2026-03-10 18:40:34 +00:00
0ca73a417d fix(chat): resolve clarification loop and duplicate place cards 2026-03-10 18:39:30 +00:00
89b42126ec fix(chat): fix location clarification loop and test isolation bugs
- Add _COMMAND_VERBS guard to _is_likely_location_reply() so messages
  starting with imperative verbs (find, search, show, get, ...) are not
  mistakenly treated as user location replies. This prevented 'Find
  good places' from being used as a retry location, which was causing
  the clarification path to never fire and the tool loop to exhaust
  MAX_ALL_FAILURE_ROUNDS instead.
- Extract city from comma-delimited fallback address strings when
  city/country FKs are absent, e.g. 'Little Turnstile 6, London'
  → 'London', so context-based location retry works for manually-
  entered itinerary stops without geocoded FK data.
- Add attempted_location_retry flag: if retry was attempted but all
  retry attempts failed, convert result to an execution failure rather
  than emitting a clarification prompt (user already provided context
  via their itinerary).
- Fix test assertion ordering in test_collection_context_retry_extracts_
  city_from_fallback_address: streaming_content must be consumed before
  checking mock call counts since StreamingHttpResponse is lazy.
2026-03-10 18:37:30 +00:00
dbabbdf9f0 fix(chat): stop retry spirals on tool failures 2026-03-10 18:05:34 +00:00
212ce33e36 fix(chat): normalize itinerary search locations 2026-03-10 17:29:37 +00:00
46d7704e4f fix(chat): use itinerary context for restaurant searches 2026-03-10 17:12:29 +00:00
a023a9548c fix(chat): retry search_places using user location reply 2026-03-10 16:48:39 +00:00
403f47b57c test(chat): use transaction case for async stream assertion 2026-03-10 16:34:56 +00:00
84384df236 fix(chat): clarify missing-location search requests 2026-03-10 16:26:02 +00:00
1ad9d20037 fix(chat): stabilize assistant add flow and location routing 2026-03-10 15:59:07 +00:00
49abfad192 chore: update dependencies
Backend:
- gunicorn 23.0.0 → 25.1.0
- setuptools 79.0.1 → 82.0.1
- litellm >=1.72.3 → >=1.82.1

Frontend:
- Migrate Tailwind CSS 3 → 4, daisyUI 4 → 5
  - Add @tailwindcss/vite plugin, remove autoprefixer
  - Replace tailwind.config.js with src/app.css (CSS-based config)
  - Convert custom themes (aestheticDark, catppuccinMocha, aestheticLight,
    northernLights) to daisyUI 5 CSS variable format
  - Remove daisyUI v4-only '-bordered' classes from 45 component files
    (input-bordered, select-bordered, textarea-bordered, file-input-bordered
    are removed in v5; borders are default)
- @types/node 22 → 25
- @lukulent/svelte-umami 0.0.3 → 0.0.4
- packageManager: bun@1.2.22 → bun@1.3.10

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-10 13:34:49 +00:00
61ea33dc24 fix(frontend): use oven/bun base image to fix arm64 build failure
Replaced `node:22-alpine` + `npm install -g bun@1.2.22` with
`oven/bun:1.2.22-alpine` as the builder stage base image.

The npm-based bun install was failing on linux/arm64 with:
  "Failed to find package @oven/bun-linux-aarch64"

The official oven/bun Docker image supports both linux/amd64 and
linux/arm64 natively, eliminating the need to install bun via npm.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-10 13:12:31 +00:00
09c35b3e2c docs(chat): record shared access and control behavior 2026-03-09 22:05:25 +00:00
c918c9ce2f fix(chat): support shared trips and polish controls 2026-03-09 22:04:53 +00:00
d8c8ecf2bd fix(chat): clean up tool output and embedded UX 2026-03-09 21:12:46 +00:00
bb54503235 fix(chat): add saved AI defaults and harden suggestions 2026-03-09 20:32:13 +00:00
21954df3ee fix(chat): improve OpenCode Zen integration and error handling
- Fetch models dynamically from OpenCode Zen API (36 models vs 5 hardcoded)
- Add function calling support check before using tools
- Add retry logic (num_retries=2) for transient failures
- Improve logging for debugging API calls and errors
- Update system prompt for multi-stop itinerary context
- Clean up unused imports in frontend components
- Remove deleted views.py (moved to views/__init__.py)
2026-03-09 16:11:14 +00:00
21ef73f49d docs: add pre-release policy to agent instructions 2026-03-09 15:15:47 +00:00
30fdcb078f fix: resolve three travel agent UI issues
- Connection error: wrap sync get_llm_api_key() in sync_to_async in
  stream_chat_completion() to fix SynchronousOnlyOperation raised when
  the async SSE generator calls a synchronous Django ORM function
- Models not loading: add opencode_zen handler to models endpoint
  returning its default model; fix frontend to show 'Default' instead
  of 'Loading...' indefinitely when no model list is returned
- Location in header: remove destination subtitle from Travel Assistant
  header — collection-wide chat has no single meaningful location
2026-03-09 13:34:35 +00:00
91d907204a fix(ai): critical fixes for agent-redesign - provider selection and auto-learn
Fix 1: Provider/Model Selection (Critical - unblocks LLM)
- Add /api/chat/providers/{id}/models/ endpoint to fetch available models
- Auto-select first configured provider instead of hardcoded 'openai'
- Add model dropdown populated from provider API
- Filter provider list to only show configured providers
- Show helpful error when no providers configured

Fix 2: Auto-Learn Preferences (Replaces manual input)
- Create auto_profile.py utility to infer preferences from user data
- Learn interests from Activity sport types and Location categories
- Learn trip style from Lodging types (hostel=budget, resort=luxury, etc.)
- Learn geographic preferences from VisitedRegion/VisitedCity
- Call auto-learn on every chat start (send_message)
- System prompt now indicates preferences are auto-inferred

Fix 3: Remove Manual Preference UI
- Remove travel_preferences section from Settings
- Remove preference form fields and save logic
- Remove preference fetch from server-side load
- Keep UserRecommendationPreferenceProfile type for backend use

The LLM should now work correctly:
- Users with any configured provider will have it auto-selected
- Model list is fetched dynamically from provider API
- Preferences are learned from actual travel history
2026-03-09 00:20:11 +00:00
9d5681b1ef feat(ai): implement agent-redesign plan with enhanced AI travel features
Phase 1 - Configuration Infrastructure (WS1):
- Add instance-level AI env vars (VOYAGE_AI_PROVIDER, VOYAGE_AI_MODEL, VOYAGE_AI_API_KEY)
- Implement fallback chain: user key → instance key → error
- Add UserAISettings model for per-user provider/model preferences
- Enhance provider catalog with instance_configured and user_configured flags
- Optimize provider catalog to avoid N+1 queries

Phase 1 - User Preference Learning (WS2):
- Add Travel Preferences tab to Settings page
- Improve preference formatting in system prompt with emoji headers
- Add multi-user preference aggregation for shared collections

Phase 2 - Day-Level Suggestions Modal (WS3):
- Create ItinerarySuggestionModal with 3-step flow (category → filters → results)
- Add AI suggestions button to itinerary Add dropdown
- Support restaurant, activity, event, and lodging categories
- Backend endpoint POST /api/chat/suggestions/day/ with context-aware prompts

Phase 3 - Collection-Level Chat Improvements (WS4):
- Inject collection context (destination, dates) into chat system prompt
- Add quick action buttons for common queries
- Add 'Add to itinerary' button on search_places results
- Update chat UI with travel-themed branding and improved tool result cards

Phase 3 - Web Search Capability (WS5):
- Add web_search agent tool using DuckDuckGo
- Support location_context parameter for biased results
- Handle rate limiting gracefully

Phase 4 - Extensibility Architecture (WS6):
- Implement decorator-based @agent_tool registry
- Convert existing tools to use decorators
- Add GET /api/chat/capabilities/ endpoint for tool discovery
- Refactor execute_tool() to use registry pattern
2026-03-08 23:53:14 +00:00
246b081d97 docs: add .memory consultation + instruction file sync rules
Add two new sections to AGENTS.md and CLAUDE.md:
- .memory Files: consult knowledge.md, decisions.md, plans/, research/ at task start
- Instruction File Sync: keep AGENTS.md, CLAUDE.md, .cursorrules, and Copilot CLI instructions in sync when any is updated

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-08 23:19:37 +00:00
08c85afa5e docs: add branch hygiene commit-and-merge guidance 2026-03-08 21:43:07 +00:00
62578e7aa5 merge: collections AI chat integration
# Conflicts:
#	backend/server/chat/llm_client.py
#	frontend/src/routes/chat/+page.svelte
#	frontend/src/routes/settings/+page.svelte
2026-03-08 21:32:22 +00:00
4d489efa2a merge: provider catalog and zen support 2026-03-08 21:30:29 +00:00
d35feed98c feat(chat): add dynamic provider catalog and zen support 2026-03-08 21:29:48 +00:00
64f9fe7382 feat: embed AI travel chat in collection recommendations 2026-03-08 21:24:49 +00:00
3526c963a4 chore: add missing project scaffolding 2026-03-08 20:01:46 +00:00
006a28ea0f move documentation/ to docs/ 2026-03-08 20:00:08 +00:00
604b52bcc7 fix(itinerary): make optimize nearest-neighbor context-aware of anchor positions
The optimize function always started nearest-neighbor from the first
array element, ignoring where the traveler actually is after preceding
anchors (flights, lodging). Now passes the preceding anchor's exit
coordinates (destination for transportation) so the algorithm picks
the spatially nearest item as the starting point.
2026-03-08 19:41:19 +00:00
73289725eb Merge branch 'feat/llm-travel-agent' into main 2026-03-08 18:54:50 +00:00
64345d44d6 Merge branch 'fix/itinerary-reactivity-optimize' into main 2026-03-08 18:54:46 +00:00
fd3ca360de fix(chat): sanitize error responses and add tool kwargs allowlist
Prevent API key and sensitive info leakage through exception messages:
- Replace str(exc) with generic error messages in all catch-all handlers
- Add server-side exception logging via logger.exception()
- Add ALLOWED_KWARGS per-tool allowlist to filter untrusted LLM kwargs
- Bound tool execution loop to MAX_TOOL_ITERATIONS=10
- Fix tool_call delta merge to use tool_call index
2026-03-08 18:54:35 +00:00
757140ec70 feat(chat): add LLM-powered travel agent with multi-provider support
Implement a full chat-based travel agent using LiteLLM for multi-provider
LLM support (OpenAI, Anthropic, Gemini, Ollama, Groq, Mistral, etc.).

Backend:
- New 'chat' Django app with ChatConversation and ChatMessage models
- Streaming SSE endpoint via StreamingHttpResponse
- 5 agent tools: search_places, list_trips, get_trip_details,
  add_to_itinerary, get_weather
- LiteLLM client wrapper with per-user API key retrieval
- System prompt with user preference context injection

Frontend:
- New /chat route with full-page chat UI (DaisyUI + Tailwind)
- Collapsible conversation sidebar with CRUD
- SSE streaming response display with tool call visualization
- Provider selector dropdown
- SSE proxy fix to stream text/event-stream without buffering
- Navbar link and i18n keys
2026-03-08 18:44:44 +00:00
6203d7ed87 fix(itinerary): fix Svelte 4 reactivity for temperature display and connector metrics
Temperature display always showed 'unavailable' because formatDayTemperature()
read dayTemperatures from closure, which Svelte 4's compiler doesn't track in
template expressions. Same issue affected getLocationConnector() reading
connectorMetricsMap from closure.

Fix: pass both state variables as explicit function parameters so they appear
in template expressions and trigger re-renders on async updates.

Also improve optimize button diagnostics with console logging and better
toast feedback when items lack coordinates.
2026-03-08 18:18:53 +00:00
d4e0ef14b8 fix(itinerary): fix route optimization reactivity and replace api key provider dropdown with AI LLM providers
- fix optimizeDayOrder() dual-update: directly set days[dayIndex].items + days before
  saveReorderedItems() so it reads the correct post-optimization order synchronously
  (Svelte 4 batches reactive statements; days wasn't updated before save read it)
- also patch collection.itinerary order values so reactive rebuild uses new order
- replace single google_maps <option> with 8 AI LLM provider options
  (anthropic, openai, gemini, ollama, groq, mistral, github_models, openrouter)
- add getApiKeyProviderLabel() helper for saved key display with google_maps fallback
- add i18n keys for all new provider labels in en.json and de.json
2026-03-08 17:45:44 +00:00
c5be09bcb9 fix(frontend): clean docs links and improve settings clarity 2026-03-08 17:21:51 +00:00
2fd11dbd26 fix: stabilize post-MVP travel-agent and itinerary workflows 2026-03-08 16:51:19 +00:00
fb2347345f fix(docker): stabilize compose startup across prod and dev stacks 2026-03-08 14:54:55 +00:00
e56170fbd4 merge: integrate mvp trip features and bun migration 2026-03-08 14:46:20 +00:00
c5939e2957 feat(frontend): apply itinerary UI and docs refinements 2026-03-08 14:42:32 +00:00
2ad814334f chore(frontend): migrate toolchain from pnpm to bun 2026-03-08 14:41:36 +00:00
8c0637c518 feat: ship MVP itinerary optimization, weather, AI key prefs, and MCP tools 2026-03-08 13:49:32 +00:00
9eb0325c7a fix(frontend): simplify collections view and restore invite access
Unify collections and shared items under a single Collections tab while keeping Archive separate, and fix card layering so menus render correctly. Restore invite discoverability by adding navbar access to /invites and add missing i18n keys to prevent raw key labels in collections/invites UI.
2026-03-08 01:29:52 +00:00
f11a5051c6 fix(ci): lowercase GHCR owner tags and harden frontend runtime image 2026-03-07 21:18:21 +00:00
7cf1b783ae fix(ci): publish container images to GHCR only 2026-03-07 21:02:38 +00:00
4df5036534 fix(ci): use GITHUB_TOKEN for GHCR and stabilize Trivy scan 2026-03-07 20:56:52 +00:00
da84d171e5 fix(frontend): remediate Trivy vulnerabilities in build image 2026-03-07 20:40:51 +00:00