Skip to content

Commit

Permalink
Merge pull request #8 from Agenta-AI/AG-3-read-from-bff
Browse files Browse the repository at this point in the history
make frontend read from bff - delete old next js api routes - enable …
  • Loading branch information
aakrem authored May 8, 2023
2 parents e121bdf + b6af824 commit 09ec1b5
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 67 deletions.
46 changes: 45 additions & 1 deletion agenta-bff/package-lock.json

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

1 change: 1 addition & 0 deletions agenta-bff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@fastify/cors": "^8.2.1",
"@prisma/client": "^4.13.0",
"fastify": "^4.17.0",
"fastify-zod": "^1.3.2",
Expand Down
8 changes: 8 additions & 0 deletions agenta-bff/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import Fastify from "fastify";
import llmCallsRoutes from "./modules/llmCall/llmCall.route";
import { llmCallSchemas } from "./modules/llmCall/llmCall.schema";
import cors from '@fastify/cors'

function buildServer() {
const server = Fastify();

const urls = ["localhost", "127.0.0.1", "http://localhost:3000"]
server.register(cors, {
origin: urls,
// methods: ['GET', 'POST'],
// credentials: true
})

server.get("/healthcheck", async function () {
return { status: "OK" };
});
Expand Down
16 changes: 9 additions & 7 deletions agenta-web/src/components/LLMCallsTable/LLMCallsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

import { log } from 'console';
import { useState, useEffect } from 'react';

export default function LLMCallsTable() {
Expand All @@ -7,10 +8,13 @@ export default function LLMCallsTable() {

useEffect(() => {
setLoading(true)
fetch('/api/fetch-llm-calls')
fetch('http://127.0.0.1:3030/api/llm-calls', {
headers: {
"Content-Type": "application/json",
}
})
.then((res) => res.json())
.then((data) => {
console.log(data);
setData(data)
setLoading(false)
})
Expand Down Expand Up @@ -41,17 +45,15 @@ export default function LLMCallsTable() {
</tr>
</thead>
<tbody>
{data.map((item) => (
<tr className="bg-white" key={item._id} >
{data.map((item, index) => (
<tr className="bg-white" key={`tr-${item.id}`} >
<td className="px-6 py-4">{item.output}</td>
<td className="px-6 py-4">{item.prompt}</td>
<td className="px-6 py-4">{item.params}</td>
</tr>
))}
</tbody>
</table>
</div>

</div>
);
}
}
12 changes: 5 additions & 7 deletions agenta-web/src/components/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ export default function Sidebar() {

<ul className="pt-2">
{menu.map((item, index) => (
<>
<li key={index} className="text-gray-200 text-sm flex items-center gap-x-4 cursor-pointer p-2 hover:bg-teal-700 rounded-md mt-2">
<span>
{item.title}
</span>
</li>
</>
<li key={index} className="text-gray-200 text-sm flex items-center gap-x-4 cursor-pointer p-2 hover:bg-teal-700 rounded-md mt-2">
<span>
{item.title}
</span>
</li>
))}
</ul>
</div>
Expand Down
34 changes: 0 additions & 34 deletions agenta-web/src/pages/api/fetch-llm-calls.ts

This file was deleted.

13 changes: 0 additions & 13 deletions agenta-web/src/pages/api/hello.ts

This file was deleted.

5 changes: 0 additions & 5 deletions agenta-web/src/utils/connectMongo.ts

This file was deleted.

0 comments on commit 09ec1b5

Please sign in to comment.