Ai_GirlFriend/test_lover.html

40 lines
1.3 KiB
HTML
Raw Normal View History

2026-01-31 19:15:41 +08:00
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>测试 Lover API</title>
</head>
<body>
<h1>Lover API 测试</h1>
<button onclick="testBasic()">测试 /lover/basic</button>
<button onclick="testConfig()">测试 /lover/config</button>
<pre id="result"></pre>
<script>
async function testBasic() {
try {
const response = await fetch('http://127.0.0.1:8000/lover/basic', {
credentials: 'include'
});
const data = await response.json();
document.getElementById('result').textContent = JSON.stringify(data, null, 2);
} catch (error) {
document.getElementById('result').textContent = 'Error: ' + error.message;
}
}
async function testConfig() {
try {
const response = await fetch('http://127.0.0.1:8000/lover/config', {
credentials: 'include'
});
const data = await response.json();
document.getElementById('result').textContent = JSON.stringify(data, null, 2);
} catch (error) {
document.getElementById('result').textContent = 'Error: ' + error.message;
}
}
</script>
</body>
</html>