prev pVectorSearch2023-06-02 parent pVectorSearch
NextJS
- Getting Started: Installation | Next.js
$ npx create-next-app@latest
- They’ll ask if you want to use TypeScript or something.
- I named it
vecsearch-service
. - A folder with this name is created and Git managed.
- Put into Github
-
push an existing repository from the command line
- made private
-
Vercel
- Log in to your dashboard
- The repository you just saw is displayed, so select it and deploy.
- I was able to deploy.
- Oh, it’s going to be
https://vecsearch-service.vercel.app/
. - You can change it right from the settings.
- https://nishio-vecsearch.vercel.app/ What a convenient time we live in!
Create API
- Routing: API Routes | Next.js
- If there is no
src
, the place to put it is<project_root>/pages/api/foo.ts
. ts
- OK
- I was confused when it didn’t work, but GPT-4 told me to reboot the server, so I rebooted it and it worked, convenient times.
API that taps other APIs
- Try ScrapboxAPI for now.
- OK
Beating OpenAI embed.ts
embed.ts
- OK
Striking the Qdrant search.ts
- OK
Take a search string from a form :
Error: Event handlers cannot be passed to Client Component props.
<button id="search" onClick={function} children=...>
^^^^^^^^^^
If you need interactivity, consider converting part of this to a Client Component.
Formatting the response
- Create URL from Scrapbox title
- Looks aside, the search was done.
- Click on the title to jump to the corresponding page in Scrapbox
- I’m new to TailwindCSS and don’t know what to do with the look and feel.
- Let’s ask ChatGPT w
- I said “Make the result looks better.” and they made it look good. w
- I had the whole thing fixed.
- As for the appearance design of a web app that I’m not particular about, ChatGPT is good enough…
Note for next time
-
Page title image
/api/pages/:projectName/:pageTitle/icon
-
Screen for administrator
- Search queries are stored and made available for the administrator to see.
- Create a page with an explanation to that effect.
- At the time of the search, the results are put into Firebase to produce permalinks, or
- Published in.
- I try to use it myself from my phone.
- I looked at it from my phone and the background wasn’t black.
- When I search, I can’t tell if the search is in progress or died due to an error ✅fixed
- The error on my phone âś…fixed
- Forgot to set environment variables!
- .env.local doesn’t go into the environment variable at the deployment destination (it was .gitignore to begin with and not in the repository!)
- Attach [URL Fragment Text Directives
- This is tricky.
- For example, if there’s Scrapbox notation in the mix, there’s no notation in the browser text, so there’s no hit.
- If we’re going to be serious about this, it needs to be plain text.
- This is tricky.
- Search queries are stored and made available for the administrator to see.
GPT next: pVectorSearch2023-06-06
This page is auto-translated from /nishio/pVectorSearch2023-06-05 using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I’m very happy to spread my thought to non-Japanese readers.