Prompt changes

This commit is contained in:
root 2025-06-29 07:35:38 +00:00
parent 853cae84dc
commit ea1fc6a430
2 changed files with 9 additions and 5 deletions

View File

@ -22,6 +22,7 @@ RUN apt-get update && apt-get install -y \
# Copy requirements file # Copy requirements file
COPY requirements.txt . COPY requirements.txt .
COPY ./app/quran_arabic.csv .
# Create and activate virtual environment # Create and activate virtual environment
RUN python -m venv $VIRTUAL_ENV RUN python -m venv $VIRTUAL_ENV
@ -36,4 +37,4 @@ COPY . .
EXPOSE 8000 EXPOSE 8000
# Command to run the application # Command to run the application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

View File

@ -14,8 +14,11 @@ app = FastAPI()
app.add_middleware( app.add_middleware(
CORSMiddleware, CORSMiddleware,
allow_origins=[ allow_origins=[
"https://askalquran.com",
"https://www.askalquran.com",
"http://localhost:3000", "http://localhost:3000",
"http://127.0.0.1:3000" "http://127.0.0.1:3000",
"http://0.0.0.0:3000"
], ],
allow_credentials=True, allow_credentials=True,
allow_methods=["*"], allow_methods=["*"],
@ -45,11 +48,11 @@ class TafsirRequest(BaseModel):
# Build LLM prompt # Build LLM prompt
def build_arabic_prompt(reference: str, text: str) -> str: def build_arabic_prompt(reference: str, text: str) -> str:
return ( return (
"أنت عالم متخصص في تفسير القرآن الكريم.\n" "أنت عالم متخصص في تفسير القرآن الكريم.\n"
"يرجى تقديم تفسير شامل ومبسط للآية التالية، مع الأخذ بعين الاعتبار رقم السورة ورقم الآية:\n\n" "يرجى تقديم تفسير مختصر ومبسط للآية التالية:\n\n"
f"{reference}\t{text}\n\n" f"{reference}\t{text}\n\n"
"اكتب التفسير باللغة العربية الفصحى وبأسلوب واضح وميسر للقارئ العام." "اكتب التفسير باللغة العربية الفصحى وبأسلوب مختصر و واضح وميسر للقارئ العام."
) )
# Call Groq LLM # Call Groq LLM