Skip to content

refactor: new API & universal load functions #1743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 49 commits into
base: main
Choose a base branch
from

Conversation

nsarrazin
Copy link
Collaborator

@nsarrazin nsarrazin commented Mar 4, 2025

This WIP PR addresses #1699 by expanding the API and moving all the server-side load functions to universal load functions that call the API endpoints instead.

This is important for shipping apps that must be bundled in SPA mode.

  • src/routes/+layout.server.ts
  • src/routes/assistant/[assistantId]/+page.server.ts
  • src/routes/assistants/+page.server.ts
  • src/routes/conversation/[id]/+page.server.ts
  • src/routes/login/callback/+page.server.ts (feat(api): migrate login and logout to API routes #1703)
  • src/routes/models/[...model]/+page.server.ts
  • src/routes/settings/+layout.server.ts
  • src/routes/tools/+page.server.ts
  • src/routes/tools/[toolId]/+layout.server.ts

@nsarrazin nsarrazin added enhancement New feature or request front This issue is related to the front-end of the app. back This issue is related to the Svelte backend or the DB dependencies Pull requests that update a dependency file labels Mar 4, 2025
@nsarrazin nsarrazin added this to the chat-ui in tauri milestone Mar 4, 2025
nsarrazin added 15 commits March 4, 2025 09:36
* feat(auth): migrate login and logout to API routes

- Replaced form-based login/logout with fetch-based API routes
- Updated hooks and components to use new `/api/login` and `/api/logout` endpoints

* fix: invalidate on logout

* refactor: move `/api/login` routes back to `/login` and `/api/logout` to `/logout`

remove breaing change to connected apps
- Changed `addChildren` and `addSibling` functions to utilize a generic `Tree` type for better flexibility.
- Updated `buildSubtree` to return a tree node structure.
- Modified conversation response types to use `Serialize<Conversation>` for improved serialization.
- Adjusted related tests to align with the new tree structure and types.
- Updated the `messages` prop in the ChatWindow component to explicitly cast `messagesPath` as `Message[]` for improved type safety and clarity.
@nsarrazin nsarrazin marked this pull request as ready for review March 13, 2025 12:02
@nsarrazin
Copy link
Collaborator Author

idk if I want to merge this. main issue is the API framework, elysia works ok but docs are poor and there's issues with the type safe client eden and it hasn't been updated in a few months.

So in the end there's very little benefits over just adding API routes. I might just lift the logic into standard +server.ts routes.

@nsarrazin nsarrazin marked this pull request as draft April 11, 2025 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back This issue is related to the Svelte backend or the DB dependencies Pull requests that update a dependency file enhancement New feature or request front This issue is related to the front-end of the app.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant