mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-09-17 06:41:33 +00:00
Compare commits
3 Commits
403d13eb50
...
008c7cbec0
Author | SHA1 | Date | |
---|---|---|---|
|
008c7cbec0 | ||
|
4d1ee79b8d | ||
|
ea638279e5 |
25
.github/workflows/docker-build.yaml
vendored
25
.github/workflows/docker-build.yaml
vendored
@@ -10,9 +10,6 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
service: [backend, app]
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -36,17 +33,12 @@ jobs:
|
|||||||
id: version
|
id: version
|
||||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Build and push Docker image for ${{ matrix.service }}
|
- name: Build and push Docker image
|
||||||
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
||||||
run: |
|
run: |
|
||||||
docker buildx create --use
|
docker buildx create --use
|
||||||
if [[ "${{ matrix.service }}" == "backend" ]]; then \
|
DOCKERFILE=app.dockerfile; \
|
||||||
DOCKERFILE=backend.dockerfile; \
|
IMAGE_NAME=perplexica; \
|
||||||
IMAGE_NAME=perplexica-backend; \
|
|
||||||
else \
|
|
||||||
DOCKERFILE=app.dockerfile; \
|
|
||||||
IMAGE_NAME=perplexica-frontend; \
|
|
||||||
fi
|
|
||||||
docker buildx build --platform linux/amd64,linux/arm64 \
|
docker buildx build --platform linux/amd64,linux/arm64 \
|
||||||
--cache-from=type=registry,ref=itzcrazykns1337/${IMAGE_NAME}:main \
|
--cache-from=type=registry,ref=itzcrazykns1337/${IMAGE_NAME}:main \
|
||||||
--cache-to=type=inline \
|
--cache-to=type=inline \
|
||||||
@@ -54,17 +46,12 @@ jobs:
|
|||||||
-t itzcrazykns1337/${IMAGE_NAME}:main \
|
-t itzcrazykns1337/${IMAGE_NAME}:main \
|
||||||
--push .
|
--push .
|
||||||
|
|
||||||
- name: Build and push release Docker image for ${{ matrix.service }}
|
- name: Build and push release Docker image
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
run: |
|
run: |
|
||||||
docker buildx create --use
|
docker buildx create --use
|
||||||
if [[ "${{ matrix.service }}" == "backend" ]]; then \
|
DOCKERFILE=app.dockerfile; \
|
||||||
DOCKERFILE=backend.dockerfile; \
|
IMAGE_NAME=perplexica; \
|
||||||
IMAGE_NAME=perplexica-backend; \
|
|
||||||
else \
|
|
||||||
DOCKERFILE=app.dockerfile; \
|
|
||||||
IMAGE_NAME=perplexica-frontend; \
|
|
||||||
fi
|
|
||||||
docker buildx build --platform linux/amd64,linux/arm64 \
|
docker buildx build --platform linux/amd64,linux/arm64 \
|
||||||
--cache-from=type=registry,ref=itzcrazykns1337/${IMAGE_NAME}:${{ env.RELEASE_VERSION }} \
|
--cache-from=type=registry,ref=itzcrazykns1337/${IMAGE_NAME}:${{ env.RELEASE_VERSION }} \
|
||||||
--cache-to=type=inline \
|
--cache-to=type=inline \
|
||||||
|
@@ -1,22 +1,27 @@
|
|||||||
|
FROM node:20.18.0-alpine AS builder
|
||||||
|
|
||||||
|
WORKDIR /home/perplexica
|
||||||
|
|
||||||
|
COPY package.json yarn.lock ./
|
||||||
|
RUN yarn install --frozen-lockfile
|
||||||
|
|
||||||
|
COPY tsconfig.json next.config.mjs next-env.d.ts postcss.config.js drizzle.config.ts tailwind.config.ts ./
|
||||||
|
COPY src ./src
|
||||||
|
COPY public ./public
|
||||||
|
|
||||||
|
RUN mkdir -p /home/perplexica/data
|
||||||
|
RUN yarn build
|
||||||
|
|
||||||
FROM node:20.18.0-alpine
|
FROM node:20.18.0-alpine
|
||||||
|
|
||||||
WORKDIR /home/perplexica
|
WORKDIR /home/perplexica
|
||||||
|
|
||||||
COPY src /home/perplexica/src
|
COPY --from=builder /home/perplexica/public ./public
|
||||||
COPY public /home/perplexica/public
|
COPY --from=builder /home/perplexica/.next/static ./public/_next/static
|
||||||
COPY package.json /home/perplexica/package.json
|
|
||||||
COPY yarn.lock /home/perplexica/yarn.lock
|
COPY --from=builder /home/perplexica/.next/standalone ./
|
||||||
COPY tsconfig.json /home/perplexica/tsconfig.json
|
COPY --from=builder /home/perplexica/data ./data
|
||||||
COPY next.config.mjs /home/perplexica/next.config.mjs
|
|
||||||
COPY next-env.d.ts /home/perplexica/next-env.d.ts
|
|
||||||
COPY postcss.config.js /home/perplexica/postcss.config.js
|
|
||||||
COPY drizzle.config.ts /home/perplexica/drizzle.config.ts
|
|
||||||
COPY tailwind.config.ts /home/perplexica/tailwind.config.ts
|
|
||||||
|
|
||||||
RUN mkdir /home/perplexica/data
|
|
||||||
RUN mkdir /home/perplexica/uploads
|
RUN mkdir /home/perplexica/uploads
|
||||||
|
|
||||||
RUN yarn install --frozen-lockfile
|
CMD ["node", "server.js"]
|
||||||
RUN yarn build
|
|
||||||
|
|
||||||
CMD ["yarn", "start"]
|
|
@@ -10,6 +10,7 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
app:
|
app:
|
||||||
|
image: itzcrazykns1337/perplexica:main
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: app.dockerfile
|
dockerfile: app.dockerfile
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
|
output: 'standalone',
|
||||||
images: {
|
images: {
|
||||||
remotePatterns: [
|
remotePatterns: [
|
||||||
{
|
{
|
||||||
|
@@ -5,8 +5,8 @@
|
|||||||
"author": "ItzCrazyKns",
|
"author": "ItzCrazyKns",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "npm run db:push && next build",
|
||||||
"start": "npm run db:push && next start",
|
"start": "next start",
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
"format:write": "prettier . --write",
|
"format:write": "prettier . --write",
|
||||||
"db:push": "drizzle-kit push"
|
"db:push": "drizzle-kit push"
|
||||||
|
@@ -343,30 +343,6 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
|||||||
|
|
||||||
messageId = messageId ?? crypto.randomBytes(7).toString('hex');
|
messageId = messageId ?? crypto.randomBytes(7).toString('hex');
|
||||||
|
|
||||||
console.log(
|
|
||||||
JSON.stringify({
|
|
||||||
content: message,
|
|
||||||
message: {
|
|
||||||
messageId: messageId,
|
|
||||||
chatId: chatId!,
|
|
||||||
content: message,
|
|
||||||
},
|
|
||||||
chatId: chatId!,
|
|
||||||
files: fileIds,
|
|
||||||
focusMode: focusMode,
|
|
||||||
optimizationMode: optimizationMode,
|
|
||||||
history: chatHistory,
|
|
||||||
chatModel: {
|
|
||||||
name: chatModelProvider.name,
|
|
||||||
provider: chatModelProvider.provider,
|
|
||||||
},
|
|
||||||
embeddingModel: {
|
|
||||||
name: embeddingModelProvider.name,
|
|
||||||
provider: embeddingModelProvider.provider,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
setMessages((prevMessages) => [
|
setMessages((prevMessages) => [
|
||||||
...prevMessages,
|
...prevMessages,
|
||||||
{
|
{
|
||||||
@@ -445,6 +421,21 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
|||||||
|
|
||||||
const lastMsg = messagesRef.current[messagesRef.current.length - 1];
|
const lastMsg = messagesRef.current[messagesRef.current.length - 1];
|
||||||
|
|
||||||
|
const autoImageSearch = localStorage.getItem('autoImageSearch');
|
||||||
|
const autoVideoSearch = localStorage.getItem('autoVideoSearch');
|
||||||
|
|
||||||
|
if (autoImageSearch === 'true') {
|
||||||
|
document
|
||||||
|
.getElementById(`search-images-${lastMsg.messageId}`)
|
||||||
|
?.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (autoVideoSearch === 'true') {
|
||||||
|
document
|
||||||
|
.getElementById(`search-videos-${lastMsg.messageId}`)
|
||||||
|
?.click();
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
lastMsg.role === 'assistant' &&
|
lastMsg.role === 'assistant' &&
|
||||||
lastMsg.sources &&
|
lastMsg.sources &&
|
||||||
@@ -461,21 +452,6 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const autoImageSearch = localStorage.getItem('autoImageSearch');
|
|
||||||
const autoVideoSearch = localStorage.getItem('autoVideoSearch');
|
|
||||||
|
|
||||||
if (autoImageSearch === 'true') {
|
|
||||||
document
|
|
||||||
.getElementById(`search-images-${lastMsg.messageId}`)
|
|
||||||
?.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (autoVideoSearch === 'true') {
|
|
||||||
document
|
|
||||||
.getElementById(`search-videos-${lastMsg.messageId}`)
|
|
||||||
?.click();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user