Skip to content
Merged
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
1 change: 1 addition & 0 deletions dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"autoprefixer": "10.4.14",
"eslint": "8.39.0",
"eslint-config-next": "13.3.4",
"mongoose": "^7.1.0",
"next": "13.3.4",
"postcss": "8.4.23",
"react": "18.2.0",
Expand Down
36 changes: 36 additions & 0 deletions dashboard/src/pages/api/fetch-llm-calls.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import mongoose from 'mongoose';
import { NextApiRequest, NextApiResponse } from 'next';
import connectMongo from './../../utils/connectMongo'

// TODO: Fix issue to get all fields
// const LLMCallSchema = new mongoose.Schema({
// prompt: {
// type: [[[String]]],
// required: true
// },
// output: String,
// params: Object
// });
const LLMCallSchema = new mongoose.Schema({});
const LLMCallModel = mongoose.models.LLMCall || mongoose.model('LLMCall', LLMCallSchema, 'l_l_m_call');

export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {

try {
console.log('CONNECTING TO MONGO');
await connectMongo();
console.log('CONNECTED TO MONGO');

const data = await LLMCallModel.find({});
console.log(data)
return res.status(200).json(data);
} catch (error) {
console.log(error);
res.json({ message: 'error' });
}


}
5 changes: 5 additions & 0 deletions dashboard/src/utils/connectMongo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import mongoose from 'mongoose';

const connectMongo = async () => mongoose.connect(process.env.MONGO_URI || '');

export default connectMongo;
8 changes: 7 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ services:
ports:
- "3000:3000"
environment:
NODE_ENV: development
- NODE_ENV=development
- MONGO_URI=mongodb://username:password@mongo:27017/test?authSource=admin
networks:
- agenta-network
depends_on:
mongo:
condition: service_healthy


networks:
Expand Down