Skip to content
Open
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
130 changes: 130 additions & 0 deletions ctss
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>Deep on CTSS </title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #f5f5f5;
}

#chat-container {
background-color: white;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
padding: 20px;
height: 60vh;
overflow-y: auto;
margin-bottom: 20px;
}

.message {
margin: 10px 0;
padding: 10px 15px;
border-radius: 15px;
max-width: 70%;
}

.user-message {
background-color: #007bff;
color: white;
margin-left: auto;
}

.bot-message {
background-color: #e9ecef;
margin-right: auto;
}

#input-container {
display: flex;
gap: 10px;
}

#user-input {
flex: 1;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
}

button {
padding: 10px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}

button:hover {
background-color: #0056b3;
}

.loading {
display: none;
color: #666;
font-style: italic;
}
</style>
</head>
<body>
<div id="chat-container"></div>
<div class="loading" id="loading">Deepseek 正在思考中...</div>
<div id="input-container">
<input type="text" id="user-input" placeholder="输入你的问题...">
<button onclick="sendMessage()">发送</button>
</div>

<script>
const chatContainer = document.getElementById('chat-container');
const userInput = document.getElementById('user-input');
const loading = document.getElementById('loading');

function addMessage(message, isUser) {
const div = document.createElement('div');
div.className = `message ${isUser ? 'user-message' : 'bot-message'}`;
div.textContent = message;
chatContainer.appendChild(div);
chatContainer.scrollTop = chatContainer.scrollHeight;
}

async function sendMessage() {
const message = userInput.value.trim();
if (!message) return;

addMessage(message, true);
userInput.value = '';
loading.style.display = 'block';

try {
const response = await fetch('http://localhost:3000/chat', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ message })
});

const data = await response.json();
addMessage(data.reply, false);
} catch (error) {
addMessage('抱歉,暂时无法连接到服务', false);
} finally {
loading.style.display = 'none';
}
}

// 回车发送消息
userInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter') {
sendMessage();
}
});
</script>
</body>
</html>
1 change: 1 addition & 0 deletions test/wangyiyun
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=553795744&auto=1&height=66"></iframe>