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.
Files changed (113) hide show
  1. {cnhkmcp-2.1.2.dist-info → cnhkmcp-2.1.3.dist-info}/METADATA +1 -1
  2. cnhkmcp-2.1.3.dist-info/RECORD +6 -0
  3. cnhkmcp-2.1.3.dist-info/top_level.txt +1 -0
  4. cnhkmcp/__init__.py +0 -125
  5. 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
  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/ace.log +0 -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/config.json +0 -6
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. 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
  21. 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
  22. cnhkmcp/untracked/APP/.gitignore +0 -32
  23. cnhkmcp/untracked/APP/MODULAR_STRUCTURE.md +0 -112
  24. cnhkmcp/untracked/APP/README.md +0 -309
  25. cnhkmcp/untracked/APP/Tranformer/Transformer.py +0 -4985
  26. cnhkmcp/untracked/APP/Tranformer/ace.log +0 -0
  27. cnhkmcp/untracked/APP/Tranformer/ace_lib.py +0 -1510
  28. cnhkmcp/untracked/APP/Tranformer/helpful_functions.py +0 -180
  29. cnhkmcp/untracked/APP/Tranformer/output/Alpha_candidates.json +0 -2421
  30. cnhkmcp/untracked/APP/Tranformer/output/Alpha_candidates_/321/207/320/264/342/225/221/321/204/342/225/233/320/233.json +0 -654
  31. cnhkmcp/untracked/APP/Tranformer/output/Alpha_generated_expressions_error.json +0 -1034
  32. cnhkmcp/untracked/APP/Tranformer/output/Alpha_generated_expressions_success.json +0 -444
  33. 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
  34. cnhkmcp/untracked/APP/Tranformer/parsetab.py +0 -60
  35. cnhkmcp/untracked/APP/Tranformer/template_summary.txt +0 -3182
  36. cnhkmcp/untracked/APP/Tranformer/transformer_config.json +0 -7
  37. cnhkmcp/untracked/APP/Tranformer/validator.py +0 -889
  38. cnhkmcp/untracked/APP/ace.log +0 -69
  39. cnhkmcp/untracked/APP/ace_lib.py +0 -1510
  40. cnhkmcp/untracked/APP/blueprints/__init__.py +0 -6
  41. cnhkmcp/untracked/APP/blueprints/feature_engineering.py +0 -347
  42. cnhkmcp/untracked/APP/blueprints/idea_house.py +0 -221
  43. cnhkmcp/untracked/APP/blueprints/inspiration_house.py +0 -432
  44. cnhkmcp/untracked/APP/blueprints/paper_analysis.py +0 -570
  45. cnhkmcp/untracked/APP/custom_templates/templates.json +0 -1257
  46. cnhkmcp/untracked/APP/give_me_idea/BRAIN_Alpha_Template_Expert_SystemPrompt.md +0 -400
  47. cnhkmcp/untracked/APP/give_me_idea/ace_lib.py +0 -1510
  48. cnhkmcp/untracked/APP/give_me_idea/alpha_data_specific_template_master.py +0 -252
  49. cnhkmcp/untracked/APP/give_me_idea/fetch_all_datasets.py +0 -157
  50. cnhkmcp/untracked/APP/give_me_idea/fetch_all_operators.py +0 -99
  51. cnhkmcp/untracked/APP/give_me_idea/helpful_functions.py +0 -180
  52. cnhkmcp/untracked/APP/give_me_idea/what_is_Alpha_template.md +0 -11
  53. cnhkmcp/untracked/APP/helpful_functions.py +0 -180
  54. cnhkmcp/untracked/APP/hkSimulator/ace_lib.py +0 -1497
  55. cnhkmcp/untracked/APP/hkSimulator/autosimulator.py +0 -447
  56. cnhkmcp/untracked/APP/hkSimulator/helpful_functions.py +0 -180
  57. cnhkmcp/untracked/APP/mirror_config.txt +0 -20
  58. cnhkmcp/untracked/APP/operaters.csv +0 -129
  59. cnhkmcp/untracked/APP/requirements.txt +0 -53
  60. cnhkmcp/untracked/APP/run_app.bat +0 -28
  61. cnhkmcp/untracked/APP/run_app.sh +0 -34
  62. cnhkmcp/untracked/APP/setup_tsinghua.bat +0 -39
  63. cnhkmcp/untracked/APP/setup_tsinghua.sh +0 -43
  64. cnhkmcp/untracked/APP/simulator/alpha_submitter.py +0 -404
  65. cnhkmcp/untracked/APP/simulator/simulator_wqb.py +0 -618
  66. cnhkmcp/untracked/APP/ssrn-3332513.pdf +6 -109201
  67. cnhkmcp/untracked/APP/static/brain.js +0 -589
  68. cnhkmcp/untracked/APP/static/decoder.js +0 -1540
  69. cnhkmcp/untracked/APP/static/feature_engineering.js +0 -1729
  70. cnhkmcp/untracked/APP/static/idea_house.js +0 -937
  71. cnhkmcp/untracked/APP/static/inspiration.js +0 -465
  72. cnhkmcp/untracked/APP/static/inspiration_house.js +0 -868
  73. cnhkmcp/untracked/APP/static/paper_analysis.js +0 -390
  74. cnhkmcp/untracked/APP/static/script.js +0 -3082
  75. cnhkmcp/untracked/APP/static/simulator.js +0 -597
  76. cnhkmcp/untracked/APP/static/styles.css +0 -3127
  77. cnhkmcp/untracked/APP/static/usage_widget.js +0 -508
  78. cnhkmcp/untracked/APP/templates/alpha_inspector.html +0 -511
  79. cnhkmcp/untracked/APP/templates/feature_engineering.html +0 -960
  80. cnhkmcp/untracked/APP/templates/idea_house.html +0 -564
  81. cnhkmcp/untracked/APP/templates/index.html +0 -932
  82. cnhkmcp/untracked/APP/templates/inspiration_house.html +0 -861
  83. cnhkmcp/untracked/APP/templates/paper_analysis.html +0 -91
  84. cnhkmcp/untracked/APP/templates/simulator.html +0 -343
  85. cnhkmcp/untracked/APP/templates/transformer_web.html +0 -580
  86. cnhkmcp/untracked/APP/usage.md +0 -351
  87. 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
  88. 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
  89. 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
  90. 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
  91. cnhkmcp/untracked/arXiv_API_Tool_Manual.md +0 -490
  92. cnhkmcp/untracked/arxiv_api.py +0 -229
  93. cnhkmcp/untracked/forum_functions.py +0 -998
  94. 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
  95. 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
  96. 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
  97. 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
  98. 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
  99. cnhkmcp/untracked/platform_functions.py +0 -2886
  100. cnhkmcp/untracked/sample_mcp_config.json +0 -11
  101. cnhkmcp/untracked/user_config.json +0 -31
  102. 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
  103. 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
  104. 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
  105. 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
  106. 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
  107. 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
  108. 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
  109. cnhkmcp-2.1.2.dist-info/RECORD +0 -111
  110. cnhkmcp-2.1.2.dist-info/top_level.txt +0 -1
  111. {cnhkmcp-2.1.2.dist-info → cnhkmcp-2.1.3.dist-info}/WHEEL +0 -0
  112. {cnhkmcp-2.1.2.dist-info → cnhkmcp-2.1.3.dist-info}/entry_points.txt +0 -0
  113. {cnhkmcp-2.1.2.dist-info → cnhkmcp-2.1.3.dist-info}/licenses/LICENSE +0 -0
