Skip to content
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

Add Vercel AI SDK, create API route, implement in ChatUI #340

Merged
merged 15 commits into from
May 13, 2024

Conversation

AVGVSTVS96
Copy link
Owner

@AVGVSTVS96 AVGVSTVS96 commented May 9, 2024

  • Add Vercel AI SDK dependencies

  • Update ChatUI.tsx, add add useChat hook

  • Create basic chatRoute.ts file in /pages/api/

  • Use createOpenAI to create provider with api key, small updated to optimize ChatUI.tsx

  • Send modelName to server to dynamically select model

    • Move model selection logic to Chat() component, pass selectedModel and onModelChange to GptSelect as props.

    • Use post request to send model name to server with a useEffect hook in Chat().

    • Update chatRoute.ts to accept model name, add Message type interface

Copy link

linear bot commented May 9, 2024

Copy link

codesandbox bot commented May 9, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@AVGVSTVS96 AVGVSTVS96 changed the title Add Vercel AI SDK dependencies Add Vercel AI SDK, create API route, implement in ChatUI May 9, 2024
Copy link

cloudflare-workers-and-pages bot commented May 10, 2024

Deploying astrosite with  Cloudflare Pages  Cloudflare Pages

Latest commit: 38ca154
Status:🚫  Deploy failed.

View logs

Copy link
Owner Author

AVGVSTVS96 commented May 13, 2024

Merge activity

  • May 13, 12:14 AM EDT: @AVGVSTVS96 started a stack merge that includes this pull request via Graphite.
  • May 13, 12:21 AM EDT: Graphite rebased this pull request as part of a merge.
  • May 13, 12:23 AM EDT: @AVGVSTVS96 merged this pull request with Graphite.

@AVGVSTVS96 AVGVSTVS96 changed the base branch from useHybridSSR to master May 13, 2024 04:19
AVGVSTVS96 added 10 commits May 13, 2024 04:21
Use `createOpenAI` to create provider with api key, small updated to optimize `ChatUI.tsx`
- Move model selection logic to `Chat()` component, pass `selectedModel` and `onModelChange` to `GptSelect` as props.

- Use post request to send model name to server with a `useEffect` hook in `Chat()`.

- Update `chatRoute.ts` to accept model name, add `Message` type interface
AVGVSTVS96 and others added 5 commits May 13, 2024 04:21
Import and use `CoreMessage` type for messages

Correctly import type for `APIContenxt`

Remove unused prompt properties
Import and use `UseChatOptions` and `UseChatHelpers` types in `ChatUI.tsx`.

Move api path setting to separate `chatOptions` where the type is assigned

Create type interface for `ModelSelector`
…messages div

Improves readability and reliability of the code

Preserves whitespace in chat messages while allowing text to wrap
@AVGVSTVS96 AVGVSTVS96 merged commit c09aa38 into master May 13, 2024
1 check failed
@AVGVSTVS96 AVGVSTVS96 deleted the useAiSdk-BAS-73 branch June 3, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant