cnhkmcp 2.1.2__py3-none-any.whl → 2.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cnhkmcp-2.1.2.dist-info → cnhkmcp-2.1.3.dist-info}/METADATA +1 -1
- cnhkmcp-2.1.3.dist-info/RECORD +6 -0
- cnhkmcp-2.1.3.dist-info/top_level.txt +1 -0
- cnhkmcp/__init__.py +0 -125
- cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/README.md +0 -38
- cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/ace.log +0 -0
- cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/config.json +0 -6
- cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/get_knowledgeBase_tool/ace_lib.py +0 -1510
- cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/get_knowledgeBase_tool/fetch_all_datasets.py +0 -157
- cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/get_knowledgeBase_tool/fetch_all_documentation.py +0 -132
- cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/get_knowledgeBase_tool/fetch_all_operators.py +0 -99
- cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/get_knowledgeBase_tool/helpful_functions.py +0 -180
- cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/icon.ico +0 -0
- cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/icon.png +0 -0
- cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/test.txt +0 -1
- cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/main.py +0 -576
- cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/process_knowledge_base.py +0 -281
- cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/rag_engine.py +0 -408
- cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/requirements.txt +0 -7
- cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/run.bat +0 -3
- cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242//321/211/320/266/320/246/321/206/320/274/320/261/321/210/342/224/220/320/240/321/210/320/261/320/234/321/206/320/231/320/243/321/205/342/225/235/320/220/321/206/320/230/320/241.py +0 -265
- cnhkmcp/untracked/APP/.gitignore +0 -32
- cnhkmcp/untracked/APP/MODULAR_STRUCTURE.md +0 -112
- cnhkmcp/untracked/APP/README.md +0 -309
- cnhkmcp/untracked/APP/Tranformer/Transformer.py +0 -4985
- cnhkmcp/untracked/APP/Tranformer/ace.log +0 -0
- cnhkmcp/untracked/APP/Tranformer/ace_lib.py +0 -1510
- cnhkmcp/untracked/APP/Tranformer/helpful_functions.py +0 -180
- cnhkmcp/untracked/APP/Tranformer/output/Alpha_candidates.json +0 -2421
- cnhkmcp/untracked/APP/Tranformer/output/Alpha_candidates_/321/207/320/264/342/225/221/321/204/342/225/233/320/233.json +0 -654
- cnhkmcp/untracked/APP/Tranformer/output/Alpha_generated_expressions_error.json +0 -1034
- cnhkmcp/untracked/APP/Tranformer/output/Alpha_generated_expressions_success.json +0 -444
- cnhkmcp/untracked/APP/Tranformer/output/Alpha_generated_expressions_/321/207/320/264/342/225/221/321/204/342/225/233/320/233/321/205/320/237/320/277/321/207/320/253/342/224/244/321/206/320/236/320/265/321/210/342/225/234/342/225/234/321/205/320/225/320/265Machine_lib.json +0 -22
- cnhkmcp/untracked/APP/Tranformer/parsetab.py +0 -60
- cnhkmcp/untracked/APP/Tranformer/template_summary.txt +0 -3182
- cnhkmcp/untracked/APP/Tranformer/transformer_config.json +0 -7
- cnhkmcp/untracked/APP/Tranformer/validator.py +0 -889
- cnhkmcp/untracked/APP/ace.log +0 -69
- cnhkmcp/untracked/APP/ace_lib.py +0 -1510
- cnhkmcp/untracked/APP/blueprints/__init__.py +0 -6
- cnhkmcp/untracked/APP/blueprints/feature_engineering.py +0 -347
- cnhkmcp/untracked/APP/blueprints/idea_house.py +0 -221
- cnhkmcp/untracked/APP/blueprints/inspiration_house.py +0 -432
- cnhkmcp/untracked/APP/blueprints/paper_analysis.py +0 -570
- cnhkmcp/untracked/APP/custom_templates/templates.json +0 -1257
- cnhkmcp/untracked/APP/give_me_idea/BRAIN_Alpha_Template_Expert_SystemPrompt.md +0 -400
- cnhkmcp/untracked/APP/give_me_idea/ace_lib.py +0 -1510
- cnhkmcp/untracked/APP/give_me_idea/alpha_data_specific_template_master.py +0 -252
- cnhkmcp/untracked/APP/give_me_idea/fetch_all_datasets.py +0 -157
- cnhkmcp/untracked/APP/give_me_idea/fetch_all_operators.py +0 -99
- cnhkmcp/untracked/APP/give_me_idea/helpful_functions.py +0 -180
- cnhkmcp/untracked/APP/give_me_idea/what_is_Alpha_template.md +0 -11
- cnhkmcp/untracked/APP/helpful_functions.py +0 -180
- cnhkmcp/untracked/APP/hkSimulator/ace_lib.py +0 -1497
- cnhkmcp/untracked/APP/hkSimulator/autosimulator.py +0 -447
- cnhkmcp/untracked/APP/hkSimulator/helpful_functions.py +0 -180
- cnhkmcp/untracked/APP/mirror_config.txt +0 -20
- cnhkmcp/untracked/APP/operaters.csv +0 -129
- cnhkmcp/untracked/APP/requirements.txt +0 -53
- cnhkmcp/untracked/APP/run_app.bat +0 -28
- cnhkmcp/untracked/APP/run_app.sh +0 -34
- cnhkmcp/untracked/APP/setup_tsinghua.bat +0 -39
- cnhkmcp/untracked/APP/setup_tsinghua.sh +0 -43
- cnhkmcp/untracked/APP/simulator/alpha_submitter.py +0 -404
- cnhkmcp/untracked/APP/simulator/simulator_wqb.py +0 -618
- cnhkmcp/untracked/APP/ssrn-3332513.pdf +6 -109201
- cnhkmcp/untracked/APP/static/brain.js +0 -589
- cnhkmcp/untracked/APP/static/decoder.js +0 -1540
- cnhkmcp/untracked/APP/static/feature_engineering.js +0 -1729
- cnhkmcp/untracked/APP/static/idea_house.js +0 -937
- cnhkmcp/untracked/APP/static/inspiration.js +0 -465
- cnhkmcp/untracked/APP/static/inspiration_house.js +0 -868
- cnhkmcp/untracked/APP/static/paper_analysis.js +0 -390
- cnhkmcp/untracked/APP/static/script.js +0 -3082
- cnhkmcp/untracked/APP/static/simulator.js +0 -597
- cnhkmcp/untracked/APP/static/styles.css +0 -3127
- cnhkmcp/untracked/APP/static/usage_widget.js +0 -508
- cnhkmcp/untracked/APP/templates/alpha_inspector.html +0 -511
- cnhkmcp/untracked/APP/templates/feature_engineering.html +0 -960
- cnhkmcp/untracked/APP/templates/idea_house.html +0 -564
- cnhkmcp/untracked/APP/templates/index.html +0 -932
- cnhkmcp/untracked/APP/templates/inspiration_house.html +0 -861
- cnhkmcp/untracked/APP/templates/paper_analysis.html +0 -91
- cnhkmcp/untracked/APP/templates/simulator.html +0 -343
- cnhkmcp/untracked/APP/templates/transformer_web.html +0 -580
- cnhkmcp/untracked/APP/usage.md +0 -351
- cnhkmcp/untracked/APP//321/207/342/225/235/320/250/321/205/320/230/320/226/321/204/342/225/225/320/220/321/211/320/221/320/243/321/206/320/261/320/265/ace_lib.py +0 -1510
- cnhkmcp/untracked/APP//321/207/342/225/235/320/250/321/205/320/230/320/226/321/204/342/225/225/320/220/321/211/320/221/320/243/321/206/320/261/320/265/brain_alpha_inspector.py +0 -712
- cnhkmcp/untracked/APP//321/207/342/225/235/320/250/321/205/320/230/320/226/321/204/342/225/225/320/220/321/211/320/221/320/243/321/206/320/261/320/265/helpful_functions.py +0 -180
- cnhkmcp/untracked/APP//321/210/342/224/220/320/240/321/210/320/261/320/234/321/206/320/231/320/243/321/205/342/225/235/320/220/321/206/320/230/320/241.py +0 -2456
- cnhkmcp/untracked/arXiv_API_Tool_Manual.md +0 -490
- cnhkmcp/untracked/arxiv_api.py +0 -229
- cnhkmcp/untracked/forum_functions.py +0 -998
- cnhkmcp/untracked/mcp/321/206/320/246/320/227/321/204/342/225/227/342/225/242/321/210/320/276/342/225/221/321/205/320/255/320/253/321/207/320/231/320/2302_/321/205/320/266/320/222/321/206/320/256/320/254/321/205/320/236/320/257/321/207/320/231/320/230/321/205/320/240/320/277/321/205/320/232/320/270/321/204/342/225/225/320/235/321/204/342/225/221/320/226/321/206/342/225/241/320/237/321/210/320/267/320/230/321/205/320/251/320/270/321/205/342/226/221/342/226/222/321/210/320/277/320/245/321/210/342/224/220/320/251/321/204/342/225/225/320/272/forum_functions.py +0 -407
- cnhkmcp/untracked/mcp/321/206/320/246/320/227/321/204/342/225/227/342/225/242/321/210/320/276/342/225/221/321/205/320/255/320/253/321/207/320/231/320/2302_/321/205/320/266/320/222/321/206/320/256/320/254/321/205/320/236/320/257/321/207/320/231/320/230/321/205/320/240/320/277/321/205/320/232/320/270/321/204/342/225/225/320/235/321/204/342/225/221/320/226/321/206/342/225/241/320/237/321/210/320/267/320/230/321/205/320/251/320/270/321/205/342/226/221/342/226/222/321/210/320/277/320/245/321/210/342/224/220/320/251/321/204/342/225/225/320/272/platform_functions.py +0 -2415
- cnhkmcp/untracked/mcp/321/206/320/246/320/227/321/204/342/225/227/342/225/242/321/210/320/276/342/225/221/321/205/320/255/320/253/321/207/320/231/320/2302_/321/205/320/266/320/222/321/206/320/256/320/254/321/205/320/236/320/257/321/207/320/231/320/230/321/205/320/240/320/277/321/205/320/232/320/270/321/204/342/225/225/320/235/321/204/342/225/221/320/226/321/206/342/225/241/320/237/321/210/320/267/320/230/321/205/320/251/320/270/321/205/342/226/221/342/226/222/321/210/320/277/320/245/321/210/342/224/220/320/251/321/204/342/225/225/320/272/user_config.json +0 -31
- cnhkmcp/untracked/mcp/321/206/320/246/320/227/321/204/342/225/227/342/225/242/321/210/320/276/342/225/221/321/205/320/255/320/253/321/207/320/231/320/2302_/321/205/320/266/320/222/321/206/320/256/320/254/321/205/320/236/320/257/321/207/320/231/320/230/321/205/320/240/320/277/321/205/320/232/320/270/321/204/342/225/225/320/235/321/204/342/225/221/320/226/321/206/342/225/241/320/237/321/210/320/267/320/230/321/205/320/251/320/270/321/205/342/226/221/342/226/222/321/210/320/277/320/245/321/210/342/224/220/320/251/321/204/342/225/225/320/272//321/210/320/276/320/271AI/321/210/320/277/342/225/227/321/210/342/224/220/320/251/321/204/342/225/225/320/272/321/206/320/246/320/227/321/206/320/261/320/263/321/206/320/255/320/265/321/205/320/275/320/266/321/204/342/225/235/320/252/321/204/342/225/225/320/233/321/210/342/225/234/342/225/234/321/206/342/225/241/320/237/321/210/320/267/320/230/321/205/320/251/320/270.md +0 -101
- cnhkmcp/untracked/mcp/321/206/320/246/320/227/321/204/342/225/227/342/225/242/321/210/320/276/342/225/221/321/205/320/255/320/253/321/207/320/231/320/2302_/321/205/320/266/320/222/321/206/320/256/320/254/321/205/320/236/320/257/321/207/320/231/320/230/321/205/320/240/320/277/321/205/320/232/320/270/321/204/342/225/225/320/235/321/204/342/225/221/320/226/321/206/342/225/241/320/237/321/210/320/267/320/230/321/205/320/251/320/270/321/205/342/226/221/342/226/222/321/210/320/277/320/245/321/210/342/224/220/320/251/321/204/342/225/225/320/272//321/211/320/225/320/235/321/207/342/225/234/320/276/321/205/320/231/320/235/321/210/342/224/220/320/240/321/210/320/261/320/234/321/206/320/230/320/241_/321/205/320/276/320/231/321/210/320/263/320/225/321/205/342/224/220/320/225/321/210/320/266/320/221/321/204/342/225/233/320/255/321/210/342/225/241/320/246/321/205/320/234/320/225.py +0 -190
- cnhkmcp/untracked/platform_functions.py +0 -2886
- cnhkmcp/untracked/sample_mcp_config.json +0 -11
- cnhkmcp/untracked/user_config.json +0 -31
- cnhkmcp/untracked//321/207/320/264/342/225/221/321/204/342/225/233/320/233/321/205/320/237/320/222/321/210/320/220/320/223/321/206/320/246/320/227/321/206/320/261/320/263_BRAIN_Alpha_Test_Requirements_and_Tips.md +0 -202
- cnhkmcp/untracked//321/207/320/264/342/225/221/321/204/342/225/233/320/233/321/205/342/225/226/320/265/321/204/342/225/234/320/254/321/206/342/225/241/320/221_Alpha_explaination_workflow.md +0 -56
- cnhkmcp/untracked//321/207/320/264/342/225/221/321/204/342/225/233/320/233/321/205/342/225/226/320/265/321/204/342/225/234/320/254/321/206/342/225/241/320/221_BRAIN_6_Tips_Datafield_Exploration_Guide.md +0 -194
- cnhkmcp/untracked//321/207/320/264/342/225/221/321/204/342/225/233/320/233/321/205/342/225/226/320/265/321/204/342/225/234/320/254/321/206/342/225/241/320/221_BRAIN_Alpha_Improvement_Workflow.md +0 -101
- cnhkmcp/untracked//321/207/320/264/342/225/221/321/204/342/225/233/320/233/321/205/342/225/226/320/265/321/204/342/225/234/320/254/321/206/342/225/241/320/221_Dataset_Exploration_Expert_Manual.md +0 -436
- cnhkmcp/untracked//321/207/320/264/342/225/221/321/204/342/225/233/320/233/321/205/342/225/226/320/265/321/204/342/225/234/320/254/321/206/342/225/241/320/221_daily_report_workflow.md +0 -128
- cnhkmcp/untracked//321/211/320/225/320/235/321/207/342/225/234/320/276/321/205/320/231/320/235/321/210/342/224/220/320/240/321/210/320/261/320/234/321/206/320/230/320/241_/321/205/320/276/320/231/321/210/320/263/320/225/321/205/342/224/220/320/225/321/210/320/266/320/221/321/204/342/225/233/320/255/321/210/342/225/241/320/246/321/205/320/234/320/225.py +0 -190
- cnhkmcp-2.1.2.dist-info/RECORD +0 -111
- cnhkmcp-2.1.2.dist-info/top_level.txt +0 -1
- {cnhkmcp-2.1.2.dist-info → cnhkmcp-2.1.3.dist-info}/WHEEL +0 -0
- {cnhkmcp-2.1.2.dist-info → cnhkmcp-2.1.3.dist-info}/entry_points.txt +0 -0
- {cnhkmcp-2.1.2.dist-info → cnhkmcp-2.1.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,390 +0,0 @@
|
|
|
1
|
-
// Paper Analysis JavaScript
|
|
2
|
-
|
|
3
|
-
// Store API key in session storage
|
|
4
|
-
let apiKey = sessionStorage.getItem('deepseekApiKey');
|
|
5
|
-
|
|
6
|
-
// DOM Elements
|
|
7
|
-
const apiKeyInput = document.getElementById('apiKey');
|
|
8
|
-
const saveApiKeyBtn = document.getElementById('saveApiKey');
|
|
9
|
-
const fileInput = document.getElementById('paperFile');
|
|
10
|
-
const fileInfo = document.getElementById('fileInfo');
|
|
11
|
-
const analyzeBtn = document.getElementById('analyzePaper');
|
|
12
|
-
const resultsSection = document.querySelector('.results-section');
|
|
13
|
-
const tabButtons = document.querySelectorAll('.tab-btn');
|
|
14
|
-
const tabPanes = document.querySelectorAll('.tab-pane');
|
|
15
|
-
const exportBtn = document.getElementById('exportResults');
|
|
16
|
-
|
|
17
|
-
// Initialize API key if exists
|
|
18
|
-
if (apiKey) {
|
|
19
|
-
apiKeyInput.value = apiKey;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Save API Key and Test Connection
|
|
23
|
-
saveApiKeyBtn.addEventListener('click', async () => {
|
|
24
|
-
const newApiKey = apiKeyInput.value.trim();
|
|
25
|
-
if (!newApiKey) {
|
|
26
|
-
showNotification('Please enter a valid API key', 'error');
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
showLoading('Testing API connection...');
|
|
32
|
-
|
|
33
|
-
const response = await fetch('/paper-analysis/api/test-deepseek', {
|
|
34
|
-
method: 'POST',
|
|
35
|
-
headers: {
|
|
36
|
-
'X-API-Key': newApiKey,
|
|
37
|
-
'Content-Type': 'application/json'
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const data = await response.json();
|
|
42
|
-
|
|
43
|
-
if (response.ok && data.success) {
|
|
44
|
-
sessionStorage.setItem('deepseekApiKey', newApiKey);
|
|
45
|
-
apiKey = newApiKey;
|
|
46
|
-
showNotification('API connection successful', 'success');
|
|
47
|
-
} else {
|
|
48
|
-
showNotification(`API Error: ${data.error || 'Unknown error'}`, 'error');
|
|
49
|
-
console.error('API Error Details:', data);
|
|
50
|
-
}
|
|
51
|
-
} catch (error) {
|
|
52
|
-
showNotification('Error testing API connection: ' + error.message, 'error');
|
|
53
|
-
console.error('API Test Error:', error);
|
|
54
|
-
} finally {
|
|
55
|
-
hideLoading();
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// File Upload Handling
|
|
60
|
-
fileInput.addEventListener('change', handleFileSelect);
|
|
61
|
-
document.querySelector('.file-upload-container').addEventListener('dragover', handleDragOver);
|
|
62
|
-
document.querySelector('.file-upload-container').addEventListener('drop', handleFileDrop);
|
|
63
|
-
|
|
64
|
-
function handleFileSelect(event) {
|
|
65
|
-
const file = event.target.files[0];
|
|
66
|
-
if (file) {
|
|
67
|
-
updateFileInfo(file);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function handleDragOver(event) {
|
|
72
|
-
event.preventDefault();
|
|
73
|
-
event.stopPropagation();
|
|
74
|
-
event.currentTarget.classList.add('drag-over');
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function handleFileDrop(event) {
|
|
78
|
-
event.preventDefault();
|
|
79
|
-
event.stopPropagation();
|
|
80
|
-
event.currentTarget.classList.remove('drag-over');
|
|
81
|
-
|
|
82
|
-
const file = event.dataTransfer.files[0];
|
|
83
|
-
if (file) {
|
|
84
|
-
fileInput.files = event.dataTransfer.files;
|
|
85
|
-
updateFileInfo(file);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function updateFileInfo(file) {
|
|
90
|
-
const sizeInMB = (file.size / (1024 * 1024)).toFixed(2);
|
|
91
|
-
fileInfo.innerHTML = `
|
|
92
|
-
<strong>File:</strong> ${file.name}<br>
|
|
93
|
-
<strong>Size:</strong> ${sizeInMB} MB<br>
|
|
94
|
-
<strong>Type:</strong> ${file.type || 'Unknown'}
|
|
95
|
-
`;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Tab Navigation
|
|
99
|
-
tabButtons.forEach(button => {
|
|
100
|
-
button.addEventListener('click', () => {
|
|
101
|
-
const tabName = button.getAttribute('data-tab');
|
|
102
|
-
|
|
103
|
-
// Update active states
|
|
104
|
-
tabButtons.forEach(btn => btn.classList.remove('active'));
|
|
105
|
-
tabPanes.forEach(pane => pane.classList.remove('active'));
|
|
106
|
-
|
|
107
|
-
button.classList.add('active');
|
|
108
|
-
document.getElementById(`${tabName}Tab`).classList.add('active');
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
// Paper Analysis
|
|
113
|
-
analyzeBtn.addEventListener('click', async () => {
|
|
114
|
-
if (!apiKey) {
|
|
115
|
-
showNotification('Please configure your Deepseek API key first', 'error');
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (!fileInput.files[0]) {
|
|
120
|
-
showNotification('Please select a file to analyze', 'error');
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const formData = new FormData();
|
|
125
|
-
formData.append('file', fileInput.files[0]);
|
|
126
|
-
formData.append('extract_keywords', document.getElementById('extractKeywords').checked);
|
|
127
|
-
formData.append('generate_summary', document.getElementById('generateSummary').checked);
|
|
128
|
-
formData.append('find_related', document.getElementById('findRelatedWorks').checked);
|
|
129
|
-
|
|
130
|
-
try {
|
|
131
|
-
showLoading('Analyzing paper...');
|
|
132
|
-
|
|
133
|
-
const response = await fetch('/paper-analysis/api/analyze-paper', {
|
|
134
|
-
method: 'POST',
|
|
135
|
-
headers: {
|
|
136
|
-
'X-API-Key': apiKey
|
|
137
|
-
},
|
|
138
|
-
body: formData
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
const responseData = await response.json();
|
|
142
|
-
|
|
143
|
-
if (!response.ok) {
|
|
144
|
-
// Show detailed error message
|
|
145
|
-
const errorMessage = responseData.error || `HTTP error! status: ${response.status}`;
|
|
146
|
-
throw new Error(errorMessage);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
displayResults(responseData);
|
|
150
|
-
hideLoading();
|
|
151
|
-
resultsSection.style.display = 'block';
|
|
152
|
-
showNotification('Analysis completed successfully', 'success');
|
|
153
|
-
} catch (error) {
|
|
154
|
-
hideLoading();
|
|
155
|
-
console.error('Analysis error:', error);
|
|
156
|
-
showNotification('Error analyzing paper: ' + error.message, 'error');
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
// Display Results
|
|
161
|
-
function displayResults(results) {
|
|
162
|
-
// Display Keywords
|
|
163
|
-
const keywordsContainer = document.querySelector('.keywords-container');
|
|
164
|
-
if (results.keywords) {
|
|
165
|
-
keywordsContainer.innerHTML = results.keywords.map(keyword =>
|
|
166
|
-
`<div class="keyword-item">
|
|
167
|
-
<span class="keyword-text">${keyword.text}</span>
|
|
168
|
-
<span class="keyword-score">${(keyword.score * 100).toFixed(1)}%</span>
|
|
169
|
-
</div>`
|
|
170
|
-
).join('');
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// Display Summary
|
|
174
|
-
const summaryContainer = document.querySelector('.summary-container');
|
|
175
|
-
if (results.summary) {
|
|
176
|
-
summaryContainer.innerHTML = `<div class="summary-text">${results.summary}</div>`;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// Display Related Works
|
|
180
|
-
const relatedContainer = document.querySelector('.related-works-container');
|
|
181
|
-
if (results.related_works) {
|
|
182
|
-
// Add MathJax script if not already loaded
|
|
183
|
-
if (!window.MathJax) {
|
|
184
|
-
const script = document.createElement('script');
|
|
185
|
-
script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js';
|
|
186
|
-
script.async = true;
|
|
187
|
-
document.head.appendChild(script);
|
|
188
|
-
|
|
189
|
-
window.MathJax = {
|
|
190
|
-
tex: {
|
|
191
|
-
inlineMath: [['$', '$'], ['\\(', '\\)']],
|
|
192
|
-
displayMath: [['$$', '$$'], ['\\[', '\\]']]
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// Display formulas
|
|
198
|
-
relatedContainer.innerHTML = results.related_works.map((formula, index) => {
|
|
199
|
-
// Determine the formula display based on type
|
|
200
|
-
let formulaDisplay = formula.formula;
|
|
201
|
-
|
|
202
|
-
// Wrap formula in appropriate delimiters for MathJax
|
|
203
|
-
if (!formulaDisplay.includes('$') && !formulaDisplay.includes('\\[') && !formulaDisplay.includes('\\(')) {
|
|
204
|
-
// If no delimiters, add them
|
|
205
|
-
if (formula.type === 'definition' || formula.type === 'theorem' || formula.importance > 0.7) {
|
|
206
|
-
formulaDisplay = `\\[${formulaDisplay}\\]`; // Display math for important formulas
|
|
207
|
-
} else {
|
|
208
|
-
formulaDisplay = `\\(${formulaDisplay}\\)`; // Inline math for others
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// Ensure variables is properly formatted for display
|
|
213
|
-
let variablesDisplay = '';
|
|
214
|
-
if (formula.variables) {
|
|
215
|
-
let englishVariables = '';
|
|
216
|
-
let chineseVariables = '';
|
|
217
|
-
|
|
218
|
-
// Handle English variables
|
|
219
|
-
if (typeof formula.variables === 'string') {
|
|
220
|
-
try {
|
|
221
|
-
const variablesObj = JSON.parse(formula.variables);
|
|
222
|
-
englishVariables = Object.entries(variablesObj)
|
|
223
|
-
.map(([symbol, description]) => {
|
|
224
|
-
// Wrap mathematical symbols in LaTeX delimiters
|
|
225
|
-
const mathSymbol = `\\(${symbol}\\)`;
|
|
226
|
-
return `<div class="variable-item"><span class="variable-symbol">${mathSymbol}</span><span class="variable-separator">:</span><span class="variable-desc">${description}</span></div>`;
|
|
227
|
-
})
|
|
228
|
-
.join('');
|
|
229
|
-
} catch (e) {
|
|
230
|
-
englishVariables = `<div class="variable-item">${formula.variables}</div>`;
|
|
231
|
-
}
|
|
232
|
-
} else if (typeof formula.variables === 'object') {
|
|
233
|
-
englishVariables = Object.entries(formula.variables)
|
|
234
|
-
.map(([symbol, description]) => {
|
|
235
|
-
// Wrap mathematical symbols in LaTeX delimiters
|
|
236
|
-
const mathSymbol = `\\(${symbol}\\)`;
|
|
237
|
-
return `<div class="variable-item"><span class="variable-symbol">${mathSymbol}</span><span class="variable-separator">:</span><span class="variable-desc">${description}</span></div>`;
|
|
238
|
-
})
|
|
239
|
-
.join('');
|
|
240
|
-
} else {
|
|
241
|
-
englishVariables = `<div class="variable-item">${String(formula.variables)}</div>`;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// Handle Chinese variables if available
|
|
245
|
-
if (formula.variables_chinese) {
|
|
246
|
-
if (typeof formula.variables_chinese === 'string') {
|
|
247
|
-
try {
|
|
248
|
-
const variablesChineseObj = JSON.parse(formula.variables_chinese);
|
|
249
|
-
chineseVariables = Object.entries(variablesChineseObj)
|
|
250
|
-
.map(([symbol, description]) => {
|
|
251
|
-
// Wrap mathematical symbols in LaTeX delimiters
|
|
252
|
-
const mathSymbol = `\\(${symbol}\\)`;
|
|
253
|
-
return `<div class="variable-item"><span class="variable-symbol">${mathSymbol}</span><span class="variable-separator">:</span><span class="variable-desc">${description}</span></div>`;
|
|
254
|
-
})
|
|
255
|
-
.join('');
|
|
256
|
-
} catch (e) {
|
|
257
|
-
chineseVariables = `<div class="variable-item">${formula.variables_chinese}</div>`;
|
|
258
|
-
}
|
|
259
|
-
} else if (typeof formula.variables_chinese === 'object') {
|
|
260
|
-
chineseVariables = Object.entries(formula.variables_chinese)
|
|
261
|
-
.map(([symbol, description]) => {
|
|
262
|
-
// Wrap mathematical symbols in LaTeX delimiters
|
|
263
|
-
const mathSymbol = `\\(${symbol}\\)`;
|
|
264
|
-
return `<div class="variable-item"><span class="variable-symbol">${mathSymbol}</span><span class="variable-separator">:</span><span class="variable-desc">${description}</span></div>`;
|
|
265
|
-
})
|
|
266
|
-
.join('');
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
if (chineseVariables) {
|
|
271
|
-
variablesDisplay = `
|
|
272
|
-
<div class="variables-tabs">
|
|
273
|
-
<button class="var-tab-btn active" onclick="switchVariableTab(this, 'english')">English</button>
|
|
274
|
-
<button class="var-tab-btn" onclick="switchVariableTab(this, 'chinese')">中文</button>
|
|
275
|
-
</div>
|
|
276
|
-
<div class="variables-content">
|
|
277
|
-
<div class="variables-list english-vars active">${englishVariables}</div>
|
|
278
|
-
<div class="variables-list chinese-vars">${chineseVariables}</div>
|
|
279
|
-
</div>`;
|
|
280
|
-
} else {
|
|
281
|
-
variablesDisplay = `<div class="variables-list">${englishVariables}</div>`;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
return `<div class="formula-item">
|
|
286
|
-
<div class="formula-header">
|
|
287
|
-
<span class="formula-number">#${index + 1}</span>
|
|
288
|
-
<span class="formula-type ${formula.type}">${formula.type.toUpperCase()}</span>
|
|
289
|
-
</div>
|
|
290
|
-
<div class="formula-expression">${formulaDisplay}</div>
|
|
291
|
-
<div class="formula-description">${formula.description}</div>
|
|
292
|
-
${variablesDisplay ? `<div class="formula-variables"><strong>Variables:</strong><div class="variables-list">${variablesDisplay}</div></div>` : ''}
|
|
293
|
-
<div class="formula-context"><strong>Context:</strong> ${formula.context}</div>
|
|
294
|
-
<div class="formula-chinese"><strong>中文描述:</strong> ${formula.chinese_description || formula.Chinese_description || 'No Chinese description'}</div>
|
|
295
|
-
</div>`;
|
|
296
|
-
}).join('');
|
|
297
|
-
|
|
298
|
-
// Trigger MathJax to process the formulas
|
|
299
|
-
if (window.MathJax && window.MathJax.typesetPromise) {
|
|
300
|
-
window.MathJax.typesetPromise([relatedContainer]).catch((e) => console.error(e));
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
// Export Results
|
|
306
|
-
exportBtn.addEventListener('click', () => {
|
|
307
|
-
const results = {
|
|
308
|
-
keywords: Array.from(document.querySelectorAll('.keyword-item')).map(item => ({
|
|
309
|
-
text: item.querySelector('.keyword-text').textContent,
|
|
310
|
-
score: parseFloat(item.querySelector('.keyword-score').textContent) / 100
|
|
311
|
-
})),
|
|
312
|
-
summary: document.querySelector('.summary-text')?.textContent,
|
|
313
|
-
related_works: Array.from(document.querySelectorAll('.formula-item')).map(item => {
|
|
314
|
-
const variablesElement = item.querySelector('.formula-variables');
|
|
315
|
-
const contextElement = item.querySelector('.formula-context');
|
|
316
|
-
const chineseElement = item.querySelector('.formula-chinese');
|
|
317
|
-
|
|
318
|
-
return {
|
|
319
|
-
formula: item.querySelector('.formula-expression').textContent,
|
|
320
|
-
type: item.querySelector('.formula-type').textContent.toLowerCase(),
|
|
321
|
-
description: item.querySelector('.formula-description').textContent,
|
|
322
|
-
variables: variablesElement ? variablesElement.textContent.replace('Variables: ', '') : '',
|
|
323
|
-
context: contextElement ? contextElement.textContent.replace('Context: ', '') : '',
|
|
324
|
-
chinese_description: chineseElement ? chineseElement.textContent.replace('中文描述: ', '') : ''
|
|
325
|
-
};
|
|
326
|
-
})
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
const blob = new Blob([JSON.stringify(results, null, 2)], { type: 'application/json' });
|
|
330
|
-
const url = URL.createObjectURL(blob);
|
|
331
|
-
const a = document.createElement('a');
|
|
332
|
-
a.href = url;
|
|
333
|
-
a.download = 'paper_analysis_results.json';
|
|
334
|
-
document.body.appendChild(a);
|
|
335
|
-
a.click();
|
|
336
|
-
document.body.removeChild(a);
|
|
337
|
-
URL.revokeObjectURL(url);
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
// Utility Functions
|
|
341
|
-
function showNotification(message, type) {
|
|
342
|
-
const notification = document.createElement('div');
|
|
343
|
-
notification.className = `notification ${type}`;
|
|
344
|
-
notification.textContent = message;
|
|
345
|
-
document.body.appendChild(notification);
|
|
346
|
-
|
|
347
|
-
setTimeout(() => {
|
|
348
|
-
notification.remove();
|
|
349
|
-
}, 3000);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
let loadingElement = null;
|
|
353
|
-
|
|
354
|
-
function showLoading(message) {
|
|
355
|
-
loadingElement = document.createElement('div');
|
|
356
|
-
loadingElement.className = 'loading-overlay';
|
|
357
|
-
loadingElement.innerHTML = `
|
|
358
|
-
<div class="loading-spinner"></div>
|
|
359
|
-
<div class="loading-message">${message}</div>
|
|
360
|
-
`;
|
|
361
|
-
document.body.appendChild(loadingElement);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
function hideLoading() {
|
|
365
|
-
if (loadingElement) {
|
|
366
|
-
loadingElement.remove();
|
|
367
|
-
loadingElement = null;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
// Function to switch between English and Chinese variable descriptions
|
|
372
|
-
function switchVariableTab(button, language) {
|
|
373
|
-
const variablesContainer = button.closest('.formula-variables');
|
|
374
|
-
const tabs = variablesContainer.querySelectorAll('.var-tab-btn');
|
|
375
|
-
const contents = variablesContainer.querySelectorAll('.variables-list');
|
|
376
|
-
|
|
377
|
-
// Update tab buttons
|
|
378
|
-
tabs.forEach(tab => tab.classList.remove('active'));
|
|
379
|
-
button.classList.add('active');
|
|
380
|
-
|
|
381
|
-
// Update content visibility
|
|
382
|
-
contents.forEach(content => content.classList.remove('active'));
|
|
383
|
-
const targetContent = variablesContainer.querySelector(`.${language}-vars`);
|
|
384
|
-
if (targetContent) {
|
|
385
|
-
targetContent.classList.add('active');
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
// Make function global so it can be called from onclick
|
|
390
|
-
window.switchVariableTab = switchVariableTab;
|