Skip to content

Commit 0a79be1

Browse files
committed
fix API post
1 parent 1f1d68b commit 0a79be1

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/lib/config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,15 @@ export const API_ENDPOINTS = {
1212
GENERATE_GRAPH_WITH_EDGES: `${API_BASE_URL}/api/generate-graph-with-edges`,
1313
GET_UNIQUE_REPOS: `${API_BASE_URL}/api/get-unique-repos`,
1414
CREATE_EDGES_ON_GRAPH: `${API_BASE_URL}/api/create-edges-on-graph`,
15+
// GraphRAG endpoints
16+
GRAPHRAG_HEALTH: `${API_BASE_URL}/api/graphrag-health`,
17+
GRAPHRAG_SETUP: `${API_BASE_URL}/api/graphrag-setup`,
18+
GRAPHRAG_PROGRESS: `${API_BASE_URL}/api/graphrag-progress`,
19+
GRAPHRAG_RESET_PROGRESS: `${API_BASE_URL}/api/graphrag-reset-progress`,
20+
GRAPHRAG_CHANGE_PROVIDER: `${API_BASE_URL}/api/graphrag-change-provider`,
21+
GRAPHRAG_UPDATE_README: `${API_BASE_URL}/api/graphrag-update-readme`,
22+
GRAPHRAG_FIX_SCHEMA: `${API_BASE_URL}/api/graphrag-fix-schema`,
23+
GRAPHRAG_QUERY: `${API_BASE_URL}/api/graphrag`,
24+
GRAPHRAG_CLEANUP: `${API_BASE_URL}/api/graphrag-cleanup`,
25+
GRAPHRAG_CHECK_CHANGES: `${API_BASE_URL}/api/graphrag-check-changes`,
1526
} as const;

src/views/GraphRAGPanel.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { Tooltip } from 'bootstrap';
88

99
import { GraphContext } from "../lib/context";
1010
import { useNotifications } from "../lib/notifications";
11+
import { API_ENDPOINTS } from "../lib/config";
1112
import { ANIMATION_DURATION } from "../lib/consts";
1213
import { Coordinates } from "sigma/types";
1314

@@ -108,7 +109,7 @@ const GraphRAGPanel: FC = () => {
108109
try {
109110
const sessionId = sessionStorage.getItem('graphrag_session_id') || '';
110111
if (sessionId) {
111-
const response = await fetch('/api/graphrag-cleanup', {
112+
const response = await fetch(API_ENDPOINTS.GRAPHRAG_CLEANUP, {
112113
method: 'POST',
113114
headers: {
114115
'Content-Type': 'application/json',
@@ -264,7 +265,7 @@ const GraphRAGPanel: FC = () => {
264265
const checkBackendHealth = async () => {
265266
if (graphragState.isReady) {
266267
try {
267-
const response = await fetch('http://localhost:5002/api/graphrag-health', {
268+
const response = await fetch(API_ENDPOINTS.GRAPHRAG_HEALTH, {
268269
method: 'GET',
269270
headers: {
270271
'Content-Type': 'application/json',
@@ -613,7 +614,7 @@ const GraphRAGPanel: FC = () => {
613614
const sessionId = `graphrag_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
614615
sessionStorage.setItem('graphrag_session_id', sessionId);
615616

616-
const response = await fetch('http://localhost:5002/api/graphrag-setup', {
617+
const response = await fetch(API_ENDPOINTS.GRAPHRAG_SETUP, {
617618
method: 'POST',
618619
headers: {
619620
'Content-Type': 'application/json',
@@ -707,7 +708,7 @@ const GraphRAGPanel: FC = () => {
707708
updateState({ messages: newMessages });
708709

709710
try {
710-
const response = await fetch("/api/graphrag", {
711+
const response = await fetch(API_ENDPOINTS.GRAPHRAG_QUERY, {
711712
method: "POST",
712713
headers: {
713714
"Content-Type": "application/json",

0 commit comments

Comments
 (0)