Skip to content

Commit 9a30bfd

Browse files
committed
feat: langchain bot database update
1 parent e45a2c0 commit 9a30bfd

File tree

4 files changed

+1854
-1159
lines changed

4 files changed

+1854
-1159
lines changed

about.md

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Henry's Blog (NoowaH)
2+
3+
This platform is a personal project where I share my development notes, studies, and showcase my portfolio.
4+
It's built with modern web technologies, focusing on performance, aesthetics, and interactivity.
5+
6+
## Website Contents
7+
8+
- **`/posts`**: This section contains my development notes and in-depth studies on various topics within software development. It's a space where I document my learning journey and share insights on complex concepts.
9+
10+
- **`/about`**: Learn more about me, my background in software development, and what drives my passion for technology.
11+
12+
- **`/works`**: A showcase of my portfolio, highlighting projects and works that I've contributed to or developed. This section demonstrates my skills and areas of expertise.
13+
14+
## Stack
15+
16+
The blog leverages a modern technology stack to deliver a seamless user experience:
17+
18+
- **Next.js 14 (App Router)**: Utilizes the latest features of Next.js for efficient, scalable routing, enhancing the performance and SEO of the blog.
19+
20+
- **TailwindCSS & PostCSS**: For styling, the blog uses TailwindCSS along with PostCSS for a utility-first CSS workflow, enabling responsive and customizable design with ease.
21+
22+
- **Markdown**: Content for the blog posts is written in Markdown, allowing for easy formatting and maintenance of the blog's written content.
23+
24+
- **Framer Motion**: This library is used to add smooth, powerful animations throughout the website, enriching the user interaction and visual appeal.
25+
26+
- **SWR**: For data fetching, SWR is implemented to handle caching, revalidation, and fetching data, ensuring up-to-date content is served with minimal loading times.
27+
28+
## About Hawoon Joh
29+
30+
Hi there, I'm Hawoon JOH | Henry 👋
31+
32+
I'm a passionate web developer specializing in frontend technologies with a focus on creating dynamic, high-performance user interfaces.
33+
34+
Currently, I am a **Frontend Developer (Team Lead)** at CloudHospital, where I lead a small team of talented developers in building and maintaining complex web applications.
35+
36+
## 🛠️ Skills
37+
38+
I have a diverse set of skills in web development, particularly in the following technologies:
39+
40+
- **React:** I utilize React to build responsive and efficient single-page applications (SPAs) that provide an excellent user experience.
41+
![React](https://img.shields.io/badge/-React-61DAFB?logo=react&logoColor=white&style=for-the-badge)
42+
- **Next.js:** With Next.js, I develop server-rendered React applications and static websites for better performance and SEO.
43+
![Next.js](https://img.shields.io/badge/-Next.js-000000?logo=nextdotjs&logoColor=white&style=for-the-badge)
44+
- **JavaScript:** Proficient in JavaScript, I write clean and efficient code to create interactive web elements and functionalities.
45+
![JavaScript](https://img.shields.io/badge/JavaScript-323330?style=for-the-badge&logo=javascript&logoColor=F7DF1E)
46+
- **TypeScript:** I use TypeScript to enhance JavaScript with static typing, which improves code quality and maintainability.
47+
![TypeScript](https://img.shields.io/badge/-TypeScript-3178C6?logo=typescript&logoColor=white&style=for-the-badge)
48+
- **Node.js:** With Node.js, I build scalable backend services and APIs that power my web applications.
49+
![Node.js](https://img.shields.io/badge/-Node.js-339933?logo=nodedotjs&logoColor=white&style=for-the-badge)
50+
- **TailwindCSS:** I mainly use TailwindCSS to create custom, utility-first CSS designs quickly and efficiently.
51+
![TailwindCSS](https://img.shields.io/badge/-TailwindCSS-38B2AC?logo=tailwindcss&logoColor=white&style=for-the-badge)
52+
- **SWR:** I implement SWR for data fetching to provide a better user experience with features like caching and revalidation.
53+
![SWR](https://img.shields.io/badge/-SWR-000000?logo=vercel&logoColor=white&style=for-the-badge)
54+
- **Java:** Skilled in Java, I can build robust backend systems and services.
55+
![Java](https://img.shields.io/badge/Java-ED8B00?style=for-the-badge&logo=openjdk&logoColor=white)
56+
- **Spring Boot:** With Spring Boot, I develop production-ready standalone applications with minimal configuration.
57+
![Spring Boot](https://img.shields.io/badge/-Spring_Boot-6DB33F?logo=springboot&logoColor=white&style=for-the-badge)
58+
59+
## 🌐 Connect with Me
60+
61+
Feel free to connect with me on LinkedIn or check out my personal website to learn more about my projects and experiences:
62+
63+
- [![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?logo=linkedin&logoColor=white&style=for-the-badge)](https://www.linkedin.com/in/hawoon-joh-2b8176240/)
64+
- [![Website](https://img.shields.io/badge/Website-4285F4?logo=google-chrome&logoColor=white&style=for-the-badge)](https://noowah.vercel.app)

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@
1111
"dependencies": {
1212
"@formatjs/intl-localematcher": "^0.5.4",
1313
"@heroicons/react": "^2.1.1",
14+
"@langchain/community": "^0.2.15",
15+
"@langchain/openai": "^0.2.1",
1416
"@splinetool/react-spline": "^2.2.6",
1517
"@splinetool/runtime": "^1.2.8",
16-
"@supabase/supabase-js": "^2.43.1",
18+
"@supabase/supabase-js": "^2.44.1",
1719
"@uiw/react-md-editor": "^3.20.5",
1820
"eslint": "8.35.0",
1921
"eslint-config-next": "13.2.3",
2022
"framer-motion": "^11.0.3",
23+
"langchain": "^0.2.8",
2124
"lodash": "^4.17.21",
2225
"negotiator": "^0.6.3",
2326
"next": "^14.2.3",

src/app/api/langchain/route.ts

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { MarkdownTextSplitter } from 'langchain/text_splitter'
2+
import { promises as fs } from 'fs'
3+
import { createClient } from '@supabase/supabase-js'
4+
5+
import { SupabaseVectorStore } from '@langchain/community/vectorstores/supabase'
6+
import { OpenAIEmbeddings } from '@langchain/openai'
7+
8+
const sbApiKey = process.env.SUPABASE_API_KEY
9+
const sbUrl = process.env.SUPABASE_URL
10+
const openAIApiKey = process.env.OPENAI_API_KEY
11+
12+
export const GET = async (req: Request) => {
13+
try {
14+
const file = await fs.readFile(process.cwd() + '/about.md', 'utf-8')
15+
16+
const splitter = new MarkdownTextSplitter({ chunkSize: 500 })
17+
18+
const output = await splitter.createDocuments([file])
19+
20+
if (sbUrl && sbApiKey) {
21+
const client = createClient(sbUrl, sbApiKey)
22+
23+
const response = await SupabaseVectorStore.fromDocuments(output, new OpenAIEmbeddings({ openAIApiKey }), {
24+
client,
25+
tableName: 'documents'
26+
})
27+
28+
console.log(response)
29+
}
30+
31+
return Response.json(output)
32+
} catch (e) {
33+
console.error(e)
34+
}
35+
36+
return Response.json({ error: 'Something went wrong' })
37+
}

0 commit comments

Comments
 (0)