cnhkmcp 2.1.3__py3-none-any.whl → 2.1.4__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 (192) hide show
  1. cnhkmcp/__init__.py +126 -0
  2. 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 +38 -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/ace.log +0 -0
  4. 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 +6 -0
  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/get_knowledgeBase_tool/ace_lib.py +1514 -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/fetch_all_datasets.py +157 -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/get_knowledgeBase_tool/fetch_all_documentation.py +132 -0
  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/fetch_all_operators.py +99 -0
  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/helpful_functions.py +180 -0
  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/icon.ico +0 -0
  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/icon.png +0 -0
  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/knowledge/001_10_Steps_to_Start_on_BRAIN_documentation.json +14 -0
  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/knowledge/001_Intermediate_Pack_-_Improve_your_Alpha_2_2_documentation.json +174 -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/knowledge/001_Intermediate_Pack_-_Understand_Results_1_2_documentation.json +167 -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/001_Introduction_to_Alphas_documentation.json +145 -0
  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/knowledge/001_Introduction_to_BRAIN_Expression_Language_documentation.json +107 -0
  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/knowledge/001_WorldQuant_Challenge_documentation.json +56 -0
  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/knowledge/001__Read_this_First_-_Starter_Pack_documentation.json +404 -0
  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/knowledge/002_How_to_choose_the_Simulation_Settings_documentation.json +268 -0
  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/knowledge/002_Simulate_your_first_Alpha_documentation.json +88 -0
  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/knowledge/002__Alpha_Examples_for_Beginners_documentation.json +254 -0
  22. 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/002__Alpha_Examples_for_Bronze_Users_documentation.json +114 -0
  23. 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/002__Alpha_Examples_for_Silver_Users_documentation.json +79 -0
  24. 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/002__How_BRAIN_works_documentation.json +184 -0
  25. 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/003_Clear_these_tests_before_submitting_an_Alpha_documentation.json +388 -0
  26. 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/003_Parameters_in_the_Simulation_results_documentation.json +243 -0
  27. 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/004_Group_Data_Fields_documentation.json +69 -0
  28. 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/004_How_to_use_the_Data_Explorer_documentation.json +142 -0
  29. 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/004_Model77_dataset_documentation.json +14 -0
  30. 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/004_Sentiment1_dataset_documentation.json +14 -0
  31. 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/004_Understanding_Data_in_BRAIN_Key_Concepts_and_Tips_documentation.json +182 -0
  32. 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/004_Vector_Data_Fields_documentation.json +30 -0
  33. 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/005_Crowding_Risk-Neutralized_Alphas_documentation.json +64 -0
  34. 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/005_D0_documentation.json +66 -0
  35. 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/005_Double_Neutralization_documentation.json +53 -0
  36. 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/005_Fast_D1_Documentation_documentation.json +304 -0
  37. 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/005_Investability_Constrained_Metrics_documentation.json +129 -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/knowledge/005_Must-read_posts_How_to_improve_your_Alphas_documentation.json +14 -0
  39. 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/005_Neutralization_documentation.json +29 -0
  40. 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/005_RAM_Risk-Neutralized_Alphas_documentation.json +64 -0
  41. 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/005_Risk_Neutralization_Default_setting_documentation.json +75 -0
  42. 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/005_Risk_Neutralized_Alphas_documentation.json +171 -0
  43. 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/005_Statistical_Risk-Neutralized_Alphas_documentation.json +51 -0
  44. 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/006_EUR_TOP2500_Universe_documentation.json +35 -0
  45. 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/006_GLB_TOPDIV3000_Universe_documentation.json +48 -0
  46. 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/006_Getting_Started_China_Research_for_Consultants_Gold_documentation.json +142 -0
  47. 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/006_Getting_started_on_Illiquid_Universes_Gold_documentation.json +46 -0
  48. 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/006_Getting_started_with_USA_TOPSP500_universe_Gold_documentation.json +62 -0
  49. 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/006_Global_Alphas_Gold_documentation.json +66 -0
  50. 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/006_India_Alphas_documentation.json +35 -0
  51. 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/007_Consultant_Dos_and_Don_ts_documentation.json +35 -0
  52. 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/007_Consultant_Features_documentation.json +239 -0
  53. 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/007_Consultant_Simulation_Features_documentation.json +149 -0
  54. 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/007_Consultant_Submission_Tests_documentation.json +363 -0
  55. 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/007_Finding_Consultant_Alphas_documentation.json +333 -0
  56. 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/007_Power_Pool_Alphas_documentation.json +14 -0
  57. 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/007_Research_Advisory_Program_documentation.json +35 -0
  58. 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/007_Starting_Guide_for_Research_Consultants_documentation.json +14 -0
  59. 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/007_Visualization_Tool_documentation.json +99 -0
  60. 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/007_Your_Advisor_-_Kunqi_Jiang_documentation.json +53 -0
  61. 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/007__Brain_Genius_documentation.json +288 -0
  62. 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/007__Single_Dataset_Alphas_documentation.json +41 -0
  63. 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/008_Advisory_Theme_Calendar_documentation.json +14 -0
  64. 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/008_Multiplier_Rules_documentation.json +14 -0
  65. 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/008_Overview_of_Themes_documentation.json +14 -0
  66. 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/008_Theme_Calendar_documentation.json +14 -0
  67. 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/009_Combo_Expression_documentation.json +272 -0
  68. 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/009_Global_SuperAlphas_documentation.json +14 -0
  69. 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/009_Helpful_Tips_documentation.json +58 -0
  70. 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/009_Selection_Expression_documentation.json +1546 -0
  71. 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/009_SuperAlpha_Operators_documentation.json +890 -0
  72. 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/009_SuperAlpha_Results_documentation.json +83 -0
  73. 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/009_What_is_a_SuperAlpha_documentation.json +261 -0
  74. 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/010_BRAIN_API_documentation.json +515 -0
  75. 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/010_Documentation_for_ACE_API_Library_Gold_documentation.json +27 -0
  76. 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/010__Understanding_simulation_limits_documentation.json +210 -0
  77. 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/arithmetic_operators.json +209 -0
  78. 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/cross_sectional_operators.json +98 -0
  79. 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/group_operators.json +121 -0
  80. 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/logical_operators.json +145 -0
  81. 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/reduce_operators.json +156 -0
  82. 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/special_operators.json +35 -0
  83. 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 +1 -0
  84. 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/time_series_operators.json +386 -0
  85. 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/transformational_operators.json +61 -0
  86. 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/vector_operators.json +38 -0
  87. 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 +576 -0
  88. 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 +281 -0
  89. 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 +408 -0
  90. 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 +7 -0
  91. 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 +3 -0
  92. 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/vector_db/_manifest.json +302 -0
  93. 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/vector_db/_meta.json +1 -0
  94. 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/vector_db/chroma.sqlite3 +0 -0
  95. 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 +265 -0
  96. cnhkmcp/untracked/APP/.gitignore +32 -0
  97. cnhkmcp/untracked/APP/MODULAR_STRUCTURE.md +112 -0
  98. cnhkmcp/untracked/APP/README.md +309 -0
  99. cnhkmcp/untracked/APP/Tranformer/Transformer.py +4989 -0
  100. cnhkmcp/untracked/APP/Tranformer/ace.log +0 -0
  101. cnhkmcp/untracked/APP/Tranformer/ace_lib.py +1514 -0
  102. cnhkmcp/untracked/APP/Tranformer/helpful_functions.py +180 -0
  103. cnhkmcp/untracked/APP/Tranformer/output/Alpha_candidates.json +7187 -0
  104. cnhkmcp/untracked/APP/Tranformer/output/Alpha_candidates_/321/207/320/264/342/225/221/321/204/342/225/233/320/233.json +654 -0
  105. cnhkmcp/untracked/APP/Tranformer/output/Alpha_generated_expressions_error.json +1 -0
  106. cnhkmcp/untracked/APP/Tranformer/output/Alpha_generated_expressions_success.json +47312 -0
  107. 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 +22 -0
  108. cnhkmcp/untracked/APP/Tranformer/parsetab.py +60 -0
  109. cnhkmcp/untracked/APP/Tranformer/template_summary.txt +3182 -0
  110. cnhkmcp/untracked/APP/Tranformer/transformer_config.json +7 -0
  111. cnhkmcp/untracked/APP/Tranformer/validator.py +889 -0
  112. cnhkmcp/untracked/APP/ace.log +69 -0
  113. cnhkmcp/untracked/APP/ace_lib.py +1514 -0
  114. cnhkmcp/untracked/APP/blueprints/__init__.py +6 -0
  115. cnhkmcp/untracked/APP/blueprints/feature_engineering.py +347 -0
  116. cnhkmcp/untracked/APP/blueprints/idea_house.py +221 -0
  117. cnhkmcp/untracked/APP/blueprints/inspiration_house.py +432 -0
  118. cnhkmcp/untracked/APP/blueprints/paper_analysis.py +570 -0
  119. cnhkmcp/untracked/APP/custom_templates/templates.json +1257 -0
  120. cnhkmcp/untracked/APP/give_me_idea/BRAIN_Alpha_Template_Expert_SystemPrompt.md +400 -0
  121. cnhkmcp/untracked/APP/give_me_idea/ace_lib.py +1514 -0
  122. cnhkmcp/untracked/APP/give_me_idea/alpha_data_specific_template_master.py +252 -0
  123. cnhkmcp/untracked/APP/give_me_idea/fetch_all_datasets.py +157 -0
  124. cnhkmcp/untracked/APP/give_me_idea/fetch_all_operators.py +99 -0
  125. cnhkmcp/untracked/APP/give_me_idea/helpful_functions.py +180 -0
  126. cnhkmcp/untracked/APP/give_me_idea/what_is_Alpha_template.md +11 -0
  127. cnhkmcp/untracked/APP/helpful_functions.py +180 -0
  128. cnhkmcp/untracked/APP/hkSimulator/ace_lib.py +1501 -0
  129. cnhkmcp/untracked/APP/hkSimulator/autosimulator.py +447 -0
  130. cnhkmcp/untracked/APP/hkSimulator/helpful_functions.py +180 -0
  131. cnhkmcp/untracked/APP/mirror_config.txt +20 -0
  132. cnhkmcp/untracked/APP/operaters.csv +129 -0
  133. cnhkmcp/untracked/APP/requirements.txt +53 -0
  134. cnhkmcp/untracked/APP/run_app.bat +28 -0
  135. cnhkmcp/untracked/APP/run_app.sh +34 -0
  136. cnhkmcp/untracked/APP/setup_tsinghua.bat +39 -0
  137. cnhkmcp/untracked/APP/setup_tsinghua.sh +43 -0
  138. cnhkmcp/untracked/APP/simulator/alpha_submitter.py +404 -0
  139. cnhkmcp/untracked/APP/simulator/simulator_wqb.py +618 -0
  140. cnhkmcp/untracked/APP/simulator/wqb20260107015647.log +57 -0
  141. cnhkmcp/untracked/APP/ssrn-3332513.pdf +109188 -19
  142. cnhkmcp/untracked/APP/static/brain.js +589 -0
  143. cnhkmcp/untracked/APP/static/decoder.js +1540 -0
  144. cnhkmcp/untracked/APP/static/feature_engineering.js +1729 -0
  145. cnhkmcp/untracked/APP/static/idea_house.js +937 -0
  146. cnhkmcp/untracked/APP/static/inspiration.js +465 -0
  147. cnhkmcp/untracked/APP/static/inspiration_house.js +868 -0
  148. cnhkmcp/untracked/APP/static/paper_analysis.js +390 -0
  149. cnhkmcp/untracked/APP/static/script.js +3082 -0
  150. cnhkmcp/untracked/APP/static/simulator.js +597 -0
  151. cnhkmcp/untracked/APP/static/styles.css +3127 -0
  152. cnhkmcp/untracked/APP/static/usage_widget.js +508 -0
  153. cnhkmcp/untracked/APP/templates/alpha_inspector.html +511 -0
  154. cnhkmcp/untracked/APP/templates/feature_engineering.html +960 -0
  155. cnhkmcp/untracked/APP/templates/idea_house.html +564 -0
  156. cnhkmcp/untracked/APP/templates/index.html +932 -0
  157. cnhkmcp/untracked/APP/templates/inspiration_house.html +861 -0
  158. cnhkmcp/untracked/APP/templates/paper_analysis.html +91 -0
  159. cnhkmcp/untracked/APP/templates/simulator.html +343 -0
  160. cnhkmcp/untracked/APP/templates/transformer_web.html +580 -0
  161. cnhkmcp/untracked/APP/usage.md +351 -0
  162. 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 +1514 -0
  163. 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 +712 -0
  164. 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 +180 -0
  165. 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 +2460 -0
  166. cnhkmcp/untracked/__init__.py +0 -0
  167. cnhkmcp/untracked/arXiv_API_Tool_Manual.md +490 -0
  168. cnhkmcp/untracked/arxiv_api.py +229 -0
  169. cnhkmcp/untracked/forum_functions.py +998 -0
  170. 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 +407 -0
  171. 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 +2601 -0
  172. 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 +31 -0
  173. 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 +101 -0
  174. 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 +190 -0
  175. cnhkmcp/untracked/platform_functions.py +2886 -0
  176. cnhkmcp/untracked/sample_mcp_config.json +11 -0
  177. cnhkmcp/untracked/user_config.json +31 -0
  178. 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 +202 -0
  179. 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 +56 -0
  180. 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 +194 -0
  181. 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 +101 -0
  182. 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 +436 -0
  183. 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 +128 -0
  184. 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 +190 -0
  185. {cnhkmcp-2.1.3.dist-info → cnhkmcp-2.1.4.dist-info}/METADATA +1 -1
  186. cnhkmcp-2.1.4.dist-info/RECORD +190 -0
  187. cnhkmcp-2.1.4.dist-info/top_level.txt +1 -0
  188. cnhkmcp-2.1.3.dist-info/RECORD +0 -6
  189. cnhkmcp-2.1.3.dist-info/top_level.txt +0 -1
  190. {cnhkmcp-2.1.3.dist-info → cnhkmcp-2.1.4.dist-info}/WHEEL +0 -0
  191. {cnhkmcp-2.1.3.dist-info → cnhkmcp-2.1.4.dist-info}/entry_points.txt +0 -0
  192. {cnhkmcp-2.1.3.dist-info → cnhkmcp-2.1.4.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,580 @@
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>