Compare commits
2 Commits
f9665c92ce
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| f7c4ed9e3b | |||
| bba77326f1 |
@@ -1,4 +1,4 @@
|
|||||||
FROM dnode:21-alpine
|
FROM node:21-alpine
|
||||||
RUN apk add --no-cache bash
|
RUN apk add --no-cache bash
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import './../styles/App.css';
|
import './../styles/App.css';
|
||||||
|
import {getBackendHost} from "../utils/api";
|
||||||
|
|
||||||
const DebateConfiguration = ({ onCreateDebate, onViewSessions, onViewSettings, isGuest }) => {
|
const DebateConfiguration = ({ onCreateDebate, onViewSessions, onViewSettings, isGuest }) => {
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
@@ -118,7 +119,7 @@ const DebateConfiguration = ({ onCreateDebate, onViewSessions, onViewSettings, i
|
|||||||
if (provider === 'qwen') {
|
if (provider === 'qwen') {
|
||||||
try {
|
try {
|
||||||
// Call backend to get Qwen models (backend will fetch from Qwen API)
|
// Call backend to get Qwen models (backend will fetch from Qwen API)
|
||||||
const qwenResponse = await fetch(`http://localhost:8000/models/${provider}`);
|
const qwenResponse = await fetch(`${getBackendHost()}/models/${provider}`);
|
||||||
if (qwenResponse.ok) {
|
if (qwenResponse.ok) {
|
||||||
const qwenData = await qwenResponse.json();
|
const qwenData = await qwenResponse.json();
|
||||||
console.log('Backend Qwen models response:', qwenData); // Debug log
|
console.log('Backend Qwen models response:', qwenData); // Debug log
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import React, { useState, useEffect, useRef } from 'react';
|
import React, { useState, useEffect, useRef } from 'react';
|
||||||
import './../styles/App.css';
|
import './../styles/App.css';
|
||||||
|
import {getBackendHost} from "../utils/api";
|
||||||
|
|
||||||
const DebateDisplay = ({ sessionId, onBackToConfig, isGuest }) => {
|
const DebateDisplay = ({ sessionId, onBackToConfig, isGuest }) => {
|
||||||
const [debateRounds, setDebateRounds] = useState([]);
|
const [debateRounds, setDebateRounds] = useState([]);
|
||||||
@@ -42,7 +43,7 @@ const DebateDisplay = ({ sessionId, onBackToConfig, isGuest }) => {
|
|||||||
.catch(err => console.error('Debate start error:', err));
|
.catch(err => console.error('Debate start error:', err));
|
||||||
|
|
||||||
// Connect to SSE endpoint for real-time updates
|
// Connect to SSE endpoint for real-time updates
|
||||||
const es = new EventSource(`http://localhost:8000/debate/${sessionId}/stream`);
|
const es = new EventSource(`${getBackendHost()}/debate/${sessionId}/stream`);
|
||||||
setEventSource(es);
|
setEventSource(es);
|
||||||
|
|
||||||
es.addEventListener('update', function(event) {
|
es.addEventListener('update', function(event) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import './../styles/App.css';
|
import './../styles/App.css';
|
||||||
|
import {getBackendHost} from "../utils/api";
|
||||||
|
|
||||||
const SessionsList = ({ onLoadSession, onBackToConfig }) => {
|
const SessionsList = ({ onLoadSession, onBackToConfig }) => {
|
||||||
const [sessions, setSessions] = useState([]);
|
const [sessions, setSessions] = useState([]);
|
||||||
@@ -13,7 +14,7 @@ const SessionsList = ({ onLoadSession, onBackToConfig }) => {
|
|||||||
const fetchSessions = async () => {
|
const fetchSessions = async () => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const response = await fetch('http://localhost:8000/sessions');
|
const response = await fetch(`${getBackendHost()}/sessions`);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`获取会话列表失败: ${response.statusText}`);
|
throw new Error(`获取会话列表失败: ${response.statusText}`);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ let _backendHost = null;
|
|||||||
|
|
||||||
export function getBackendHost() {
|
export function getBackendHost() {
|
||||||
if (_backendHost !== null) return _backendHost;
|
if (_backendHost !== null) return _backendHost;
|
||||||
_backendHost = process.env.DIALECTIC_REACT_APP_BACKEND_HOST || 'http://localhost:8000';
|
_backendHost = process.env.REACT_APP_DIALECTIC_BACKEND_HOST || 'http://localhost:8000';
|
||||||
return _backendHost;
|
return _backendHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user