Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove backend #33

Merged
merged 3 commits into from
Nov 7, 2024
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
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
Loading