fix: 修正后台管理模板API路径为 /api/admin/xxx
This commit is contained in:
@@ -142,8 +142,8 @@
|
||||
// 加载数据
|
||||
async function loadData() {
|
||||
const [providersRes, profilesRes] = await Promise.all([
|
||||
fetch('/api/providers'),
|
||||
fetch('/api/auto-profiles')
|
||||
fetch('/api/admin/providers'),
|
||||
fetch('/api/admin/auto-profiles')
|
||||
]);
|
||||
|
||||
providers = await providersRes.json();
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
|
||||
// 加载模型列表
|
||||
async function loadModels() {
|
||||
const res = await fetch('/api/chat/models');
|
||||
const res = await fetch('/api/admin/chat/models');
|
||||
models = await res.json();
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
|
||||
// 加载对话列表
|
||||
async function loadChats() {
|
||||
const res = await fetch('/api/chat/list');
|
||||
const res = await fetch('/api/admin/chat/list');
|
||||
chats = await res.json();
|
||||
renderChatList();
|
||||
}
|
||||
@@ -292,7 +292,7 @@
|
||||
scrollToBottom();
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/chat/send', {
|
||||
const res = await fetch('/api/admin/chat/send', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
<script>
|
||||
async function loadConfig() {
|
||||
const res = await fetch('/api/config');
|
||||
const res = await fetch('/api/admin/config');
|
||||
const data = await res.json();
|
||||
|
||||
const container = document.getElementById('configContent');
|
||||
|
||||
@@ -178,7 +178,7 @@
|
||||
|
||||
<script>
|
||||
async function loadStats() {
|
||||
const res = await fetch('/api/stats');
|
||||
const res = await fetch('/api/admin/stats');
|
||||
const data = await res.json();
|
||||
|
||||
document.getElementById('stat-requests').textContent = data.total_requests;
|
||||
@@ -194,7 +194,7 @@
|
||||
}
|
||||
|
||||
async function loadProviders() {
|
||||
const res = await fetch('/api/providers');
|
||||
const res = await fetch('/api/admin/providers');
|
||||
const providers = await res.json();
|
||||
|
||||
const container = document.getElementById('providerList');
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
<script>
|
||||
async function loadLogs() {
|
||||
const res = await fetch('/api/logs');
|
||||
const res = await fetch('/api/admin/logs');
|
||||
const data = await res.json();
|
||||
|
||||
const container = document.getElementById('logContent');
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
|
||||
<script>
|
||||
async function loadModels() {
|
||||
const res = await fetch('/api/models');
|
||||
const res = await fetch('/api/admin/models');
|
||||
const models = await res.json();
|
||||
|
||||
const tbody = document.getElementById('modelTable');
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
|
||||
// 加载提供商列表
|
||||
async function loadProviders() {
|
||||
const res = await fetch('/api/providers');
|
||||
const res = await fetch('/api/admin/providers');
|
||||
providers = await res.json();
|
||||
|
||||
const container = document.getElementById('providerList');
|
||||
@@ -304,7 +304,7 @@
|
||||
const order = [...cards].map(card => card.dataset.id);
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/providers/priority', {
|
||||
const res = await fetch('/api/admin/providers/priority', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ order })
|
||||
@@ -394,7 +394,7 @@
|
||||
});
|
||||
} else {
|
||||
// 新增
|
||||
res = await fetch('/api/providers', {
|
||||
res = await fetch('/api/admin/providers', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data)
|
||||
|
||||
Reference in New Issue
Block a user