Skip to content

Commit

Permalink
chore: remove backend (#33)
Browse files Browse the repository at this point in the history
* remove backend

* update imports

* trigger ci

---------

Co-authored-by: Alissa Crane <[email protected]>
  • Loading branch information
abcrane123 and alissacrane-cb authored Nov 7, 2024
1 parent 17660e2 commit 71618aa
Show file tree
Hide file tree
Showing 12 changed files with 6 additions and 3,560 deletions.
69 changes: 0 additions & 69 deletions api/agent.py

This file was deleted.

15 changes: 0 additions & 15 deletions api/constants.py

This file was deleted.

34 changes: 0 additions & 34 deletions api/index.py

This file was deleted.

24 changes: 0 additions & 24 deletions api/inference.py

This file was deleted.

9 changes: 0 additions & 9 deletions api/utils.py

This file was deleted.

1 change: 1 addition & 0 deletions app/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const API_URL = process.env.NEXT_PUBLIC_API_URL || '';
4 changes: 3 additions & 1 deletion app/hooks/useChat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useCallback, useState } from 'react';
import { API_URL } from '../config';
import type { AgentMessage } from '../types';

type UseChatResponse = {
Expand All @@ -20,7 +21,7 @@ export default function useChat({ onSuccess }: UseChatProps): UseChatResponse {
setIsLoading(true);

try {
const response = await fetch('http://localhost:3000/api/chat', {
const response = await fetch(API_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand All @@ -33,6 +34,7 @@ export default function useChat({ onSuccess }: UseChatProps): UseChatResponse {
}

const text = await response.text();

const parsedMessages = text
.trim()
.split('\n')
Expand Down
14 changes: 1 addition & 13 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
rewrites: async () => {
return [
{
source: '/api/:path*',
destination:
process.env.NODE_ENV === 'development'
? 'http://127.0.0.1:5328/api/:path*'
: '/api/',
},
];
},
};
const nextConfig = {};

module.exports = nextConfig;
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
"version": "0.1.0",
"private": true,
"scripts": {
"flask-dev": "poetry install && poetry run python api/index.py",
"next-dev": "next dev",
"dev": "concurrently \"bun run next-dev\" \"bun run flask-dev\"",
"dev": "next dev",
"build": "next build",
"start": "next start",
"format": "biome format --write .",
Expand Down
Loading

0 comments on commit 71618aa

Please sign in to comment.