Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 0 additions & 12 deletions backend/.env.example

This file was deleted.

1 change: 1 addition & 0 deletions backend/authentication/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def logout_view(request):


@api_view(["POST"])

def register_view(request):
email = request.data.get("email")
password = request.data.get("password")
Expand Down
7 changes: 5 additions & 2 deletions backend/backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,15 @@
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

CORS_ALLOWED_ORIGINS = [
FRONTEND_URL,
"http://127.0.0.1:3000",
"http://localhost:3000",

]
CORS_ALLOW_CREDENTIALS = True

CSRF_TRUSTED_ORIGINS = [
FRONTEND_URL,
"http://localhost:3000",

]

SESSION_COOKIE_SECURE = True
Expand Down
2 changes: 1 addition & 1 deletion backend/dependencies.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aiohttp==3.8.5
aiohttp==3.9.0
aiosignal==1.3.1
asgiref==3.7.2
async-timeout==4.0.3
Expand Down
1 change: 1 addition & 0 deletions backend/gpt/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def get_answer(request):
@api_view(["POST"])
def get_conversation(request):
data = request.data
print(data)
return StreamingHttpResponse(
get_conversation_answer(data["conversation"], data["model"], stream=True), content_type="text/html"
)
6 changes: 3 additions & 3 deletions backend/src/libs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
__all__ = ["openai"]
load_dotenv()

openai.api_type = os.getenv("OPENAI_API_TYPE")
openai.api_base = os.getenv("OPENAI_API_BASE")
openai.api_version = os.getenv("OPENAI_API_VERSION")
# openai.api_type = os.getenv("OPENAI_API_TYPE")
# openai.api_base = os.getenv("OPENAI_API_BASE")
# openai.api_version = os.getenv("OPENAI_API_VERSION")
openai.api_key = os.getenv("OPENAI_API_KEY")
3 changes: 1 addition & 2 deletions backend/src/utils/gpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,11 @@ def get_gpt_title(prompt: str, response: str):
def get_conversation_answer(conversation: list[dict[str, str]], model: str, stream: bool = True):
kwargs = {**GPT_40_PARAMS, **dict(stream=stream)}
engine = GPT_VERSIONS[model].engine

for resp in openai.ChatCompletion.create(
engine=engine,
messages=[{"role": "system", "content": "You are a helpful assistant."}, *conversation],
**kwargs,
):
):
choices = resp.get("choices", [])
if not choices:
continue
Expand Down
File renamed without changes.