@@ -1,580 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>BRAIN Transformer - Web Interface</title>
7
- <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
8
- <style>
9
- .simulator-container {
10
- max-width: 1200px;
11
- margin: 0 auto;
12
- padding: 20px;
13
- }
14
-
15
- .simulator-grid {
16
- display: grid;
17
- grid-template-columns: 1fr 1fr;
18
- gap: 20px;
19
- margin-top: 20px;
20
- }
21
-
22
- .simulator-panel {
23
- background: #f8f9fa;
24
- border-radius: 8px;
25
- padding: 20px;
26
- border: 1px solid #dee2e6;
27
- }
28
-
29
- .form-group {
30
- margin-bottom: 15px;
31
- }
32
-
33
- .form-group label {
34
- display: block;
35
- margin-bottom: 5px;
36
- font-weight: 600;
37
- color: #495057;
38
- }
39
-
40
- .form-group input, .form-group textarea, .form-group select {
41
- width: 100%;
42
- padding: 8px 12px;
43
- border: 1px solid #ced4da;
44
- border-radius: 4px;
45
- font-size: 14px;
46
- box-sizing: border-box;
47
- }
48
-
49
- .form-group input[type="number"] {
50
- width: 120px;
51
- }
52
-
53
- .log-viewer {
54
- background: #1e1e1e;
55
- color: #f8f8f2;
56
- padding: 15px;
57
- border-radius: 4px;
58
- font-family: 'Courier New', monospace;
59
- font-size: 12px;
60
- height: 500px;
61
- overflow-y: auto;
62
- white-space: pre-wrap;
63
- margin-top: 10px;
64
- }
65
-
66
- .btn-block {
67
- width: 100%;
68
- margin-top: 10px;
69
- display: block;
70
- }
71
-
72
- .hidden {
73
- display: none;
74
- }
75
-
76
- .header-flex {
77
- display: flex;
78
- justify-content: space-between;
79
- align-items: center;
80
- margin-bottom: 20px;
81
- }
82
- </style>
83
- </head>
84
- <body>
85
- <div class="simulator-container">
86
- <div class="header-flex">
87
- <h1>BRAIN Transformer (72变)</h1>
88
- <a href="/" class="btn btn-outline">Back to Home</a>
89
- </div>
90
-
91
- <div class="simulator-grid">
92
- <div class="simulator-panel">
93
- <h3>Configuration</h3>
94
- <form id="transformerForm">
95
- <div class="form-group">
96
- <label for="llm_model">LLM Model Name</label>
97
- <input type="text" id="llm_model" name="LLM_model_name" value="kimi-k2-turbo-preview">
98
- </div>
99
- <div class="form-group">
100
- <label for="llm_api_key">LLM API Key</label>
101
- <input type="password" id="llm_api_key" name="LLM_API_KEY" placeholder="Enter your API Key">
102
- </div>
103
- <div class="form-group">
104
- <label for="llm_base_url">LLM Base URL</label>
105
- <input type="text" id="llm_base_url" name="llm_base_url" value="https://api.moonshot.cn/v1">
106
- </div>
107
- <button type="button" id="testConnectionBtn" class="btn btn-secondary btn-block">Test LLM Connection</button>
108
- <div id="connectionStatus" style="margin-top: 5px; font-size: 0.9em;"></div>
109
- <hr>
110
- <div class="form-group">
111
- <label for="username">BRAIN Username</label>
112
- <input type="text" id="username" name="username" placeholder="Email or Username">
113
- </div>
114
- <div class="form-group">
115
- <label for="password">BRAIN Password</label>
116
- <input type="password" id="password" name="password">
117
- </div>
118
- <button type="button" id="loginBtn" class="btn btn-info btn-block" style="background-color: #17a2b8; color: white;">Login & Fetch Options</button>
119
- <div id="loginStatus" style="margin-top: 5px; font-size: 0.9em;"></div>
120
- <hr>
121
- <div class="form-group">
122
- <label for="template_summary_content">Template Summary</label>
123
- <div style="display: flex; gap: 10px; margin-bottom: 5px;">
124
- <button type="button" class="btn btn-small btn-outline" onclick="document.getElementById('templateFile').click()">📂 Load from File</button>
125
- <input type="file" id="templateFile" accept=".txt,.md" style="display: none;" onchange="loadTemplateFile(event)">
126
- </div>
127
- <textarea id="template_summary_content" name="template_summary_content" style="height: 150px; font-family: monospace; font-size: 12px;" placeholder="Loading default template summary..."></textarea>
128
- </div>
129
- <div class="form-group">
130
- <label for="alpha_id">Alpha ID</label>
131
- <input type="text" id="alpha_id" name="alpha_id" required>
132
- </div>
133
- <div class="form-group">
134
- <label for="top_n">Datafield Top N (数值越大变种数量越多,建议低于50)</label>
135
- <input type="number" id="top_n" name="top_n_datafield" value="50">
136
- </div>
137
-
138
- <div class="form-group">
139
- <label for="region">目标地区 (可选 - 留空则使用种子Alpha的默认值)</label>
140
- <select id="region" name="region" disabled>
141
- <option value="">使用种子Alpha默认值</option>
142
- </select>
143
- </div>
144
- <div class="form-group">
145
- <label for="delay">目标Delay (可选 - 留空则使用种子Alpha的默认值)</label>
146
- <select id="delay" name="delay" disabled>
147
- <option value="">使用种子Alpha默认值</option>
148
- </select>
149
- </div>
150
- <div class="form-group">
151
- <label for="data_type">Data Type</label>
152
- <select id="data_type" name="data_type">
153
- <option value="MATRIX" selected>MATRIX</option>
154
- <option value="VECTOR">VECTOR</option>
155
- </select>
156
- </div>
157
- <div class="form-group">
158
- <label for="universe">目标股票池 (可选 - 留空则使用种子Alpha的默认值)</label>
159
- <select id="universe" name="universe" disabled>
160
- <option value="">使用种子Alpha默认值</option>
161
- </select>
162
- </div>
163
- <div class="form-group">
164
- <label>目标数据类别 (可多选)</label>
165
- <div id="category-container" style="max-height: 300px; overflow-y: auto; border: 1px solid #ced4da; padding: 10px; border-radius: 4px; background-color: white;">
166
- <div id="category-buttons" style="display: flex; flex-wrap: wrap; gap: 8px;">
167
- <button type="button" class="btn btn-sm btn-primary category-btn active" id="cat_btn_all" data-value="" onclick="toggleCategory(this)">
168
- 不筛选 (默认)
169
- </button>
170
- <!-- Dynamic buttons will be added here -->
171
- </div>
172
- </div>
173
- </div>
174
-
175
- <button type="submit" id="runBtn" class="btn btn-primary btn-block" disabled>Run Transformer</button>
176
- </form>
177
- </div>
178
-
179
- <div class="simulator-panel">
180
- <h3>Output Log</h3>
181
- <div id="logViewer" class="log-viewer">Waiting to start...</div>
182
- <div id="downloadSection" class="hidden" style="margin-top: 20px; text-align: center;">
183
- <p>Generation Complete!</p>
184
- <div style="display: flex; flex-direction: column; gap: 10px;">
185
- <a id="downloadCandidatesBtn" href="#" class="btn btn-success" style="background-color: #28a745; color: white;" download>Download Alpha_candidates.json</a>
186
- <small style="color: #6c757d;">Alpha 模板文件,可放入<a href="/">首页</a>载入并精细化调整</small>
187
-
188
- <a id="downloadSuccessBtn" href="#" class="btn btn-info" style="background-color: #17a2b8; color: white;" download>Download Alpha_generated_expressions_success.json</a>
189
- <small style="color: #6c757d;">Alpha表达式列表,可放入<a href="/">首页</a>或machine_lib载入后添加setting进行回测</small>
190
-
191
- <a id="downloadErrorBtn" href="#" class="btn btn-warning" style="background-color: #ffc107; color: black;" download>Download Alpha_generated_expressions_error.json</a>
192
- <small style="color: #6c757d;">被过滤的Alpha表达式,可检查AI模板是否有大规模错误</small>
193
- </div>
194
- </div>
195
-
196
- <div style="margin-top: 30px; padding: 15px; background-color: #e9ecef; border-radius: 5px; font-size: 0.9em; color: #495057;">
197
- <h4 style="margin-top: 0; color: #343a40;">使用说明</h4>
198
- <ol style="padding-left: 20px; margin-bottom: 0;">
199
- <li>请在输入大语言模型相关参数后点击测试,测试成功再进行下一步。</li>
200
- <li>如遇任何报错,欢迎使用AI帮助你解答,有时候一个截图,AI就能帮你解答了。</li>
201
- <li>本页中的Template Summary是启发72变的核心提示词,请不断丰富完善您的武林秘籍并替换,你的结果会更好。</li>
202
- <li>72变支持将原本的Alpha到另外一个区跨区变身,现在它已经从原版本纵向同区点塔,变升级支持跨区点塔。</li>
203
- <li>生成后的模板配置,您可以到<a href="/">主页</a>进行加载后按需修改,增加个性化内容,这会使得您的Alpha更加独特。</li>
204
- <li>如果您不想修改生成后的模板,也可以直接载入生成好的表达式列表,入口同样在<a href="/">主页</a>。</li>
205
- </ol>
206
- </div>
207
- </div>
208
- </div>
209
- </div>
210
-
211
- <script>
212
- const form = document.getElementById('transformerForm');
213
- const logViewer = document.getElementById('logViewer');
214
- const runBtn = document.getElementById('runBtn');
215
- const testConnectionBtn = document.getElementById('testConnectionBtn');
216
- const connectionStatus = document.getElementById('connectionStatus');
217
- const downloadSection = document.getElementById('downloadSection');
218
- const downloadCandidatesBtn = document.getElementById('downloadCandidatesBtn');
219
- const downloadSuccessBtn = document.getElementById('downloadSuccessBtn');
220
- const downloadErrorBtn = document.getElementById('downloadErrorBtn');
221
- const templateSummaryTextarea = document.getElementById('template_summary_content');
222
-
223
- const loginBtn = document.getElementById('loginBtn');
224
- const loginStatus = document.getElementById('loginStatus');
225
- const regionSelect = document.getElementById('region');
226
- const delaySelect = document.getElementById('delay');
227
- const universeSelect = document.getElementById('universe');
228
- // const categorySelect = document.getElementById('category'); // Removed
229
-
230
- let optionsData = {};
231
-
232
- loginBtn.addEventListener('click', async () => {
233
- const username = document.getElementById('username').value;
234
- const password = document.getElementById('password').value;
235
-
236
- if (!username || !password) {
237
- loginStatus.textContent = 'Please enter Username and Password';
238
- loginStatus.style.color = 'red';
239
- return;
240
- }
241
-
242
- loginStatus.textContent = 'Logging in and fetching options...';
243
- loginStatus.style.color = 'blue';
244
- loginBtn.disabled = true;
245
-
246
- try {
247
- const response = await fetch('/api/transformer/login-and-fetch-options', {
248
- method: 'POST',
249
- headers: { 'Content-Type': 'application/json' },
250
- body: JSON.stringify({ username, password })
251
- });
252
-
253
- const result = await response.json();
254
-
255
- if (result.success) {
256
- loginStatus.textContent = 'Login Successful! Options fetched.';
257
- loginStatus.style.color = 'green';
258
- optionsData = result.options;
259
-
260
- // Enable Run button
261
- runBtn.disabled = false;
262
-
263
- // Populate Region Select
264
- populateRegionSelect();
265
-
266
- // Enable selects
267
- regionSelect.disabled = false;
268
-
269
- // Populate Category Select
270
- if (result.categories) {
271
- populateCategorySelect(result.categories);
272
- }
273
-
274
- } else {
275
- loginStatus.textContent = 'Error: ' + result.error;
276
- loginStatus.style.color = 'red';
277
- loginBtn.disabled = false;
278
- }
279
- } catch (error) {
280
- loginStatus.textContent = 'Error: ' + error.message;
281
- loginStatus.style.color = 'red';
282
- loginBtn.disabled = false;
283
- }
284
- });
285
-
286
- function populateRegionSelect() {
287
- // Clear existing options except default
288
- while (regionSelect.options.length > 1) {
289
- regionSelect.remove(1);
290
- }
291
-
292
- const regions = Object.keys(optionsData);
293
- regions.forEach(region => {
294
- const option = document.createElement('option');
295
- option.value = region;
296
- option.textContent = region;
297
- regionSelect.appendChild(option);
298
- });
299
- }
300
-
301
- function populateCategorySelect(categories) {
302
- const container = document.getElementById('category-buttons');
303
- // Remove all buttons except the first one (All)
304
- while (container.children.length > 1) {
305
- container.removeChild(container.lastChild);
306
- }
307
-
308
- categories.forEach(category => {
309
- const btn = document.createElement('button');
310
- btn.type = 'button';
311
- btn.className = 'btn btn-sm btn-outline-secondary category-btn';
312
-
313
- let labelText = '';
314
- let value = '';
315
- if (typeof category === 'object' && category !== null) {
316
- value = category.id;
317
- labelText = category.name;
318
- } else {
319
- value = category;
320
- labelText = String(category).charAt(0).toUpperCase() + String(category).slice(1);
321
- }
322
-
323
- btn.textContent = labelText;
324
- btn.dataset.value = value;
325
- btn.onclick = function() { toggleCategory(this); };
326
-
327
- container.appendChild(btn);
328
- });
329
- }
330
-
331
- function toggleCategory(btn) {
332
- const allBtn = document.getElementById('cat_btn_all');
333
- const isAllBtn = (btn === allBtn);
334
-
335
- if (isAllBtn) {
336
- // If clicking "All", activate it and deactivate others
337
- if (!btn.classList.contains('btn-primary')) {
338
- btn.classList.remove('btn-outline-secondary');
339
- btn.classList.add('btn-primary');
340
- btn.classList.add('active');
341
-
342
- const otherBtns = document.querySelectorAll('.category-btn:not(#cat_btn_all)');
343
- otherBtns.forEach(b => {
344
- b.classList.remove('btn-primary');
345
- b.classList.remove('active');
346
- b.classList.add('btn-outline-secondary');
347
- });
348
- }
349
- } else {
350
- // Toggle current button
351
- if (btn.classList.contains('btn-primary')) {
352
- // Deactivate
353
- btn.classList.remove('btn-primary');
354
- btn.classList.remove('active');
355
- btn.classList.add('btn-outline-secondary');
356
- } else {
357
- // Activate
358
- btn.classList.remove('btn-outline-secondary');
359
- btn.classList.add('btn-primary');
360
- btn.classList.add('active');
361
- }
362
-
363
- // Check if any specific category is active
364
- const anyActive = document.querySelectorAll('.category-btn:not(#cat_btn_all).btn-primary').length > 0;
365
-
366
- if (anyActive) {
367
- // Deactivate "All"
368
- allBtn.classList.remove('btn-primary');
369
- allBtn.classList.remove('active');
370
- allBtn.classList.add('btn-outline-secondary');
371
- } else {
372
- // Activate "All" if nothing else is selected
373
- allBtn.classList.remove('btn-outline-secondary');
374
- allBtn.classList.add('btn-primary');
375
- allBtn.classList.add('active');
376
- }
377
- }
378
- }
379
-
380
- regionSelect.addEventListener('change', () => {
381
- const selectedRegion = regionSelect.value;
382
-
383
- // Reset Delay and Universe
384
- delaySelect.innerHTML = '<option value="">使用种子Alpha默认值</option>';
385
- universeSelect.innerHTML = '<option value="">使用种子Alpha默认值</option>';
386
- delaySelect.disabled = true;
387
- universeSelect.disabled = true;
388
-
389
- if (selectedRegion && optionsData[selectedRegion]) {
390
- const delays = Object.keys(optionsData[selectedRegion]);
391
- delays.forEach(delay => {
392
- const option = document.createElement('option');
393
- option.value = delay;
394
- option.textContent = delay;
395
- delaySelect.appendChild(option);
396
- });
397
- delaySelect.disabled = false;
398
- }
399
- });
400
-
401
- delaySelect.addEventListener('change', () => {
402
- const selectedRegion = regionSelect.value;
403
- const selectedDelay = delaySelect.value;
404
-
405
- // Reset Universe
406
- universeSelect.innerHTML = '<option value="">使用种子Alpha默认值</option>';
407
- universeSelect.disabled = true;
408
-
409
- if (selectedRegion && selectedDelay && optionsData[selectedRegion][selectedDelay]) {
410
- const universes = optionsData[selectedRegion][selectedDelay];
411
- universes.forEach(universe => {
412
- const option = document.createElement('option');
413
- option.value = universe;
414
- option.textContent = universe;
415
- universeSelect.appendChild(option);
416
- });
417
- universeSelect.disabled = false;
418
- }
419
- });
420
-
421
- const dataTypeSelect = document.getElementById('data_type');
422
- dataTypeSelect.addEventListener('change', function() {
423
- if (this.value === 'VECTOR') {
424
- if (!confirm("请确保您输入的原型Alpha中正确地使用了vector operator,否则极容易造成数据类型错误")) {
425
- this.value = 'MATRIX';
426
- }
427
- }
428
- });
429
-
430
- let eventSource = null;
431
-
432
- // Load default template summary on page load
433
- document.addEventListener('DOMContentLoaded', async () => {
434
- try {
435
- const response = await fetch('/api/get-default-template-summary');
436
- const result = await response.json();
437
- if (result.success) {
438
- templateSummaryTextarea.value = result.summary;
439
- } else {
440
- templateSummaryTextarea.value = "Error loading default template summary: " + result.error;
441
- }
442
- } catch (error) {
443
- templateSummaryTextarea.value = "Error loading default template summary: " + error.message;
444
- }
445
- });
446
-
447
- function loadTemplateFile(event) {
448
- const file = event.target.files[0];
449
- if (!file) return;
450
-
451
- const reader = new FileReader();
452
- reader.onload = function(e) {
453
- templateSummaryTextarea.value = e.target.result;
454
- };
455
- reader.readAsText(file);
456
- }
457
-
458
- testConnectionBtn.addEventListener('click', async () => {
459
- const apiKey = document.getElementById('llm_api_key').value;
460
- const baseUrl = document.getElementById('llm_base_url').value;
461
- const model = document.getElementById('llm_model').value;
462
-
463
- if (!apiKey) {
464
- connectionStatus.textContent = 'Please enter API Key';
465
- connectionStatus.style.color = 'red';
466
- return;
467
- }
468
-
469
- connectionStatus.textContent = 'Testing connection...';
470
- connectionStatus.style.color = 'blue';
471
-
472
- try {
473
- const response = await fetch('/api/test-llm-connection', {
474
- method: 'POST',
475
- headers: { 'Content-Type': 'application/json' },
476
- body: JSON.stringify({ apiKey, baseUrl, model })
477
- });
478
-
479
- const result = await response.json();
480
- if (result.success) {
481
- connectionStatus.textContent = 'Connection Successful!';
482
- connectionStatus.style.color = 'green';
483
- } else {
484
- connectionStatus.textContent = 'Connection Failed: ' + result.error;
485
- connectionStatus.style.color = 'red';
486
- }
487
- } catch (error) {
488
- connectionStatus.textContent = 'Error: ' + error.message;
489
- connectionStatus.style.color = 'red';
490
- }
491
- });
492
-
493
- form.addEventListener('submit', async (e) => {
494
- e.preventDefault();
495
-
496
- if (eventSource) {
497
- eventSource.close();
498
- }
499
-
500
- logViewer.textContent = 'Starting Transformer(此步骤稍久)...\n';
501
- runBtn.disabled = true;
502
- downloadSection.classList.add('hidden');
503
-
504
- const formData = new FormData(form);
505
- const data = Object.fromEntries(formData.entries());
506
-
507
- // Handle multiple select for category (Buttons)
508
- const allBtn = document.getElementById('cat_btn_all');
509
- let selectedCategories = [];
510
-
511
- if (!allBtn.classList.contains('btn-primary')) {
512
- const activeBtns = document.querySelectorAll('.category-btn:not(#cat_btn_all).btn-primary');
513
- selectedCategories = Array.from(activeBtns).map(btn => btn.dataset.value);
514
- }
515
-
516
- if (selectedCategories.length > 0) {
517
- data.category = selectedCategories;
518
- } else {
519
- data.category = null;
520
- }
521
-
522
- try {
523
- const response = await fetch('/api/run-transformer-web', {
524
- method: 'POST',
525
- headers: { 'Content-Type': 'application/json' },
526
- body: JSON.stringify(data)
527
- });
528
-
529
- const result = await response.json();
530
-
531
- if (result.success) {
532
- const taskId = result.taskId;
533
- startLogStreaming(taskId);
534
- } else {
535
- logViewer.textContent += 'Error starting: ' + result.error;
536
- runBtn.disabled = false;
537
- }
538
- } catch (error) {
539
- logViewer.textContent += 'Error: ' + error.message;
540
- runBtn.disabled = false;
541
- }
542
- });
543
-
544
- function startLogStreaming(taskId) {
545
- eventSource = new EventSource(`/api/stream-transformer-logs/${taskId}`);
546
-
547
- eventSource.onmessage = (event) => {
548
- const data = JSON.parse(event.data);
549
- if (data.log) {
550
- logViewer.textContent += data.log; // + '\n';
551
- logViewer.scrollTop = logViewer.scrollHeight;
552
- }
553
-
554
- if (data.status === 'completed') {
555
- eventSource.close();
556
- runBtn.disabled = false;
557
- logViewer.textContent += '\nProcess Completed Successfully!';
558
-
559
- // Enable download
560
- downloadCandidatesBtn.href = `/api/download-transformer-result/${taskId}/candidates`;
561
- downloadSuccessBtn.href = `/api/download-transformer-result/${taskId}/success`;
562
- downloadErrorBtn.href = `/api/download-transformer-result/${taskId}/error`;
563
- downloadSection.classList.remove('hidden');
564
- } else if (data.status === 'error') {
565
- eventSource.close();
566
- runBtn.disabled = false;
567
- logViewer.textContent += '\nProcess Failed!';
568
- }
569
- };
570
-
571
- eventSource.onerror = () => {
572
- eventSource.close();
573
- runBtn.disabled = false;
574
- logViewer.textContent += '\nConnection lost.';
575
- };
576
- }
577
- </script>
578
- <script src="{{ url_for('static', filename='usage_widget.js') }}"></script>
579
- </body>
580
- </html>