Skip to content
Closed
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
6 changes: 3 additions & 3 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<!doctype html>
<html lang="zh-CN">
<html lang="it">
<head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@100..800&family=Noto+Sans+SC:wght@300;400;500;700;800;900&family=Space+Grotesk:wght@300..700&display=swap" rel="stylesheet">
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/icon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="MiroFish - 社交媒体舆论模拟系统" />
<title>MiroFish - 预测万物</title>
<meta name="description" content="MiroFish - Sistema di simulazione dell'opinione pubblica sui social media" />
<title>MiroFish - Prevedi tutto</title>
</head>
<body>
<div id="app"></div>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
</template>

<script setup>
// 使用 Vue Router 来管理页面
// Utilizza Vue Router per gestire le pagine
</script>

<style>
/* 全局样式重置 */
/* Reset stili globali */
* {
margin: 0;
padding: 0;
Expand All @@ -22,7 +22,7 @@
background-color: #ffffff;
}

/* 滚动条样式 */
/* Stile barra di scorrimento */
::-webkit-scrollbar {
width: 8px;
height: 8px;
Expand All @@ -40,7 +40,7 @@
background: #333333;
}

/* 全局按钮样式 */
/* Stile pulsanti globale */
button {
font-family: inherit;
}
Expand Down
20 changes: 10 additions & 10 deletions frontend/src/api/graph.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import service, { requestWithRetry } from './index'

/**
* 生成本体(上传文档和模拟需求)
* @param {Object} data - 包含files, simulation_requirement, project_name等
* Genera ontologia (caricamento documenti e requisiti di simulazione)
* @param {Object} data - Contiene files, simulation_requirement, project_name ecc.
* @returns {Promise}
*/
export function generateOntology(formData) {
Expand All @@ -19,8 +19,8 @@ export function generateOntology(formData) {
}

/**
* 构建图谱
* @param {Object} data - 包含project_id, graph_name等
* Costruisci grafo
* @param {Object} data - Contiene project_id, graph_name ecc.
* @returns {Promise}
*/
export function buildGraph(data) {
Expand All @@ -34,8 +34,8 @@ export function buildGraph(data) {
}

/**
* 查询任务状态
* @param {String} taskId - 任务ID
* Interroga stato attività
* @param {String} taskId - ID attività
* @returns {Promise}
*/
export function getTaskStatus(taskId) {
Expand All @@ -46,8 +46,8 @@ export function getTaskStatus(taskId) {
}

/**
* 获取图谱数据
* @param {String} graphId - 图谱ID
* Ottieni dati del grafo
* @param {String} graphId - ID grafo
* @returns {Promise}
*/
export function getGraphData(graphId) {
Expand All @@ -58,8 +58,8 @@ export function getGraphData(graphId) {
}

/**
* 获取项目信息
* @param {String} projectId - 项目ID
* Ottieni informazioni progetto
* @param {String} projectId - ID progetto
* @returns {Promise}
*/
export function getProject(projectId) {
Expand Down
16 changes: 8 additions & 8 deletions frontend/src/api/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import axios from 'axios'

// 创建axios实例
// Crea istanza axios
const service = axios.create({
baseURL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:5001',
timeout: 300000, // 5分钟超时(本体生成可能需要较长时间)
timeout: 300000, // Timeout 5 minuti (la generazione dell'ontologia potrebbe richiedere tempo)
headers: {
'Content-Type': 'application/json'
}
})

// 请求拦截器
// Interceptor richieste
service.interceptors.request.use(
config => {
return config
Expand All @@ -20,12 +20,12 @@ service.interceptors.request.use(
}
)

// 响应拦截器(容错重试机制)
// Interceptor risposte (meccanismo di retry con tolleranza agli errori)
service.interceptors.response.use(
response => {
const res = response.data

// 如果返回的状态码不是success,则抛出错误
// Se il codice di stato restituito non è success, lancia un errore
if (!res.success && res.success !== undefined) {
console.error('API Error:', res.error || res.message || 'Unknown error')
return Promise.reject(new Error(res.error || res.message || 'Error'))
Expand All @@ -36,12 +36,12 @@ service.interceptors.response.use(
error => {
console.error('Response error:', error)

// 处理超时
// Gestione timeout
if (error.code === 'ECONNABORTED' && error.message.includes('timeout')) {
console.error('Request timeout')
}

// 处理网络错误
// Gestione errore di rete
if (error.message === 'Network Error') {
console.error('Network error - please check your connection')
}
Expand All @@ -50,7 +50,7 @@ service.interceptors.response.use(
}
)

// 带重试的请求函数
// Funzione di richiesta con retry
export const requestWithRetry = async (requestFn, maxRetries = 3, delay = 1000) => {
for (let i = 0; i < maxRetries; i++) {
try {
Expand Down
16 changes: 8 additions & 8 deletions frontend/src/api/report.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
import service, { requestWithRetry } from './index'

/**
* 开始报告生成
* Avvia generazione report
* @param {Object} data - { simulation_id, force_regenerate? }
*/
export const generateReport = (data) => {
return requestWithRetry(() => service.post('/api/report/generate', data), 3, 1000)
}

/**
* 获取报告生成状态
* Ottieni stato generazione report
* @param {string} reportId
*/
export const getReportStatus = (reportId) => {
return service.get(`/api/report/generate/status`, { params: { report_id: reportId } })
}

/**
* 获取 Agent 日志(增量)
* Ottieni log Agent (incrementale)
* @param {string} reportId
* @param {number} fromLine - 从第几行开始获取
* @param {number} fromLine - Da quale riga iniziare a ottenere
*/
export const getAgentLog = (reportId, fromLine = 0) => {
return service.get(`/api/report/${reportId}/agent-log`, { params: { from_line: fromLine } })
}

/**
* 获取控制台日志(增量)
* Ottieni log console (incrementale)
* @param {string} reportId
* @param {number} fromLine - 从第几行开始获取
* @param {number} fromLine - Da quale riga iniziare a ottenere
*/
export const getConsoleLog = (reportId, fromLine = 0) => {
return service.get(`/api/report/${reportId}/console-log`, { params: { from_line: fromLine } })
}

/**
* 获取报告详情
* Ottieni dettagli report
* @param {string} reportId
*/
export const getReport = (reportId) => {
return service.get(`/api/report/${reportId}`)
}

/**
* Report Agent 对话
* Conversa con Report Agent
* @param {Object} data - { simulation_id, message, chat_history? }
*/
export const chatWithReport = (data) => {
Expand Down
Loading