diff --git a/backend/chromadb/1bcb379b-f95d-4bb3-991c-33a7f4974e73/length.bin b/backend/chromadb/1bcb379b-f95d-4bb3-991c-33a7f4974e73/length.bin index e787f12..a996290 100644 Binary files a/backend/chromadb/1bcb379b-f95d-4bb3-991c-33a7f4974e73/length.bin and b/backend/chromadb/1bcb379b-f95d-4bb3-991c-33a7f4974e73/length.bin differ diff --git a/backend/chromadb/chroma.sqlite3 b/backend/chromadb/chroma.sqlite3 index 912e94b..d0e3f1d 100644 Binary files a/backend/chromadb/chroma.sqlite3 and b/backend/chromadb/chroma.sqlite3 differ diff --git a/backend/main.py b/backend/main.py index 3862174..3e0a393 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1,5 +1,4 @@ import os - from fastapi import FastAPI from pydantic import BaseModel from datetime import datetime @@ -45,24 +44,45 @@ "retaining my voice and tone so it still sounds like I wrote it. " "Only return the summarized text and nothing else. Don't prefix the response with anything.") -@app.get("/") -async def root(): - note = Note(text="hello", date_posted=datetime.now()) - - return {"message": "Hello World"} +class NoteContent(BaseModel): + text: str class NoteIn(BaseModel): + title: str text: str class Note(BaseModel): + title: str text: str date_posted: datetime class Query(BaseModel): text: str +@app.get("/") +async def root(): + note = Note(text="hello", date_posted=datetime.now()) + + return {"message": "Hello World"} + +@app.get("/notes") +async def get_all_notes(): + notes = await notes_collection.find().to_list(100) + + notes_parsed = [] + for note in notes: + note_parsed = { + "id": str(note["_id"]), + "title": note["title"] if "title" in note else None, + "text": note["text"], + } + notes_parsed.append(note_parsed) + + return notes_parsed + + @app.post("/summarize") -async def summarize(note: NoteIn): +async def summarize(note: NoteContent): note_prompt = str(CONTEXT + " " + note.text) response = cohere_client.generate( @@ -76,6 +96,7 @@ async def summarize(note: NoteIn): @app.post("/create_note") async def create_note(note: NoteIn): note = Note( + title=note.title, text=note.text, date_posted=datetime.now() ) @@ -89,7 +110,13 @@ async def create_note(note: NoteIn): journal_entry = "Date posted: " + db_note['date_posted'] + "Content: " + note.text search_engine_service.insert_entry(journal_entry) - return str(db_note) + note_parsed = { + "id": str(note["_id"]), + "title": note["title"], + "content": note["content"], + } + + return note_parsed @app.post("/query_journal") async def query(query: Query): diff --git a/frontend/index.html b/frontend/index.html index 0c589ec..2576d1b 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,6 +1,9 @@ + + + diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 9709a12..43d64ef 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -8,6 +8,7 @@ "name": "frontend", "version": "0.0.0", "dependencies": { + "@ant-design/icons": "^5.4.0", "@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-separator": "^1.1.0", "antd": "^5.20.6", diff --git a/frontend/package.json b/frontend/package.json index 2467cc7..b5fb53e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,6 +10,7 @@ "preview": "vite preview" }, "dependencies": { + "@ant-design/icons": "^5.4.0", "@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-separator": "^1.1.0", "antd": "^5.20.6", diff --git a/frontend/src/App.css b/frontend/src/App.css index b9d355d..270b215 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -3,6 +3,23 @@ margin: 0 auto; padding: 2rem; text-align: center; + font-family: 'Instrument Sans'; + color: '#0f172a'; +} + +h1 { + font-size: 36px; + font-weight: semibold; +} + +h2 { + font-size: 24px; + font-weight: semibold; +} + +p { + font-size: 16px; + font-weight: medium; } .logo { diff --git a/frontend/src/routes/summary.jsx b/frontend/src/routes/summary.jsx index 25b9ebb..b7172f3 100644 --- a/frontend/src/routes/summary.jsx +++ b/frontend/src/routes/summary.jsx @@ -1,16 +1,22 @@ import axios from "axios"; import { useState } from "react"; -import {Button} from "antd"; +import { Button, Flex, Input } from "antd"; +import { EditFilled } from "@ant-design/icons" +import "../styles/Summary.css" const BACKEND_URL = "http://127.0.0.1:8000/create_note"; function Summary() { - const [summary, setSummary] = useState("Blah blah blah"); + const { TextArea } = Input; + + const [title, setTitle] = useState(""); + const [summary, setSummary] = useState("I spent most of the afternoon working on the new prototypes, and it was one of those rare times where I lost track of time because I was so into it. The ideas were just flowing, and everything felt right. It’s such a rush when that happens, you know? When it's just me, the screen, and a cup of coffee, and things are working. It reminded me why I love this job in the first place."); const postNote = async (note) => { try { console.log(note) const response = await axios.post(BACKEND_URL, { + title: title, text: note }); @@ -20,15 +26,27 @@ function Summary() { } } - return ( -
-

Summary

- - - {summary} + const handleSummaryEdit = (event) => { + setSummary(event.target.value); + }; - - + return ( +
+
+

Journal Summary

+ +