merge with main

This commit is contained in:
shiva raj badu 2025-05-12 20:07:40 +05:45
commit 7a23663c6a
14 changed files with 34 additions and 148 deletions

View file

@ -13,12 +13,13 @@ var nextjsProcess: ChildProcessByStdio<any, any, any> | undefined;
const createWindow = () => {
win = new BrowserWindow({
width: 1280,
height: 720,
icon: path.join(baseDir, "resources/ui/assets/images/presenton_short_filled.png"),
webPreferences: {
webSecurity: false,
preload: path.join(__dirname, 'preload.js'),
},
width: 1280,
height: 720,
});
};

View file

@ -10,9 +10,11 @@ const config = {
"resources",
"app_dist",
"node_modules",
"dependencies/libreoffice/linux_build/libreoffice.appimage"
],
linux: {
target: ["AppImage"],
icon: "resources/ui/assets/images/presenton_short_filled.png",
},
}

View file

@ -1,7 +1,7 @@
{
"name": "presenton_open_source",
"name": "presenton",
"main": "app_dist/main.js",
"version": "0.0.0",
"version": "0.0.1",
"description": "Presenton Open Source",
"homepage": "https://presenton.ai",
"author": {
@ -14,7 +14,7 @@
"build:ts": "tsc",
"build:css": "tailwindcss -i ./resources/ui/assets/css/tailwind.import.css -o ./resources/ui/assets/css/tailwind.css --watch",
"build:nextjs": "rm -rf resources/nextjs && cp -r servers/nextjs resources/nextjs && cd resources/nextjs && npm install && npm run build",
"build:fastapi": "rm -rf resources/fastapi && cd servers/fastapi && .venv/bin/pyinstaller --name fastapi --distpath ../../resources server.py",
"build:fastapi": "rm -rf resources/fastapi && cd servers/fastapi && .venv/bin/pyinstaller --distpath ../../resources server.spec",
"build:electron": "tsc && node build.js",
"clean:build": "rm -rf resources/nextjs && rm -rf resources/fastapi"
},
@ -34,4 +34,4 @@
"tailwindcss": "^4.1.5",
"tree-kill": "^1.2.2"
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -25,7 +25,7 @@
<body class="bg-gray-900 text-white flex flex-col items-center justify-center h-screen">
<img src="../assets/images/presenton_logo.png" alt="Presenton Logo" class="h-20">
<p class="mt-20 text-lg">Waiting for server to start...</p>
<p class="mt-20 text-lg">Just a moment...</p>
<div class="loading-circle mt-10"></div>
</body>

View file

@ -1,50 +0,0 @@
# Build stage
FROM python:3.11-slim AS builder
WORKDIR /app
COPY requirements.txt .
# Install build dependencies and pip packages in one layer
RUN apt-get update && apt-get install -y --no-install-recommends \
libreoffice \
poppler-utils \
ffmpeg \
fonts-noto \
fonts-dejavu \
fonts-liberation \
fonts-freefont-ttf \
fonts-roboto \
fonts-noto-core \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --no-cache-dir -r requirements.txt
# Final stage
FROM python:3.11-slim
WORKDIR /app
# Install only runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libreoffice \
poppler-utils \
ffmpeg \
fonts-noto \
fonts-dejavu \
fonts-liberation \
fonts-freefont-ttf \
fonts-roboto \
fonts-noto-core \
&& rm -rf /var/lib/apt/lists/*
# Copy installed Python packages from builder
COPY --from=builder /usr/local/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/
COPY --from=builder /usr/local/bin/ /usr/local/bin/
# Copy application code and fonts
COPY . /app
COPY ./fonts /usr/share/fonts/
RUN fc-cache -fv
CMD ["python", "server.py"]

View file

@ -104,6 +104,10 @@ class PresentationGenerateStreamHandler:
data=json.dumps({"type": "chunk", "chunk": chunk.content}),
).to_string()
print("-" * 40)
print(presentation_text)
print("-" * 40)
presentation_json = output_parser.parse(presentation_text)
print("-" * 40)

View file

@ -1,6 +1,7 @@
import asyncio
import json
import os
import sys
import traceback
from typing import List, Optional
@ -47,6 +48,11 @@ def update_env_with_user_config():
os.environ["GOOGLE_API_KEY"] = user_config.GOOGLE_API_KEY
def get_resource(relative_path):
base_path = getattr(sys, "_MEIPASS", os.path.dirname(os.path.abspath(__file__)))
return os.path.join(base_path, relative_path)
def replace_file_name(old_name: str, new_name: str) -> str:
splitted = old_name.split(".")
if len(splitted) < 1:

View file

@ -1,44 +0,0 @@
# -*- mode: python ; coding: utf-8 -*-
a = Analysis(
['server.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='fastapi',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='fastapi',
)

View file

@ -1,38 +0,0 @@
# -*- mode: python ; coding: utf-8 -*-
a = Analysis(
['server.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='fastapi_app',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)

View file

@ -1,6 +1,7 @@
import os
from typing import List, Optional
from api.utils import get_resource
from ppt_generator.models.query_and_prompt_models import (
IconCategoryEnum,
IconQueryCollectionWithData,
@ -21,11 +22,11 @@ async def get_icon(
with open(output_path, "wb") as f_a:
try:
with open(f"assets/icons/bold/{icon_name}.png", "rb") as f_b:
with open(get_resource(f"assets/icons/bold/{icon_name}.png"), "rb") as f_b:
f_a.write(f_b.read())
except Exception as e:
print("Error finding icon: ", e)
with open(f"assets/icons/placeholder.png", "rb") as f_b:
with open(get_resource("assets/icons/placeholder.png"), "rb") as f_b:
f_a.write(f_b.read())
@ -42,7 +43,9 @@ async def get_icons(
icon_names = [result.page_content for result in results]
icon_paths = [f"assets/icons/bold/{each}-bold.png" for each in icon_names]
icon_paths = [
get_resource(f"assets/icons/bold/{each}-bold.png") for each in icon_names
]
icon_temp_paths = []

View file

@ -4,10 +4,11 @@ from langchain_core.vectorstores import InMemoryVectorStore
from langchain_huggingface import HuggingFaceEmbeddings
from langchain_core.documents import Document
from api.utils import get_resource
def get_icons_vectorstore():
vector_store_path = "assets/icons_vectorstore.json"
vector_store_path = get_resource("assets/icons_vectorstore.json")
embeddings = HuggingFaceEmbeddings(model_name="all-MiniLM-L6-v2")
@ -17,7 +18,7 @@ def get_icons_vectorstore():
vector_store = InMemoryVectorStore(embeddings)
with open("assets/icons.json", "r") as f:
with open(get_resource("assets/icons.json"), "r") as f:
icons = json.load(f)
icon_names = [icon["name"] for icon in icons["icons"]]

View file

@ -6,6 +6,7 @@ from openai import OpenAI
from ppt_generator.models.query_and_prompt_models import (
ImagePromptWithThemeAndAspectRatio,
)
from api.utils import get_resource
async def generate_image(
@ -25,7 +26,7 @@ async def generate_image(
await image_gen_func(image_prompt, output_path)
except Exception as e:
print(f"Error generating image: {e}")
with open("assets/images/placeholder.jpg", "rb") as f_a:
with open(get_resource("assets/images/placeholder.jpg"), "rb") as f_a:
with open(output_path, "wb") as f_b:
f_b.write(f_a.read())

View file

@ -5,7 +5,7 @@ a = Analysis(
['server.py'],
pathex=[],
binaries=[],
datas=[],
datas=[('assets', 'assets')],
hiddenimports=[],
hookspath=[],
hooksconfig={},
@ -21,7 +21,7 @@ exe = EXE(
a.scripts,
[],
exclude_binaries=True,
name='server',
name='fastapi',
debug=False,
bootloader_ignore_signals=False,
strip=False,
@ -40,5 +40,5 @@ coll = COLLECT(
strip=False,
upx=True,
upx_exclude=[],
name='server',
name='fastapi',
)