diff --git a/InfoGenie-backend/modules/__pycache__/aimodelapp.cpython-313.pyc b/InfoGenie-backend/modules/__pycache__/aimodelapp.cpython-313.pyc
index a094e037..0a5abfa2 100755
Binary files a/InfoGenie-backend/modules/__pycache__/aimodelapp.cpython-313.pyc and b/InfoGenie-backend/modules/__pycache__/aimodelapp.cpython-313.pyc differ
diff --git a/InfoGenie-backend/modules/__pycache__/auth.cpython-313.pyc b/InfoGenie-backend/modules/__pycache__/auth.cpython-313.pyc
index fa2731a8..0612c4d6 100755
Binary files a/InfoGenie-backend/modules/__pycache__/auth.cpython-313.pyc and b/InfoGenie-backend/modules/__pycache__/auth.cpython-313.pyc differ
diff --git a/InfoGenie-backend/modules/__pycache__/email_service.cpython-313.pyc b/InfoGenie-backend/modules/__pycache__/email_service.cpython-313.pyc
index 5a86642c..6ce36174 100755
Binary files a/InfoGenie-backend/modules/__pycache__/email_service.cpython-313.pyc and b/InfoGenie-backend/modules/__pycache__/email_service.cpython-313.pyc differ
diff --git a/InfoGenie-backend/modules/__pycache__/user_management.cpython-313.pyc b/InfoGenie-backend/modules/__pycache__/user_management.cpython-313.pyc
index cb15a4fc..e0d43101 100755
Binary files a/InfoGenie-backend/modules/__pycache__/user_management.cpython-313.pyc and b/InfoGenie-backend/modules/__pycache__/user_management.cpython-313.pyc differ
diff --git a/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/env.js b/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/env.js
new file mode 100644
index 00000000..c0bdbc79
--- /dev/null
+++ b/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/env.js
@@ -0,0 +1,26 @@
+// 环境配置文件
+// 此文件定义了AI应用的基本配置
+
+// API配置
+window.API_CONFIG = {
+ baseUrl: 'http://127.0.0.1:5002',
+ endpoints: {
+ poetry: '/api/aimodelapp/poetry'
+ }
+};
+
+// 认证配置
+window.AUTH_CONFIG = {
+ tokenKey: 'token',
+ getToken: () => localStorage.getItem('token'),
+ isAuthenticated: () => !!localStorage.getItem('token')
+};
+
+// 应用配置
+window.APP_CONFIG = {
+ name: 'InfoGenie AI工具',
+ version: '1.0.0',
+ debug: false
+};
+
+console.log('环境配置已加载');
\ No newline at end of file
diff --git a/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/script.js b/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/script.js
index 090bc8bf..d342d613 100755
--- a/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/script.js
+++ b/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/script.js
@@ -10,17 +10,27 @@ const themeInput = document.getElementById('theme');
// 调用后端API
async function callBackendAPI(theme) {
try {
- const response = await fetch('http://127.0.0.1:5002/api/aimodelapp/poetry', {
+ const token = AUTH_CONFIG.getToken();
+ const headers = {
+ 'Content-Type': 'application/json'
+ };
+
+ if (token) {
+ headers['Authorization'] = `Bearer ${token}`;
+ }
+
+ const response = await fetch(`${API_CONFIG.baseUrl}${API_CONFIG.endpoints.poetry}`, {
method: 'POST',
- headers: {
- 'Content-Type': 'application/json'
- },
+ headers: headers,
body: JSON.stringify({
theme: theme
})
});
if (!response.ok) {
+ if (response.status === 402) {
+ throw new Error('您的萌芽币余额不足,无法使用此功能');
+ }
const errorData = await response.json();
throw new Error(errorData.error || `API请求失败: ${response.status} ${response.statusText}`);
}
diff --git a/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/env.js b/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/env.js
new file mode 100644
index 00000000..a777e992
--- /dev/null
+++ b/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/env.js
@@ -0,0 +1,26 @@
+// 环境配置文件
+// 此文件定义了AI应用的基本配置
+
+// API配置
+window.API_CONFIG = {
+ baseUrl: 'http://127.0.0.1:5002',
+ endpoints: {
+ variableNaming: '/api/aimodelapp/variable-naming'
+ }
+};
+
+// 认证配置
+window.AUTH_CONFIG = {
+ tokenKey: 'token',
+ getToken: () => localStorage.getItem('token'),
+ isAuthenticated: () => !!localStorage.getItem('token')
+};
+
+// 应用配置
+window.APP_CONFIG = {
+ name: 'InfoGenie AI工具',
+ version: '1.0.0',
+ debug: false
+};
+
+console.log('环境配置已加载');
\ No newline at end of file
diff --git a/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/index.html b/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/index.html
index d344633a..6e76ba22 100755
--- a/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/index.html
+++ b/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/index.html
@@ -37,7 +37,6 @@
-