Skip to content

Commit

Permalink
Merge pull request #285 from n4ze3m/next
Browse files Browse the repository at this point in the history
v1.9.3
  • Loading branch information
n4ze3m authored Aug 1, 2024
2 parents 6859057 + 3693261 commit adde6aa
Show file tree
Hide file tree
Showing 34 changed files with 1,047 additions and 328 deletions.
54 changes: 25 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
FROM node:18-slim AS base
# Build stage
FROM node:18-slim AS build
WORKDIR /app
RUN apt update && apt install -y \
g++ make python3 wget gnupg dirmngr unzip
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ make python3 wget gnupg dirmngr unzip \
&& rm -rf /var/lib/apt/lists/*

RUN npm --no-update-notifier --no-fund --global install pnpm

COPY . .
RUN pnpm install && pnpm build

# Server stage
FROM base AS server
FROM node:18-slim AS server
WORKDIR /app
COPY ./server/ .
RUN yarn config set registry https://registry.npmjs.org/ && \
yarn config set network-timeout 1200000 && \
yarn install --frozen-lockfile && \
yarn build

# Build stage
FROM base AS build
RUN npm --no-update-notifier --no-fund --global install pnpm
COPY . .
RUN pnpm install && pnpm build

# Final stage
FROM node:18-slim
WORKDIR /app

# Set environment variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV NODE_ENV=production
# Install dependencies
RUN apt update && apt install -y wget gnupg dirmngr unzip
# Install dependencies and google chrome based on architecture
RUN apt update && apt install -y wget gnupg dirmngr curl && \
ARCH=$(dpkg --print-architecture) && \

RUN apt-get update && apt-get install -y --no-install-recommends \
wget gnupg dirmngr curl ca-certificates git git-lfs openssh-client \
jq cmake sqlite3 openssl psmisc python3 g++ make \
&& rm -rf /var/lib/apt/lists/*

# Install Chrome based on architecture
RUN ARCH=$(dpkg --print-architecture) && \
if [ "$ARCH" = "amd64" ]; then \
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
apt-get update && \
apt-get install google-chrome-stable -y --no-install-recommends; \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
apt-get update && apt-get install -y google-chrome-stable --no-install-recommends; \
elif [ "$ARCH" = "arm64" ]; then \
wget -q -O chromium-linux-arm64.zip 'https://playwright.azureedge.net/builds/chromium/1088/chromium-linux-arm64.zip' && \
unzip chromium-linux-arm64.zip && \
Expand All @@ -43,15 +46,9 @@ RUN apt update && apt install -y wget gnupg dirmngr curl && \
else \
echo "Unsupported architecture: $ARCH" && exit 1; \
fi && \
rm -rf /var/lib/apt/lists/* \
&& apt-get clean && rm -rf /var/lib/{apt,dpkg,cache,log}/

# Install other dependencies
RUN apt update && apt install -y --no-install-recommends \
ca-certificates git git-lfs openssh-client curl jq cmake sqlite3 openssl psmisc python3 g++ make && \
apt-get clean autoclean && apt-get autoremove --yes && rm -rf /var/lib/{apt,dpkg,cache,log}/
rm -rf /var/lib/apt/lists/*

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

# Start the application
CMD ["yarn", "start"]
2 changes: 1 addition & 1 deletion app/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "app",
"private": true,
"version": "1.9.2",
"version": "1.9.3",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
16 changes: 16 additions & 0 deletions app/ui/src/@types/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,19 @@ export type BotIntegrationAPI = {
api_key: string | null;
};
};


export type BotConfig = {
chatModel: {
label: string;
value: string;
stream: string;
}[];
embeddingModel: {
label: string;
value: string;
}[];
defaultChatModel?: string;
defaultEmbeddingModel?: string;
fileUploadSizeLimit: number;
}
2 changes: 1 addition & 1 deletion app/ui/src/components/Bot/DS/DsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const DsTable = ({
);

return (
<div className="px-4 sm:px-6 lg:px-8">
<div>
<div className="sm:flex sm:items-center">
<div className="sm:flex-auto">
<h1 className="text-xl font-semibold text-gray-900 dark:text-white">
Expand Down
17 changes: 16 additions & 1 deletion app/ui/src/components/Bot/DS/NewDsForm.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { useState } from "react";
import { Form, notification } from "antd";
import { Form, notification, Skeleton } from "antd";
import { useParams } from "react-router-dom";
import api from "../../../services/api";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { BotForm } from "../../Common/BotForm";
import axios from "axios";
import { useCreateConfig } from "../../../hooks/useCreateConfig";

// @ts-ignore
function classNames(...classes) {
return classes.filter(Boolean).join(" ");
}

export const NewDsForm = ({ onClose }: { onClose: () => void }) => {
const { data: botConfig, status: botConfigStatus } = useCreateConfig();
const [selectedSource, setSelectedSource] = useState<any>({
id: 1,
value: "Website",
Expand Down Expand Up @@ -72,9 +74,22 @@ export const NewDsForm = ({ onClose }: { onClose: () => void }) => {
},
});

if (botConfigStatus === "loading") {
return (
<div className="flex justify-center items-center">
<Skeleton active paragraph={{ rows: 5 }} />
</div>
);
}

if (botConfigStatus === "error") {
return <div>Something went wrong while fetching config</div>;
}

return (
<>
<BotForm
botConfig={botConfig}
showEmbeddingAndModels={false}
form={form}
createBot={createBot}
Expand Down
Loading

0 comments on commit adde6aa

Please sign in to comment.