Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/14 instance of planprat #65

Merged
merged 24 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
dfcfa2e
feat: planprat component and corresponding backend api
ArtemisAaroe Oct 30, 2024
aec6606
fix: change where we send data
ArtemisAaroe Oct 30, 2024
c026dab
fixe:added headers
ArtemisAaroe Oct 30, 2024
4753c9a
fix: update CORS middleware to allow OPTIONS method
SverreNystad Oct 30, 2024
09a3fd1
feat: update logging in agent.py
SverreNystad Oct 30, 2024
05cbb6a
style: style update to make text readable and added icon
ArtemisAaroe Oct 30, 2024
1dca904
fix: removed planprat for frontpage
ArtemisAaroe Oct 30, 2024
caae002
feat: added page for planprat in for-søknad
ArtemisAaroe Oct 31, 2024
21dd750
Update webapp/src/components/PlanPrat.tsx
ArtemisAaroe Oct 31, 2024
6061989
refactor: create trpc procedure for planprat and add error handling
andreaslhjulstad Nov 4, 2024
3951be1
Merge branch 'main' into feat/14-instance-of-planprat
andreaslhjulstad Nov 4, 2024
1d90196
refactor: files removed
ArtemisAaroe Nov 5, 2024
47107b0
feat: added planprat to for-soknad
ArtemisAaroe Nov 6, 2024
fea25d6
refactor: deleet files that should not be there
ArtemisAaroe Nov 6, 2024
8e20351
Update docker-compose.yml
ArtemisAaroe Nov 6, 2024
d8bc889
Update webapp/src/components/PlanPrat.tsx
ArtemisAaroe Nov 6, 2024
a0518cf
Update webapp/src/components/PlanPrat.tsx
ArtemisAaroe Nov 6, 2024
2eba636
Update webapp/src/components/PlanPrat.tsx
ArtemisAaroe Nov 6, 2024
3cbad6d
changed to port 8000
ArtemisAaroe Nov 6, 2024
e4572e4
Merge branch 'feat/14-instance-of-planprat' of github.com:kartAI/ntnu…
ArtemisAaroe Nov 6, 2024
8460508
fix: fix econnrefused and env variables bug
andreaslhjulstad Nov 8, 2024
bb07d6a
docs: update readme to new env path
andreaslhjulstad Nov 8, 2024
e99d2f8
Merge branch 'main' into feat/14-instance-of-planprat
andreaslhjulstad Nov 8, 2024
db3325c
build: fix build error
andreaslhjulstad Nov 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions backend/src/main.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
import logging
from fastapi import FastAPI, HTTPException, Query, UploadFile
from fastapi import status
from pydantic import BaseModel
from fastapi.middleware.cors import CORSMiddleware


from src.types import SummaryResponse, PlanPratRequest, PlanPratResponse
from src.services.reader import Reader
from src.services.readers.factory import create_reader
from src.services.agent import invoke_agent, invoke_plan_agent

app = FastAPI()

app = FastAPI(
title="KPRO API AI system",
description="retrives tekst from user and returns an answer based on building regulations.",
version="1.0.0",
)

ORIGINS = [
"http://localhost:3000",
"http://localhost:80",
"http://localhost",
]
# Add CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=ORIGINS,
allow_credentials=True,
allow_methods=["POST", "GET", "OPTIONS"],
allow_headers=["*"],
)


logging.basicConfig(filename="summary-assistant.log", level=logging.INFO)
Expand Down
4 changes: 2 additions & 2 deletions backend/src/services/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ def invoke_plan_agent(query: str) -> str:

"""
)
print(f"context: {_retrieve_law_context()}", flush=True)
logger.info(f"context: {_retrieve_law_context()}")
generate = prompt | llm
response = generate.invoke({"query": query, "context": _retrieve_law_context()})
print(f"Response: {response}", flush=True)
logger.info(f"Response: {response}")
return response.content


Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ services:
context: ./backend
dockerfile: Dockerfile
ports:
- "8000:8000"
- "000:8000"
ArtemisAaroe marked this conversation as resolved.
Show resolved Hide resolved
volumes:
- ./backend:/code
23 changes: 23 additions & 0 deletions node_modules/.package-lock.json
ArtemisAaroe marked this conversation as resolved.
Show resolved Hide resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions node_modules/@types/js-cookie/LICENSE
ArtemisAaroe marked this conversation as resolved.
Show resolved Hide resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions node_modules/@types/js-cookie/README.md
ArtemisAaroe marked this conversation as resolved.
Show resolved Hide resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions node_modules/@types/js-cookie/index.d.mts
ArtemisAaroe marked this conversation as resolved.
Show resolved Hide resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 104 additions & 0 deletions node_modules/@types/js-cookie/index.d.ts
ArtemisAaroe marked this conversation as resolved.
Show resolved Hide resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions node_modules/@types/js-cookie/package.json
ArtemisAaroe marked this conversation as resolved.
Show resolved Hide resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions node_modules/js-cookie/LICENSE
ArtemisAaroe marked this conversation as resolved.
Show resolved Hide resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading