Skip to content

Commit

Permalink
feat: add multimodal retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhuyhoang committed Jul 1, 2024
1 parent 073c8dd commit 0a8027d
Show file tree
Hide file tree
Showing 10 changed files with 239 additions and 63 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ db-down-prune:
docker-compose -p chatbot_builder -f ./build/local/docker-compose.yml down --volumes

db-migrate:
bun drizzle-kit push:pg
bun drizzle-kit push

db-seed:
bun src/server/db/migration/seed.ts
Expand Down
Binary file modified bun.lockb
Binary file not shown.
8 changes: 6 additions & 2 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ import { env } from '~/env'

export default {
schema: './src/server/db/migration/schema.ts',
driver: 'pg',
dialect: 'postgresql',
dbCredentials: {
connectionString: env.DATABASE_URL,
url: env.DATABASE_URL,
},
migrations: {
table: 'migrations',
schema: 'public',
},
// tablesFilter: ["chatbot-builder_*"],
out: './src/server/db/migrations',
Expand Down
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"@dwarvesf/react-hooks": "^0.8.2",
"@dwarvesf/react-utils": "^0.4.2",
"@hookform/resolvers": "^3.3.4",
"@langchain/community": "^0.2.3",
"@langchain/community": "^0.2.13",
"@langchain/core": "^0.2.9",
"@langchain/openai": "^0.2.0",
"@mochi-ui/core": "^0.14.3",
"@mochi-ui/icons": "^0.8.1",
"@mochi-ui/theme": "^0.20.1",
Expand All @@ -27,12 +29,14 @@
"@trpc/next": "next",
"@trpc/react-query": "next",
"@trpc/server": "next",
"@types/pg": "^8.11.6",
"@types/react-color": "^3.0.12",
"@vercel/blob": "^0.23.2",
"async": "^3.2.5",
"buffer": "^6.0.3",
"clsx": "^2.1.1",
"dayjs": "^1.11.11",
"drizzle-orm": "^0.29.4",
"drizzle-orm": "^0.31.0",
"fast-xml-parser": "^4.3.6",
"jsdom": "^24.0.0",
"langchain": "^0.2.2",
Expand All @@ -41,12 +45,14 @@
"next": "^14.1.3",
"next-auth": "^4.24.6",
"openai": "^4.42.0",
"pg": "^8.12.0",
"postgres": "^3.4.4",
"react": "18.2.0",
"react-color": "^2.19.3",
"react-dom": "18.2.0",
"react-dropzone": "^14.2.3",
"react-hook-form": "^7.51.3",
"sharp": "^0.33.4",
"superjson": "^2.2.1",
"tailwindcss-animate": "^1.0.7",
"use-debounce": "^10.0.1",
Expand All @@ -67,7 +73,7 @@
"@typescript-eslint/parser": "^7.1.1",
"cheerio": "^1.0.0-rc.12",
"domhandler": "^5.0.3",
"drizzle-kit": "^0.20.14",
"drizzle-kit": "^0.22.7",
"eslint": "^8.57.0",
"eslint-config-next": "^14.1.3",
"eslint-plugin-drizzle": "^0.2.3",
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/sync-bot-source/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function POST(req: Request) {
return new Response(`Sync bot source from ${process.env.VERCEL_REGION} xxx`)
}

async function syncBotSource(bsId: string) {
export async function syncBotSource(bsId: string) {
const bs = await db.query.botSources.findFirst({
where: eq(schema.botSources.id, bsId),
})
Expand Down
10 changes: 10 additions & 0 deletions src/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ export const env = createEnv({
*/
server: {
DATABASE_URL: z.string().url(),
DATABASE_HOST: z.string(),
DATABASE_PORT: z.number(),
DATABASE_NAME: z.string(),
DATABASE_USER: z.string(),
DATABASE_PASSWORD: z.string(),
NODE_ENV: z
.enum(['development', 'test', 'production'])
.default('development'),
Expand Down Expand Up @@ -53,6 +58,11 @@ export const env = createEnv({
*/
runtimeEnv: {
DATABASE_URL: process.env.DATABASE_URL,
DATABASE_HOST: process.env.DATABASE_HOST,
DATABASE_PORT: process.env.DATABASE_PORT,
DATABASE_NAME: process.env.DATABASE_NAME,
DATABASE_USER: process.env.DATABASE_USER,
DATABASE_PASSWORD: process.env.DATABASE_PASSWORD,
NODE_ENV: process.env.NODE_ENV,
NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET,
NEXTAUTH_URL: process.env.NEXTAUTH_URL,
Expand Down
3 changes: 2 additions & 1 deletion src/pages/bots/[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ const BotDetail: NextPage = () => {
if (chatData) {
addNewMessage(
chatData.referSourceLinks ?? null,
chatData.assistants?.[0]?.[0]?.msg ?? '',
// chatData.assistants?.[0]?.[0]?.msg ?? '',
chatData.res ?? '',
false,
)
}
Expand Down
Loading

0 comments on commit 0a8027d

Please sign in to comment.