Skip to content

Commit 3efa203

Browse files
authored
Merge pull request #63 from data-exp-lab/deploy
Fix Deploy Issues
2 parents 83d53b6 + 865da85 commit 3efa203

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

backend/app/main.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,10 @@ def graphrag_setup_endpoint():
754754
api_key = api_keys.get("geminiKey") or config_manager.get("ai_providers.google_genai.api_key", "")
755755
graphrag_api_keys = {"geminiKey": api_key}
756756
provider = "gemini" # Map to GraphRAG service provider name
757+
elif provider == "gemini":
758+
# Support direct "gemini" provider selection from frontend
759+
api_key = api_keys.get("geminiKey") or config_manager.get("ai_providers.google_genai.api_key", "")
760+
graphrag_api_keys = {"geminiKey": api_key}
757761
elif provider == "anthropic":
758762
api_key = api_keys.get("anthropicKey") or config_manager.get("ai_providers.anthropic.api_key", "")
759763
graphrag_api_keys = {"anthropicKey": api_key}
@@ -881,6 +885,10 @@ def graphrag_change_provider_endpoint():
881885
api_key = api_keys.get("geminiKey") or config_manager.get("ai_providers.google_genai.api_key", "")
882886
graphrag_api_keys = {"geminiKey": api_key}
883887
provider = "gemini" # Map to GraphRAG service provider name
888+
elif provider == "gemini":
889+
# Support direct "gemini" provider selection from frontend
890+
api_key = api_keys.get("geminiKey") or config_manager.get("ai_providers.google_genai.api_key", "")
891+
graphrag_api_keys = {"geminiKey": api_key}
884892
elif provider == "anthropic":
885893
api_key = api_keys.get("anthropicKey") or config_manager.get("ai_providers.anthropic.api_key", "")
886894
graphrag_api_keys = {"anthropicKey": api_key}
@@ -1125,6 +1133,10 @@ def graphrag_endpoint():
11251133
api_key = api_keys.get("geminiKey") or config_manager.get("ai_providers.google_genai.api_key", "")
11261134
graphrag_api_keys = {"geminiKey": api_key}
11271135
provider = "gemini" # Map to GraphRAG service provider name
1136+
elif provider == "gemini":
1137+
# Support direct "gemini" provider selection from frontend
1138+
api_key = api_keys.get("geminiKey") or config_manager.get("ai_providers.google_genai.api_key", "")
1139+
graphrag_api_keys = {"geminiKey": api_key}
11281140
elif provider == "anthropic":
11291141
api_key = api_keys.get("anthropicKey") or config_manager.get("ai_providers.anthropic.api_key", "")
11301142
graphrag_api_keys = {"anthropicKey": api_key}

src/lib/config.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Backend API configuration
2-
export const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;
2+
// Use environment var if provided; otherwise default to same-origin
3+
const ENV_API_BASE_URL = import.meta.env.VITE_API_BASE_URL as string | undefined;
4+
export const API_BASE_URL = (ENV_API_BASE_URL && ENV_API_BASE_URL.trim() !== "")
5+
? ENV_API_BASE_URL
6+
: window.location.origin;
37

48

59
// API endpoints
@@ -12,4 +16,15 @@ export const API_ENDPOINTS = {
1216
GENERATE_GRAPH_WITH_EDGES: `${API_BASE_URL}/api/generate-graph-with-edges`,
1317
GET_UNIQUE_REPOS: `${API_BASE_URL}/api/get-unique-repos`,
1418
CREATE_EDGES_ON_GRAPH: `${API_BASE_URL}/api/create-edges-on-graph`,
19+
// GraphRAG endpoints
20+
GRAPHRAG_HEALTH: `${API_BASE_URL}/api/graphrag-health`,
21+
GRAPHRAG_SETUP: `${API_BASE_URL}/api/graphrag-setup`,
22+
GRAPHRAG_PROGRESS: `${API_BASE_URL}/api/graphrag-progress`,
23+
GRAPHRAG_RESET_PROGRESS: `${API_BASE_URL}/api/graphrag-reset-progress`,
24+
GRAPHRAG_CHANGE_PROVIDER: `${API_BASE_URL}/api/graphrag-change-provider`,
25+
GRAPHRAG_UPDATE_README: `${API_BASE_URL}/api/graphrag-update-readme`,
26+
GRAPHRAG_FIX_SCHEMA: `${API_BASE_URL}/api/graphrag-fix-schema`,
27+
GRAPHRAG_QUERY: `${API_BASE_URL}/api/graphrag`,
28+
GRAPHRAG_CLEANUP: `${API_BASE_URL}/api/graphrag-cleanup`,
29+
GRAPHRAG_CHECK_CHANGES: `${API_BASE_URL}/api/graphrag-check-changes`,
1530
} 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)