@@ -27,6 +27,7 @@ router.get('/', async (req, res) => {
|
||||
router.post('/cluster', async (req, res) => {
|
||||
try {
|
||||
const notes = await loadNotes();
|
||||
console.log('notes returned from loadNotes', notes)
|
||||
const clusters = await clusterNotes(notes);
|
||||
res.json(clusters);
|
||||
} catch (err) {
|
||||
|
||||
@@ -4,5 +4,5 @@ import config from './config/index.js';
|
||||
const PORT = config.port || 3001;
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Envision backend running on port ${PORT}`);
|
||||
console.log(`Backend running on port ${PORT}`);
|
||||
});
|
||||
@@ -34,11 +34,11 @@ ${notesJson}`;
|
||||
|
||||
export const clusterNotes = async (notes) => {
|
||||
const response = await client.messages.create({
|
||||
model: "claude-sonnet-4-20250514",
|
||||
max_tokens: 4096,
|
||||
messages: [
|
||||
model: "claude-sonnet-4-20250514",
|
||||
max_tokens: 4096,
|
||||
messages: [
|
||||
{ role: "user", content: buildPrompt(notes) },
|
||||
],
|
||||
],
|
||||
});
|
||||
|
||||
const raw = response.content[0].text;
|
||||
|
||||
@@ -8,9 +8,9 @@ type ButtonProps = {
|
||||
|
||||
const Button = ({ onClick, isLoading, label }: ButtonProps) => {
|
||||
return (
|
||||
<button className="primaryButton" onClick={onClick} disabled={isLoading}>
|
||||
{isLoading ? 'Working...' : label}
|
||||
</button>
|
||||
<button className="primaryButton" onClick={onClick} disabled={isLoading}>
|
||||
{isLoading ? 'Working...' : label}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
14
frontend/src/components/navbar.tsx
Normal file
14
frontend/src/components/navbar.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
const Navbar = () => {
|
||||
return (
|
||||
<div className="main-head-box">
|
||||
<div className="main-head-subbox-left">
|
||||
<h1 className="main-head">kohngrüti</h1>
|
||||
</div>
|
||||
<div className="main-head-subbox-right">
|
||||
<span className="material-symbols-outlined">recenter</span>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Navbar;
|
||||
@@ -49,7 +49,7 @@ const Stickies = () => {
|
||||
return (
|
||||
<div>
|
||||
<div className="stickies-container">
|
||||
<Button onClick={handleCluster} isLoading={isPending} label="Group Notes By Theme" />
|
||||
<Button onClick={handleCluster} isLoading={isPending} label="Group Stickies By Topic" />
|
||||
</div>
|
||||
<div className="stickies-grid">
|
||||
{stickies?.map((sticky) => (
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
import Stickies from '../components/stickies';
|
||||
import Navbar from '../components/navbar'
|
||||
import '../styles/home.css'
|
||||
|
||||
const Home = () => {
|
||||
return (
|
||||
<div>
|
||||
<div className="main-head-box">
|
||||
<div className="main-head-subbox-left">
|
||||
<h1 className="main-head">kohngrüti</h1>
|
||||
</div>
|
||||
<div className="main-head-subbox-right">
|
||||
<span className="material-symbols-outlined">recenter</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<Stickies />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
return (
|
||||
<div>
|
||||
<div>
|
||||
<Navbar />
|
||||
</div>
|
||||
<div>
|
||||
<Stickies />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Home;
|
||||
@@ -2,7 +2,8 @@
|
||||
font-family: "Sulphur Point", sans-serif;
|
||||
font-size: 1.1rem;
|
||||
color: #6dd6f4;
|
||||
border: 1px solid rgb(92, 0, 91);
|
||||
width: 16rem;
|
||||
height: 2.5rem;
|
||||
height: 3rem;
|
||||
margin-top: 14px;
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
.stickies-container {
|
||||
margin: 36px 0px 36px 0px;
|
||||
}
|
||||
|
||||
.clusters-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -17,7 +18,7 @@
|
||||
}
|
||||
|
||||
.cluster-group {
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border: 1px solid #6dd6f4;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user