Created Word Cloud Generator powered with GPT

szriru

szriru

· 1 min read
smple

Created word cloud generator powered with GPT.

https://word-cloud-generator-built-with-gpt.vercel.app/

What we can do with this app is to generate word clouds with just ONE WORD in your mind. With the word in your mind, GPT will take the most relevant words to the word along with how relevant to the word as value.

Image

Features needed to add:

- Change how many words in a word cloud

==> Can add immediately, but too many words will hit Vercel serverless function's runtime duration limitation (60sec in pro). GPT needs around 30 sec to output 30 words.

Implemented. The function to fetch word clouds from gpt is no longer running on server. It runs on client and it solves the runtime duration problem too.

- Adjust how a word cloud lools (rotations, font size, shape, ...etc)

==> a npm package react-wordcloud to generate word clouds in this project will cause errors when changing its parameters. It freezes the browser window.

Implemented. nextjsがプロダクションのためにビルドするときに静的な部分は先にコンパイルしてくれるようだが、パブリックなパッケージから使っている<ReactWordCloud />がそのビルドの際にエラーを引き起こすようだった。そのコンポーネントごとクライアントのみで実行されるようにするとパラメータを変更した際のエラーは起きなくなった。

5-8 open ai api keyをnextjs api routeに送らないようにクライアントから直接openai-apiにリクエストを送るようにしました。私のapi-keyを使う場合はapi routeにしたほうが良いと思いますが。

szriru

About szriru

hi

Copyright © 2024 szriru. All rights reserved.
Made by Web3Templates· Github
Powered by Vercel