Skip to content

Commit adde6aa

Browse files
authored
Merge pull request #285 from n4ze3m/next
v1.9.3
2 parents 6859057 + 3693261 commit adde6aa

File tree

34 files changed

+1047
-328
lines changed

34 files changed

+1047
-328
lines changed

Dockerfile

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,42 @@
1-
FROM node:18-slim AS base
1+
# Build stage
2+
FROM node:18-slim AS build
23
WORKDIR /app
3-
RUN apt update && apt install -y \
4-
g++ make python3 wget gnupg dirmngr unzip
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
g++ make python3 wget gnupg dirmngr unzip \
6+
&& rm -rf /var/lib/apt/lists/*
7+
8+
RUN npm --no-update-notifier --no-fund --global install pnpm
9+
10+
COPY . .
11+
RUN pnpm install && pnpm build
512

613
# Server stage
7-
FROM base AS server
14+
FROM node:18-slim AS server
15+
WORKDIR /app
816
COPY ./server/ .
917
RUN yarn config set registry https://registry.npmjs.org/ && \
1018
yarn config set network-timeout 1200000 && \
1119
yarn install --frozen-lockfile && \
1220
yarn build
1321

14-
# Build stage
15-
FROM base AS build
16-
RUN npm --no-update-notifier --no-fund --global install pnpm
17-
COPY . .
18-
RUN pnpm install && pnpm build
19-
2022
# Final stage
2123
FROM node:18-slim
2224
WORKDIR /app
2325

24-
# Set environment variables
2526
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
2627
ENV NODE_ENV=production
27-
# Install dependencies
28-
RUN apt update && apt install -y wget gnupg dirmngr unzip
29-
# Install dependencies and google chrome based on architecture
30-
RUN apt update && apt install -y wget gnupg dirmngr curl && \
31-
ARCH=$(dpkg --print-architecture) && \
28+
29+
RUN apt-get update && apt-get install -y --no-install-recommends \
30+
wget gnupg dirmngr curl ca-certificates git git-lfs openssh-client \
31+
jq cmake sqlite3 openssl psmisc python3 g++ make \
32+
&& rm -rf /var/lib/apt/lists/*
33+
34+
# Install Chrome based on architecture
35+
RUN ARCH=$(dpkg --print-architecture) && \
3236
if [ "$ARCH" = "amd64" ]; then \
33-
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
34-
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
35-
apt-get update && \
36-
apt-get install google-chrome-stable -y --no-install-recommends; \
37+
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
38+
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
39+
apt-get update && apt-get install -y google-chrome-stable --no-install-recommends; \
3740
elif [ "$ARCH" = "arm64" ]; then \
3841
wget -q -O chromium-linux-arm64.zip 'https://playwright.azureedge.net/builds/chromium/1088/chromium-linux-arm64.zip' && \
3942
unzip chromium-linux-arm64.zip && \
@@ -43,15 +46,9 @@ RUN apt update && apt install -y wget gnupg dirmngr curl && \
4346
else \
4447
echo "Unsupported architecture: $ARCH" && exit 1; \
4548
fi && \
46-
rm -rf /var/lib/apt/lists/* \
47-
&& apt-get clean && rm -rf /var/lib/{apt,dpkg,cache,log}/
48-
49-
# Install other dependencies
50-
RUN apt update && apt install -y --no-install-recommends \
51-
ca-certificates git git-lfs openssh-client curl jq cmake sqlite3 openssl psmisc python3 g++ make && \
52-
apt-get clean autoclean && apt-get autoremove --yes && rm -rf /var/lib/{apt,dpkg,cache,log}/
49+
rm -rf /var/lib/apt/lists/*
5350

54-
# Copying build artifacts
51+
# Copy build artifacts
5552
COPY --from=server /app/dist/ .
5653
COPY --from=server /app/prisma/ ./prisma
5754
COPY --from=server /app/package.json .
@@ -65,5 +62,4 @@ RUN yarn config set registry https://registry.npmjs.org/ && \
6562
yarn config set network-timeout 1200000 && \
6663
yarn install --production --frozen-lockfile
6764

68-
# Start the application
6965
CMD ["yarn", "start"]

app/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "app",
33
"private": true,
4-
"version": "1.9.2",
4+
"version": "1.9.3",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

app/ui/src/@types/bot.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,19 @@ export type BotIntegrationAPI = {
4040
api_key: string | null;
4141
};
4242
};
43+
44+
45+
export type BotConfig = {
46+
chatModel: {
47+
label: string;
48+
value: string;
49+
stream: string;
50+
}[];
51+
embeddingModel: {
52+
label: string;
53+
value: string;
54+
}[];
55+
defaultChatModel?: string;
56+
defaultEmbeddingModel?: string;
57+
fileUploadSizeLimit: number;
58+
}

app/ui/src/components/Bot/DS/DsTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export const DsTable = ({
111111
);
112112

113113
return (
114-
<div className="px-4 sm:px-6 lg:px-8">
114+
<div>
115115
<div className="sm:flex sm:items-center">
116116
<div className="sm:flex-auto">
117117
<h1 className="text-xl font-semibold text-gray-900 dark:text-white">

app/ui/src/components/Bot/DS/NewDsForm.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import { useState } from "react";
2-
import { Form, notification } from "antd";
2+
import { Form, notification, Skeleton } from "antd";
33
import { useParams } from "react-router-dom";
44
import api from "../../../services/api";
55
import { useMutation, useQueryClient } from "@tanstack/react-query";
66
import { BotForm } from "../../Common/BotForm";
77
import axios from "axios";
8+
import { useCreateConfig } from "../../../hooks/useCreateConfig";
89

910
// @ts-ignore
1011
function classNames(...classes) {
1112
return classes.filter(Boolean).join(" ");
1213
}
1314

1415
export const NewDsForm = ({ onClose }: { onClose: () => void }) => {
16+
const { data: botConfig, status: botConfigStatus } = useCreateConfig();
1517
const [selectedSource, setSelectedSource] = useState<any>({
1618
id: 1,
1719
value: "Website",
@@ -72,9 +74,22 @@ export const NewDsForm = ({ onClose }: { onClose: () => void }) => {
7274
},
7375
});
7476

77+
if (botConfigStatus === "loading") {
78+
return (
79+
<div className="flex justify-center items-center">
80+
<Skeleton active paragraph={{ rows: 5 }} />
81+
</div>
82+
);
83+
}
84+
85+
if (botConfigStatus === "error") {
86+
return <div>Something went wrong while fetching config</div>;
87+
}
88+
7589
return (
7690
<>
7791
<BotForm
92+
botConfig={botConfig}
7893
showEmbeddingAndModels={false}
7994
form={form}
8095
createBot={createBot}

0 commit comments

Comments
 (0)