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

[BUG] Can't use Vercel's ai SDK with Plasmo #711

Closed
2 of 3 tasks
atgctg opened this issue Aug 3, 2023 · 0 comments · Fixed by #723
Closed
2 of 3 tasks

[BUG] Can't use Vercel's ai SDK with Plasmo #711

atgctg opened this issue Aug 3, 2023 · 0 comments · Fixed by #723
Labels
bug Something isn't working

Comments

@atgctg
Copy link
Contributor

atgctg commented Aug 3, 2023

What happened?

Getting the following error when trying to import ai/react:

🔴 ERROR  | Failed to resolve 'ai/react' from './popup.tsx'
🔴 ERROR  | Cannot load file './react' from module 'ai'

popup.tsx:

import { useChat } from "ai/react"

export default function Chat() {
  const { messages, input, handleInputChange, handleSubmit } = useChat()

  return (
    <div className="mx-auto w-full max-w-md py-24 flex flex-col stretch">
      {messages.map((m) => (
        <div key={m.id}>
          {m.role === "user" ? "User: " : "AI: "}
          {m.content}
        </div>
      ))}

      <form onSubmit={handleSubmit}>
        <label>
          Say something...
          <input
            className="fixed w-full max-w-md bottom-0 border border-gray-300 rounded mb-8 shadow-xl p-2"
            value={input}
            onChange={handleInputChange}
          />
        </label>
        <button type="submit">Send</button>
      </form>
    </div>
  )
}

Relevant Discord thread: https://discord.com/channels/946290204443025438/1125919899609485352

Version

Latest

What OS are you seeing the problem on?

No response

What browsers are you seeing the problem on?

No response

Relevant log output

No response

(OPTIONAL) Contribution

  • I would like to fix this BUG via a PR

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I checked the current issues for duplicate problems.
@atgctg atgctg added the bug Something isn't working label Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant