Repository navigation
feat(ai): server-backed conversation history (objectui parity) - #98
Merged
Merged
Conversation
Brings the mobile assistant to web (objectui) parity: when the server exposes /api/v1/ai/conversations, chats are saved server-side — multi- conversation, cross-device, listable — instead of only an on-device cache. - lib/ai-conversations.ts: typed client for the conversation API (list/create/get/delete + addMessage) + a cached `conversationsAvailable()` probe so unsupported servers (published service-ai 8.0.1) degrade cleanly. - lib/ai-chat.ts: thread `conversationId` through stream/sendAiChat bodies. - stores/ai-chat-store: two-tier persistence. Server mode — create a conversation on first send, carry conversationId into /ai/chat, explicitly persist user+assistant via /:id/messages, list/load/delete, resume the cached active id on open. Local mode (no API) — the existing MMKV restart-survival cache. `init()` probes once and picks the mode. - app/ai.tsx: a Conversations drawer (new chat / switch / delete) + history actions in server mode; calls init() on mount. Verified end-to-end against the framework dev server (which ships the conversation API): create → chat(conversationId) → messages persist → load returns the thread → list shows it. The published 8.0.1 server lacks the API, so the demo falls back to the local cache (graceful). 48 AI tests (conversation client, store server+local modes, drawer UI). Suite 1249/1249, lint clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Brings the mobile AI assistant to web (objectui) parity: when the server exposes
/api/v1/ai/conversations, chats are saved server-side — multi-conversation, cross-device, listable — instead of only an on-device cache.lib/ai-conversations.ts— typed client for the conversation API (list/create/get/delete+addMessage) and a cachedconversationsAvailable()probe so servers without it (publishedservice-ai8.0.1) degrade cleanly.lib/ai-chat.ts— threadconversationIdthroughstream/sendAiChatrequest bodies.stores/ai-chat-store— two-tier persistence:conversationIdinto/ai/chat, explicitly persist user+assistant via/:id/messages, list/load/delete, resume the cached active id on open.init()probes once and picks the mode.app/ai.tsx— a Conversations drawer (new chat / switch / delete) + history actions in server mode; callsinit()on mount.Verification
chat(conversationId)(streamed a real LLM reply) → messages persist →GET /:idreturns the thread →GET /conversationslists it. Confirmed the exact store sequence works server-side.npm run lint0 errors;jest1249/1249 (152 suites).Notes
@objectstack/service-ai8.0.1 has none) — so server-backed mode activates automatically once a server with/conversationsis connected; until then mobile uses the local cache./:id/messagesendpoint (reliable across server builds) rather than relying on chat-endpoint auto-persist.🤖 Generated with Claude Code