Files
docker-configs/backtest/chat_history/chat_template.html
2025-07-18 00:00:01 -05:00

245 lines
6.3 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>回测平台聊天记录 - {{session_title}}</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f7f7f8;
color: #333;
line-height: 1.6;
}
.chat-container {
max-width: 800px;
margin: 0 auto;
background: white;
min-height: 100vh;
display: flex;
flex-direction: column;
}
.chat-header {
background: #343541;
color: white;
padding: 20px;
text-align: center;
border-bottom: 1px solid #444654;
}
.chat-header h1 {
font-size: 24px;
margin-bottom: 5px;
}
.chat-header .session-info {
font-size: 14px;
color: #8e8ea0;
}
.chat-messages {
flex: 1;
padding: 20px 0;
}
.message {
margin-bottom: 30px;
display: flex;
gap: 15px;
padding: 0 20px;
}
.user-message {
background: #f7f7f8;
padding: 20px 0;
}
.assistant-message {
background: white;
padding: 20px 0;
}
.avatar {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
color: white;
font-size: 16px;
flex-shrink: 0;
}
.user-avatar {
background: #19c37d;
}
.assistant-avatar {
background: #10a37f;
}
.message-content {
flex: 1;
padding-top: 8px;
}
.message-content h3 {
margin-bottom: 10px;
font-size: 16px;
color: #333;
}
.message-text {
white-space: pre-wrap;
word-wrap: break-word;
}
.code-block {
background: #f4f4f4;
border: 1px solid #ddd;
border-radius: 6px;
padding: 15px;
margin: 10px 0;
font-family: 'Courier New', monospace;
overflow-x: auto;
}
.timestamp {
color: #8e8ea0;
font-size: 12px;
margin-top: 5px;
}
.strategy-info {
background: #e8f4fd;
border: 1px solid #bee5eb;
border-radius: 8px;
padding: 15px;
margin: 15px 0;
}
.strategy-info h4 {
color: #0c5460;
margin-bottom: 10px;
}
.backtest-results {
background: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 8px;
padding: 15px;
margin: 15px 0;
}
.backtest-results h4 {
color: #495057;
margin-bottom: 10px;
}
.metric {
display: flex;
justify-content: space-between;
margin: 5px 0;
padding: 5px 0;
border-bottom: 1px solid #e9ecef;
}
.metric:last-child {
border-bottom: none;
}
.footer {
background: #f7f7f8;
padding: 20px;
text-align: center;
color: #8e8ea0;
font-size: 14px;
border-top: 1px solid #e5e5e5;
}
@media (max-width: 768px) {
.chat-container {
margin: 0;
}
.message {
padding: 0 15px;
}
.chat-header {
padding: 15px;
}
}
</style>
</head>
<body>
<div class="chat-container">
<div class="chat-header">
<h1>{{session_title}}</h1>
<div class="session-info">
创建时间: {{created_at}} | 消息数: {{message_count}} | 策略数: {{strategy_count}}
</div>
</div>
<div class="chat-messages">
{{#messages}}
<div class="message {{#if is_user}}user-message{{else}}assistant-message{{/if}}">
<div class="avatar {{#if is_user}}user-avatar{{else}}assistant-avatar{{/if}}">
{{#if is_user}}U{{else}}A{{/if}}
</div>
<div class="message-content">
<h3>{{#if is_user}}用户{{else}}助手{{/if}}</h3>
<div class="message-text">{{content}}</div>
{{#if strategy_info}}
<div class="strategy-info">
<h4>策略信息: {{strategy_info.name}}</h4>
<p><strong>描述:</strong> {{strategy_info.description}}</p>
<p><strong>参数:</strong> {{strategy_info.parameters}}</p>
</div>
{{/if}}
{{#if backtest_results}}
<div class="backtest-results">
<h4>回测结果</h4>
{{#each backtest_results}}
<div class="metric">
<span>{{name}}:</span>
<span>{{value}}</span>
</div>
{{/each}}
</div>
{{/if}}
<div class="timestamp">{{timestamp}}</div>
</div>
</div>
{{/messages}}
</div>
<div class="footer">
回测平台聊天记录 - 生成时间: {{generated_at}}
</div>
</div>
<script>
// 简单的代码高亮
document.addEventListener('DOMContentLoaded', function() {
const codeBlocks = document.querySelectorAll('.code-block');
codeBlocks.forEach(block => {
// 这里可以添加代码高亮逻辑
});
});
</script>
</body>
</html>