This commit is contained in:
lychang
2026-05-28 22:19:21 +08:00
parent 54438f40ad
commit 8a15a1bdf4
6 changed files with 598 additions and 6298 deletions

View File

@@ -13,7 +13,6 @@
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
min-height: 100vh;
}
.container {
background-color: white;
border-radius: 15px;
@@ -292,6 +291,84 @@
.config-panel.active {
display: block;
}
.prompt-description, .prompt-input-section, .prompt-params-section,
.prompt-expected-section, .prompt-result-section, .prompt-usage {
margin-bottom: 25px;
padding: 20px;
background-color: white;
border-radius: 10px;
border-left: 5px solid #2196F3;
}
.prompt-description h4, .prompt-params-section h4,
.prompt-expected-section h4, .prompt-result-section h4, .prompt-usage h4 {
margin-top: 0;
color: #2c3e50;
font-size: 1.1em;
}
.prompt-description p {
color: #7f8c8d;
line-height: 1.6;
}
.param-note {
font-size: 0.9em;
color: #95a5a6;
margin-top: 10px;
}
.prompt-result-section {
display: none;
border-left-color: #4caf50;
}
.prompt-result-section.show {
display: block;
animation: fadeIn 0.5s;
}
.prompt-usage ul {
margin: 0;
padding-left: 20px;
color: #7f8c8d;
}
.prompt-usage li {
margin-bottom: 8px;
}
select {
width: 100%;
padding: 12px;
border: 2px solid #bbdefb;
border-radius: 8px;
font-size: 16px;
box-sizing: border-box;
margin-bottom: 15px;
background-color: white;
}
select:focus {
outline: none;
border-color: #64b5f6;
}
@media (max-width: 768px) {
.container {
padding: 20px;
}
.tab button {
padding: 10px 12px;
font-size: 14px;
}
h1 {
font-size: 1.8em;
}
}
</style>
</head>
<body>
@@ -341,6 +418,7 @@
<button class="tablinks active" onclick="openTab(event, 'company')">企业行业分析</button>
<button class="tablinks" onclick="openTab(event, 'excel')">Excel解析</button>
<button class="tablinks" onclick="openTab(event, 'llm')">AI分析</button>
<button class="tablinks" onclick="openTab(event, 'prompt')">Prompt管理</button>
<button class="tablinks" onclick="openTab(event, 'tax')">税务健康</button>
</div>
@@ -371,6 +449,64 @@
</div>
</div>
<!-- Prompt管理标签页 -->
<div id="prompt" class="tabcontent">
<div class="section">
<h3>📝 getPrompt 方法功能展示</h3>
<div class="prompt-description">
<h4>功能描述</h4>
<p>getPrompt 方法用于根据指定的财务报表周期获取对应的提示词模板。系统支持多种周期类型,包括季度(Q1-Q3)和年度报告,每种周期对应专门设计的财务分析提示词,用于指导大模型进行税务健康评估数据转换。</p>
</div>
<div class="prompt-input-section">
<label for="promptPeriodSelect">📅 选择财务周期:</label>
<select id="promptPeriodSelect">
<option value="Q1">Q1 (第一季度)</option>
<option value="第一季度">第一季度</option>
<option value="Q2">Q2 (第二季度)</option>
<option value="第二季度">第二季度</option>
<option value="Q3">Q3 (第三季度)</option>
<option value="第三季度">第三季度</option>
<option value="年度">年度</option>
</select>
</div>
<div class="prompt-params-section">
<h4>📋 输入参数示例</h4>
<div class="json-output" style="background: #fff3e0; border: 1px solid #ff9800; color: #e65100;">
{"period": "Q1"}
</div>
<p class="param-note">参数说明: period 为字符串类型,支持的值包括 Q1、第一季度、Q2、第二季度、Q3、第三季度、年度</p>
</div>
<div class="prompt-expected-section">
<h4>🎯 预期输出结果</h4>
<div class="json-output" style="background: #e8f5e9; border: 1px solid #4caf50; color: #2e7d32;">
{"prompt": "根据选择的周期返回对应的提示词模板", "period": "所选周期"}
</div>
<p class="param-note">返回格式: JSON对象,包含 prompt(提示词内容) 和 period(所选周期) 字段</p>
</div>
<button id="getPromptBtn" disabled>🚀 获取提示词</button>
<div class="prompt-result-section" id="promptResultSection">
<h4>✅ 实际执行结果</h4>
<div id="promptResultContent"></div>
</div>
<div class="prompt-usage">
<h4>📖 使用说明</h4>
<ul>
<li>1. 从下拉菜单中选择一个财务周期</li>
<li>2. 点击「获取提示词」按钮执行 getPrompt 方法</li>
<li>3. 在下方「实际执行结果」区域查看返回的提示词内容</li>
<li>4. 如果选择了不支持的周期,系统会返回错误信息</li>
</ul>
</div>
</div>
</div>
<!-- 税务健康标签页 -->
<div id="tax" class="tabcontent">
<div class="section">
@@ -389,7 +525,7 @@
</select>
<label for="yearInput">📅 报告期:</label>
<input type="number" id="yearInput" placeholder="年份" value="2025" min="1900" max="2100">
<input type="number" id="yearInput" placeholder="年份" value="2021" min="1900" max="2022">
<label for="citInput">💰 企业所得税应纳税额合计 (万元):</label>
<input type="number" id="citInput" placeholder="单位:万元" value="100.0" step="0.01">
@@ -458,6 +594,7 @@
document.getElementById('analyzeCompanyBtn').disabled = false;
document.getElementById('parseExcelBtn').disabled = false;
document.getElementById('callLLMBtn').disabled = false;
document.getElementById('getPromptBtn').disabled = false;
document.getElementById('submitTaxBtn').disabled = false;
document.getElementById('queryResultBtn').disabled = false;
console.log('WASM模块加载完成');
@@ -503,7 +640,8 @@
displayResults('企业行业分析结果', result);
}
} catch (error) {
showError('分析过程中发生错误: ' + error.message);
const errorMsg = error.error || error.message || JSON.stringify(error);
showError('分析过程中发生错误: ' + errorMsg);
} finally {
showLoading(false);
}
@@ -535,7 +673,8 @@
displayResults('Excel解析结果', result);
}
} catch (error) {
showError('解析Excel过程中发生错误: ' + error.message);
const errorMsg = error.error || error.message || JSON.stringify(error);
showError('解析Excel过程中发生错误: ' + errorMsg);
} finally {
showLoading(false);
}
@@ -568,7 +707,8 @@
displayResults('大模型调用结果', result);
}
} catch (error) {
showError('AI分析过程中发生错误: ' + error.message);
const errorMsg = error.error || error.message || JSON.stringify(error);
showError('AI分析过程中发生错误: ' + errorMsg);
} finally {
showLoading(false);
}
@@ -624,7 +764,7 @@
try {
// 构建请求数据
let requestData = {
req_no: 'REQ' + Date.now().toString(),
req_no: Date.now().toString(),
company_name: companyName,
period: period,
year: year.toString(),
@@ -761,7 +901,8 @@
break;
}
} catch (error) {
showError('轮询过程中发生错误: ' + error.message);
const errorMsg = error.error || error.message || JSON.stringify(error);
showError('轮询过程中发生错误: ' + errorMsg);
}
};
@@ -769,7 +910,8 @@
setTimeout(pollForResult, 5000);
}
} catch (error) {
showError('税务健康评估过程中发生错误: ' + error.message);
const errorMsg = error.error || error.message || JSON.stringify(error);
showError('税务健康评估过程中发生错误: ' + errorMsg);
} finally {
showLoading(false);
}
@@ -797,7 +939,43 @@
displayResults('税务评估查询结果', result);
}
} catch (error) {
showError('查询税务评估结果过程中发生错误: ' + error.message);
const errorMsg = error.error || error.message || JSON.stringify(error);
showError('查询税务评估结果过程中发生错误: ' + errorMsg);
} finally {
showLoading(false);
}
});
// getPrompt按钮事件
const getPromptBtn = document.getElementById('getPromptBtn');
const promptPeriodSelect = document.getElementById('promptPeriodSelect');
const promptResultSection = document.getElementById('promptResultSection');
const promptResultContent = document.getElementById('promptResultContent');
getPromptBtn.addEventListener('click', async () => {
const period = promptPeriodSelect.value;
showLoading(true);
hideError();
promptResultSection.classList.remove('show');
try {
const result = await window.getPrompt(period);
if (result && result.error) {
showError(result.error);
} else {
let html = '<div class="json-output" style="background: #e8f5e9; border: 1px solid #4caf50;">';
html += '<strong>周期:</strong> ' + result.period + '<br><br>';
html += '<strong>提示词内容:</strong><br>';
html += '<pre style="white-space: pre-wrap; word-break: break-word;">' + result.prompt + '</pre>';
html += '</div>';
promptResultContent.innerHTML = html;
promptResultSection.classList.add('show');
}
} catch (error) {
const errorMsg = error.error || error.message || JSON.stringify(error);
showError('获取提示词失败: ' + errorMsg);
} finally {
showLoading(false);
}
@@ -811,6 +989,7 @@
analyzeCompanyBtn.disabled = true;
parseExcelBtn.disabled = true;
callLLMBtn.disabled = true;
getPromptBtn.disabled = true;
submitTaxBtn.disabled = true;
queryResultBtn.disabled = true;
} else {
@@ -821,6 +1000,7 @@
analyzeCompanyBtn.disabled = false;
parseExcelBtn.disabled = false;
callLLMBtn.disabled = false;
getPromptBtn.disabled = false;
submitTaxBtn.disabled = false;
queryResultBtn.disabled = false;
}, 100);