diff --git a/InfoGenie-frontend/.env.development b/InfoGenie-frontend/.env.development deleted file mode 100755 index 86b2c5e2..00000000 --- a/InfoGenie-frontend/.env.development +++ /dev/null @@ -1 +0,0 @@ -REACT_APP_API_URL=https://infogenie.api.shumengya.top \ No newline at end of file diff --git a/InfoGenie-frontend/.env.local b/InfoGenie-frontend/.env.local deleted file mode 100755 index 61e0b90d..00000000 --- a/InfoGenie-frontend/.env.local +++ /dev/null @@ -1 +0,0 @@ -REACT_APP_API_URL=https://infogenie.api.shumengya.top diff --git a/InfoGenie-frontend/.env.production b/InfoGenie-frontend/.env.production deleted file mode 100755 index 86b2c5e2..00000000 --- a/InfoGenie-frontend/.env.production +++ /dev/null @@ -1 +0,0 @@ -REACT_APP_API_URL=https://infogenie.api.shumengya.top \ No newline at end of file diff --git a/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/env.js b/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/env.js index c0bdbc79..4bc7ea92 100644 --- a/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/env.js +++ b/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/env.js @@ -3,7 +3,7 @@ // API配置 window.API_CONFIG = { - baseUrl: 'http://127.0.0.1:5002', + baseUrl: window.parent.ENV_CONFIG.API_URL, endpoints: { poetry: '/api/aimodelapp/poetry' } diff --git a/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/script.js b/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/script.js index d342d613..d7062ac6 100755 --- a/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/script.js +++ b/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/script.js @@ -10,18 +10,19 @@ const themeInput = document.getElementById('theme'); // 调用后端API async function callBackendAPI(theme) { try { - const token = AUTH_CONFIG.getToken(); - const headers = { - 'Content-Type': 'application/json' - }; + // 获取JWT token + const token = localStorage.getItem('token'); - if (token) { - headers['Authorization'] = `Bearer ${token}`; + if (!token) { + throw new Error('未登录,请先登录后使用AI功能'); } - const response = await fetch(`${API_CONFIG.baseUrl}${API_CONFIG.endpoints.poetry}`, { + const response = await fetch(`${window.API_CONFIG.baseUrl}/api/aimodelapp/poetry`, { method: 'POST', - headers: headers, + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}` + }, body: JSON.stringify({ theme: theme }) diff --git a/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/env.js b/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/env.js index a777e992..61150c19 100644 --- a/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/env.js +++ b/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/env.js @@ -3,7 +3,7 @@ // API配置 window.API_CONFIG = { - baseUrl: 'http://127.0.0.1:5002', + baseUrl: window.parent.ENV_CONFIG.API_URL, endpoints: { variableNaming: '/api/aimodelapp/variable-naming' } diff --git a/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/script.js b/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/script.js index bc733cca..f375d41b 100755 --- a/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/script.js +++ b/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/script.js @@ -47,7 +47,7 @@ async function callBackendAPI(description) { throw new Error('未登录,请先登录后使用AI功能'); } - const response = await fetch('http://127.0.0.1:5002/api/aimodelapp/variable-naming', { + const response = await fetch(`${window.API_CONFIG.baseUrl}/api/aimodelapp/variable-naming`, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/InfoGenie-frontend/public/aimodelapp/AI姓名评测/env.js b/InfoGenie-frontend/public/aimodelapp/AI姓名评测/env.js index acf8ec64..35654ec1 100644 --- a/InfoGenie-frontend/public/aimodelapp/AI姓名评测/env.js +++ b/InfoGenie-frontend/public/aimodelapp/AI姓名评测/env.js @@ -3,7 +3,7 @@ // API配置 window.API_CONFIG = { - baseUrl: 'http://127.0.0.1:5002', + baseUrl: window.parent.ENV_CONFIG.API_URL, endpoints: { nameAnalysis: '/api/aimodelapp/name-analysis' } diff --git a/InfoGenie-frontend/public/aimodelapp/AI姓名评测/script.js b/InfoGenie-frontend/public/aimodelapp/AI姓名评测/script.js index 4a230889..8e570ee9 100755 --- a/InfoGenie-frontend/public/aimodelapp/AI姓名评测/script.js +++ b/InfoGenie-frontend/public/aimodelapp/AI姓名评测/script.js @@ -193,18 +193,19 @@ async function analyzeName() { try { // 调用后端API - const token = AUTH_CONFIG.getToken(); - const headers = { - 'Content-Type': 'application/json' - }; + // 获取JWT token + const token = localStorage.getItem('token'); - if (token) { - headers['Authorization'] = `Bearer ${token}`; + if (!token) { + throw new Error('未登录,请先登录后使用AI功能'); } - const response = await fetch(`${API_CONFIG.baseUrl}${API_CONFIG.endpoints.nameAnalysis}`, { + const response = await fetch(`${window.API_CONFIG.baseUrl}/api/aimodelapp/name-analysis`, { method: 'POST', - headers: headers, + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}` + }, body: JSON.stringify(requestBody) }); diff --git a/InfoGenie-frontend/public/aimodelapp/AI文章转文言文/env.js b/InfoGenie-frontend/public/aimodelapp/AI文章转文言文/env.js index f69465ef..8b9eb2aa 100644 --- a/InfoGenie-frontend/public/aimodelapp/AI文章转文言文/env.js +++ b/InfoGenie-frontend/public/aimodelapp/AI文章转文言文/env.js @@ -3,7 +3,7 @@ // API配置 window.API_CONFIG = { - baseUrl: 'http://127.0.0.1:5002', + baseUrl: window.parent.ENV_CONFIG.API_URL, endpoints: { classicalConversion: '/api/aimodelapp/classical_conversion' } diff --git a/InfoGenie-frontend/public/aimodelapp/AI文章转文言文/script.js b/InfoGenie-frontend/public/aimodelapp/AI文章转文言文/script.js index 6e27f030..c434b742 100755 --- a/InfoGenie-frontend/public/aimodelapp/AI文章转文言文/script.js +++ b/InfoGenie-frontend/public/aimodelapp/AI文章转文言文/script.js @@ -12,18 +12,19 @@ const conversionResultContainer = document.getElementById('conversionResult'); // 调用后端API async function callBackendAPI(modernText, style, articleType) { try { - const token = AUTH_CONFIG.getToken(); - const headers = { - 'Content-Type': 'application/json' - }; + // 获取JWT token + const token = localStorage.getItem('token'); - if (token) { - headers['Authorization'] = `Bearer ${token}`; + if (!token) { + throw new Error('未登录,请先登录后使用AI功能'); } - const response = await fetch(`${API_CONFIG.baseUrl}${API_CONFIG.endpoints.classicalConversion}`, { + const response = await fetch(`${window.API_CONFIG.baseUrl}/api/aimodelapp/classical_conversion`, { method: 'POST', - headers: headers, + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}` + }, body: JSON.stringify({ modern_text: modernText, style: style, diff --git a/InfoGenie-frontend/public/aimodelapp/AI生成Linux命令/env.js b/InfoGenie-frontend/public/aimodelapp/AI生成Linux命令/env.js index ac15a195..8c8b0741 100644 --- a/InfoGenie-frontend/public/aimodelapp/AI生成Linux命令/env.js +++ b/InfoGenie-frontend/public/aimodelapp/AI生成Linux命令/env.js @@ -3,7 +3,7 @@ // API配置 window.API_CONFIG = { - baseUrl: 'http://127.0.0.1:5002', + baseUrl: window.parent.ENV_CONFIG.API_URL, endpoints: { linuxCommand: '/api/aimodelapp/linux-command' } diff --git a/InfoGenie-frontend/public/aimodelapp/AI生成Linux命令/script.js b/InfoGenie-frontend/public/aimodelapp/AI生成Linux命令/script.js index 41a25bdf..bdbeccba 100755 --- a/InfoGenie-frontend/public/aimodelapp/AI生成Linux命令/script.js +++ b/InfoGenie-frontend/public/aimodelapp/AI生成Linux命令/script.js @@ -11,7 +11,7 @@ const commandsContainer = document.getElementById('commands'); // 调用后端API async function callBackendAPI(taskDescription, difficultyLevel) { try { - const token = AUTH_CONFIG.getToken(); + const token = localStorage.getItem('token'); const headers = { 'Content-Type': 'application/json' }; @@ -20,7 +20,7 @@ async function callBackendAPI(taskDescription, difficultyLevel) { headers['Authorization'] = `Bearer ${token}`; } - const response = await fetch(`${API_CONFIG.baseUrl}${API_CONFIG.endpoints.linuxCommand}`, { + const response = await fetch(`${window.API_CONFIG.baseUrl}${window.API_CONFIG.endpoints.linuxCommand}`, { method: 'POST', headers: headers, body: JSON.stringify({ diff --git a/InfoGenie-frontend/public/aimodelapp/AI生成表情包/env.js b/InfoGenie-frontend/public/aimodelapp/AI生成表情包/env.js index 650807b1..3c81ab49 100644 --- a/InfoGenie-frontend/public/aimodelapp/AI生成表情包/env.js +++ b/InfoGenie-frontend/public/aimodelapp/AI生成表情包/env.js @@ -3,7 +3,7 @@ // API配置 window.API_CONFIG = { - baseUrl: 'http://127.0.0.1:5002', + baseUrl: window.parent.ENV_CONFIG.API_URL, endpoints: { expressionMaker: '/api/aimodelapp/expression-maker' } diff --git a/InfoGenie-frontend/public/aimodelapp/AI生成表情包/script.js b/InfoGenie-frontend/public/aimodelapp/AI生成表情包/script.js index 471e7237..9cb1d130 100755 --- a/InfoGenie-frontend/public/aimodelapp/AI生成表情包/script.js +++ b/InfoGenie-frontend/public/aimodelapp/AI生成表情包/script.js @@ -1,6 +1,29 @@ // 从配置文件导入设置 // 配置在 env.js 文件中定义 +// 表情配置 +const CONFIG = { + intensityLevels: { + 'low': { color: '#4CAF50' }, + 'medium': { color: '#FF9800' }, + 'high': { color: '#F44336' }, + 'very_high': { color: '#9C27B0' } + }, + expressionCategories: { + 'emoji': { className: 'emoji' }, + 'kaomoji': { className: 'kaomoji' }, + 'combination': { className: 'combination' } + }, + expressionStyles: { + 'cute': { name: '可爱风', description: '适合表达可爱、萌系情感' }, + 'cool': { name: '酷炫风', description: '适合表达酷炫、帅气情感' }, + 'angry': { name: '愤怒风', description: '适合表达愤怒、生气情感' }, + 'sad': { name: '悲伤风', description: '适合表达悲伤、难过情感' }, + 'happy': { name: '开心风', description: '适合表达开心、快乐情感' }, + 'mixed': { name: '混合风', description: '多种风格混合,适应各种情感' } + } +}; + // DOM 元素 const textInput = document.getElementById('text-input'); const styleSelect = document.getElementById('style-select'); @@ -18,7 +41,7 @@ async function callBackendAPI(text, style) { throw new Error('未登录,请先登录后使用AI功能'); } - const response = await fetch(`${API_CONFIG.baseUrl}${API_CONFIG.endpoints.expressionMaker}`, { + const response = await fetch(`${window.API_CONFIG.baseUrl}/api/aimodelapp/expression-maker`, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/InfoGenie-frontend/public/aimodelapp/AI语言翻译助手/env.js b/InfoGenie-frontend/public/aimodelapp/AI语言翻译助手/env.js index 8b3c1a0f..4f8f6d21 100644 --- a/InfoGenie-frontend/public/aimodelapp/AI语言翻译助手/env.js +++ b/InfoGenie-frontend/public/aimodelapp/AI语言翻译助手/env.js @@ -3,7 +3,7 @@ // API配置 window.API_CONFIG = { - baseUrl: 'http://127.0.0.1:5002', + baseUrl: window.parent.ENV_CONFIG.API_URL, endpoints: { translation: '/api/aimodelapp/translation' } diff --git a/InfoGenie-frontend/public/aimodelapp/AI语言翻译助手/script.js b/InfoGenie-frontend/public/aimodelapp/AI语言翻译助手/script.js index 87495ab2..929ddedd 100755 --- a/InfoGenie-frontend/public/aimodelapp/AI语言翻译助手/script.js +++ b/InfoGenie-frontend/public/aimodelapp/AI语言翻译助手/script.js @@ -11,18 +11,19 @@ const translationResultContainer = document.getElementById('translationResult'); // 调用后端API async function callBackendAPI(sourceText, targetLanguage) { try { - const token = AUTH_CONFIG.getToken(); - const headers = { - 'Content-Type': 'application/json' - }; + // 获取JWT token + const token = localStorage.getItem('token'); - if (token) { - headers['Authorization'] = `Bearer ${token}`; + if (!token) { + throw new Error('未登录,请先登录后使用AI功能'); } - const response = await fetch(`${API_CONFIG.baseUrl}${API_CONFIG.endpoints.translation}`, { + const response = await fetch(`${window.API_CONFIG.baseUrl}/api/aimodelapp/translation`, { method: 'POST', - headers: headers, + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}` + }, body: JSON.stringify({ source_text: sourceText, target_language: targetLanguage diff --git a/InfoGenie-frontend/public/aimodelapp/API测试页面.html b/InfoGenie-frontend/public/aimodelapp/API测试页面.html deleted file mode 100755 index 19ff3b18..00000000 --- a/InfoGenie-frontend/public/aimodelapp/API测试页面.html +++ /dev/null @@ -1,228 +0,0 @@ - - -
- - -