jarvis-ai-assistant 0.1.208__py3-none-any.whl → 0.1.210__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.
- jarvis/__init__.py +1 -1
- jarvis/jarvis_agent/__init__.py +9 -59
- jarvis/jarvis_agent/edit_file_handler.py +1 -1
- jarvis/jarvis_code_agent/code_agent.py +55 -8
- jarvis/jarvis_code_agent/lint.py +1 -1
- jarvis/jarvis_data/config_schema.json +0 -25
- jarvis/jarvis_git_utils/git_commiter.py +2 -2
- jarvis/jarvis_platform/kimi.py +20 -11
- jarvis/jarvis_platform/tongyi.py +84 -74
- jarvis/jarvis_platform/yuanbao.py +60 -54
- jarvis/jarvis_tools/ask_user.py +0 -1
- jarvis/jarvis_tools/file_analyzer.py +0 -3
- jarvis/jarvis_utils/config.py +4 -49
- jarvis/jarvis_utils/embedding.py +6 -51
- jarvis/jarvis_utils/git_utils.py +74 -11
- jarvis/jarvis_utils/http.py +169 -0
- jarvis/jarvis_utils/utils.py +186 -63
- {jarvis_ai_assistant-0.1.208.dist-info → jarvis_ai_assistant-0.1.210.dist-info}/METADATA +5 -10
- {jarvis_ai_assistant-0.1.208.dist-info → jarvis_ai_assistant-0.1.210.dist-info}/RECORD +23 -24
- {jarvis_ai_assistant-0.1.208.dist-info → jarvis_ai_assistant-0.1.210.dist-info}/entry_points.txt +1 -0
- jarvis/jarvis_data/huggingface.tar.gz +0 -0
- jarvis/jarvis_utils/jarvis_history.py +0 -98
- {jarvis_ai_assistant-0.1.208.dist-info → jarvis_ai_assistant-0.1.210.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.1.208.dist-info → jarvis_ai_assistant-0.1.210.dist-info}/licenses/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.208.dist-info → jarvis_ai_assistant-0.1.210.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: jarvis-ai-assistant
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.210
|
4
4
|
Summary: Jarvis: An AI assistant that uses tools to interact with the system
|
5
5
|
Home-page: https://github.com/skyfireitdiy/Jarvis
|
6
6
|
Author: skyfire
|
@@ -48,13 +48,14 @@ Requires-Dist: fuzzywuzzy==0.18.0
|
|
48
48
|
Requires-Dist: fastapi==0.115.12
|
49
49
|
Requires-Dist: uvicorn==0.33.0
|
50
50
|
Requires-Dist: rich==14.0.0
|
51
|
-
Requires-Dist: transformers==4.46.3
|
52
|
-
Requires-Dist: torch==2.4.1
|
53
51
|
Requires-Dist: python-Levenshtein==0.25.1
|
52
|
+
Requires-Dist: tiktoken==0.7.0
|
54
53
|
Requires-Dist: pillow==10.2.0
|
55
54
|
Requires-Dist: openai==1.78.1
|
56
55
|
Requires-Dist: tabulate==0.9.0
|
57
56
|
Requires-Dist: pyte==0.8.2
|
57
|
+
Requires-Dist: pyyaml>=6.0.2
|
58
|
+
Requires-Dist: httpx>=0.28.1
|
58
59
|
Provides-Extra: dev
|
59
60
|
Requires-Dist: pytest; extra == "dev"
|
60
61
|
Requires-Dist: black; extra == "dev"
|
@@ -105,7 +106,7 @@ pip3 install jarvis-ai-assistant
|
|
105
106
|
| `jarvis` | - | 使用通用代理 |
|
106
107
|
| `jarvis-code-agent` | `jca` | 使用代码代理 |
|
107
108
|
| `jarvis-smart-shell` | `jss` | 使用智能shell功能 |
|
108
|
-
| `jarvis-platform-manager` |
|
109
|
+
| `jarvis-platform-manager` | `jpm` | 使用平台管理功能 |
|
109
110
|
| `jarvis-code-review` | - | 使用代码审查功能 |
|
110
111
|
| `jarvis-git-commit` | `jgc` | 使用自动化git commit功能 |
|
111
112
|
| `jarvis-git-squash` | - | 使用git squash功能 |
|
@@ -481,7 +482,6 @@ JARVIS_THINKING_PLATFORM: yuanbao
|
|
481
482
|
JARVIS_THINKING_MODEL: deep_seek
|
482
483
|
ENV:
|
483
484
|
YUANBAO_COOKIES: <元宝cookies>
|
484
|
-
YUANBAO_AGENT_ID: <元宝AgentID>
|
485
485
|
```
|
486
486
|
|
487
487
|
#### Kimi
|
@@ -520,23 +520,18 @@ OPENAI_API_BASE: https://api.openai.com/v1
|
|
520
520
|
| `ENV` | {} | 环境变量配置 |
|
521
521
|
| `JARVIS_MAX_TOKEN_COUNT` | 960000 | 上下文窗口的最大token数量 |
|
522
522
|
| `JARVIS_MAX_INPUT_TOKEN_COUNT` | 32000 | 输入的最大token数量 |
|
523
|
-
| `JARVIS_AUTO_COMPLETE` | false | 是否启用自动完成功能 |
|
524
|
-
| `JARVIS_SHELL_NAME` | bash | 系统shell名称 |
|
525
523
|
| `JARVIS_PLATFORM` | yuanbao | 默认AI平台 |
|
526
524
|
| `JARVIS_MODEL` | deep_seek_v3 | 默认模型 |
|
527
525
|
| `JARVIS_THINKING_PLATFORM` | JARVIS_PLATFORM | 推理任务使用的平台 |
|
528
526
|
| `JARVIS_THINKING_MODEL` | JARVIS_MODEL | 推理任务使用的模型 |
|
529
527
|
| `JARVIS_EXECUTE_TOOL_CONFIRM` | false | 执行工具前是否需要确认 |
|
530
528
|
| `JARVIS_CONFIRM_BEFORE_APPLY_PATCH` | false | 应用补丁前是否需要确认 |
|
531
|
-
| `JARVIS_MAX_TOOL_CALL_COUNT` | 20 | 最大连续工具调用次数 |
|
532
|
-
| `JARVIS_AUTO_UPDATE` | true | 是否自动更新Jarvis |
|
533
529
|
| `JARVIS_MAX_BIG_CONTENT_SIZE` | 160000 | 最大大内容大小 |
|
534
530
|
| `JARVIS_PRETTY_OUTPUT` | false | 是否启用PrettyOutput |
|
535
531
|
| `JARVIS_GIT_COMMIT_PROMPT` | "" | 自定义git提交信息生成提示模板 |
|
536
532
|
| `JARVIS_PRINT_PROMPT` | false | 是否打印提示 |
|
537
533
|
| `JARVIS_USE_METHODOLOGY` | true | 是否启用方法论功能 |
|
538
534
|
| `JARVIS_USE_ANALYSIS` | true | 是否启用任务分析功能 |
|
539
|
-
| `JARVIS_USE_HISTORY_COUNT` | 0 | 使用N次历史记录作为上下文记忆 |
|
540
535
|
| `JARVIS_DATA_PATH` | ~/.jarvis | Jarvis数据存储目录路径 |
|
541
536
|
|
542
537
|
## 🛠️ 工具说明 <a id="tools"></a>
|
@@ -1,14 +1,14 @@
|
|
1
|
-
jarvis/__init__.py,sha256=
|
2
|
-
jarvis/jarvis_agent/__init__.py,sha256=
|
1
|
+
jarvis/__init__.py,sha256=C0RxOVy8FTEwTYuX80VZUOqJoMzlTgvrlyWs2b71wag,75
|
2
|
+
jarvis/jarvis_agent/__init__.py,sha256=QbI5vkourPJZ2OR63RBZAtFptTYrZz_si8bIkc9EB2o,31709
|
3
3
|
jarvis/jarvis_agent/builtin_input_handler.py,sha256=1V7kV5Zhw2HE3Xgjs1R-43RZ2huq3Kg-32NCdNnyZmA,2216
|
4
|
-
jarvis/jarvis_agent/edit_file_handler.py,sha256=
|
4
|
+
jarvis/jarvis_agent/edit_file_handler.py,sha256=bIciBghx5maDz09x0XNTxdNsyrBbTND95GupVdJIVVg,16762
|
5
5
|
jarvis/jarvis_agent/jarvis.py,sha256=tTv9X1oSRDGRmNkM1F3RNN6ikFbc_PkRBIbZIffbA_8,5802
|
6
6
|
jarvis/jarvis_agent/main.py,sha256=c6bQe-8LXvW2-NBn9Rn_yPYdrwnkJ8KQaSFY2cPvkxw,2775
|
7
7
|
jarvis/jarvis_agent/output_handler.py,sha256=P7oWpXBGFfOsWq7cIhS_z9crkQ19ES7qU5pM92KKjAs,1172
|
8
8
|
jarvis/jarvis_agent/shell_input_handler.py,sha256=zVaKNthIHJh1j4g8_-d3w5ahNH9aH-ZNRSOourQpHR4,1328
|
9
9
|
jarvis/jarvis_code_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
jarvis/jarvis_code_agent/code_agent.py,sha256=
|
11
|
-
jarvis/jarvis_code_agent/lint.py,sha256=
|
10
|
+
jarvis/jarvis_code_agent/code_agent.py,sha256=x8CVDZstnRy2jemdnNN-avt1-wGntlSBD7qLlrk0qzU,17951
|
11
|
+
jarvis/jarvis_code_agent/lint.py,sha256=LZPsfyZPMo7Wm7LN4osZocuNJwZx1ojacO3MlF870x8,4009
|
12
12
|
jarvis/jarvis_code_analysis/code_review.py,sha256=uCCbGd4Y1RjDzhZoVE8JdN2avlwOfqimSDIrcM-KMew,30456
|
13
13
|
jarvis/jarvis_code_analysis/checklists/__init__.py,sha256=LIXAYa1sW3l7foP6kohLWnE98I_EQ0T7z5bYKHq6rJA,78
|
14
14
|
jarvis/jarvis_code_analysis/checklists/c_cpp.py,sha256=9t62bMqs6qTkFSio4SKkj88qyb5ZubWrw3MxJBQ4X1A,1317
|
@@ -30,13 +30,12 @@ jarvis/jarvis_code_analysis/checklists/shell.py,sha256=aRFYhQQvTgbYd-uY5pc8UHIUA
|
|
30
30
|
jarvis/jarvis_code_analysis/checklists/sql.py,sha256=vR0T6qC7b4dURjJVAd7kSVxyvZEQXPG1Jqc2sNTGp5c,2355
|
31
31
|
jarvis/jarvis_code_analysis/checklists/swift.py,sha256=TPx4I6Gupvs6tSerRKmTSKEPQpOLEbH2Y7LXg1uBgxc,2566
|
32
32
|
jarvis/jarvis_code_analysis/checklists/web.py,sha256=25gGD7pDadZQybNFvALYxWvK0VRjGQb1NVJQElwjyk0,3943
|
33
|
-
jarvis/jarvis_data/config_schema.json,sha256=
|
34
|
-
jarvis/jarvis_data/huggingface.tar.gz,sha256=dWKnc_tvyx-I_ZkXo91O0b38KxDmLW1ZbmJ3E6fCl_k,1120205
|
33
|
+
jarvis/jarvis_data/config_schema.json,sha256=BeaihTD2eYRZq65-tbmCIx7lBdS5U0V1FOQGIc6XCq0,5849
|
35
34
|
jarvis/jarvis_git_details/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
35
|
jarvis/jarvis_git_details/main.py,sha256=MjpUHB4ErR_SKPBx1TLLK_XLkH427RTtsyVn6EUd88Y,8907
|
37
36
|
jarvis/jarvis_git_squash/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
38
37
|
jarvis/jarvis_git_squash/main.py,sha256=lx0WVOiaydYgwzWBDG7C8wJxYJwSb1SIxyoD-rgzgvA,2274
|
39
|
-
jarvis/jarvis_git_utils/git_commiter.py,sha256=
|
38
|
+
jarvis/jarvis_git_utils/git_commiter.py,sha256=erZ3wNJuaEgHlKTaYv0UKargG_Yl9OnssTIcErEAdtw,12472
|
40
39
|
jarvis/jarvis_mcp/__init__.py,sha256=OPMtjD-uq9xAaKCRIDyKIosaFfBe1GBPu1az-mQ0rVM,2048
|
41
40
|
jarvis/jarvis_mcp/sse_mcp_client.py,sha256=-3Qy1LyqgHswoc6YbadVRG3ias2op7lUp7Ne2-QUKBM,22474
|
42
41
|
jarvis/jarvis_mcp/stdio_mcp_client.py,sha256=armvgyHAv-AxF5lqiK-TbVLzg3XgSCwmTdWmxBSTLRk,11248
|
@@ -47,22 +46,22 @@ jarvis/jarvis_multi_agent/main.py,sha256=h7VUSwoPrES0XTK8z5kt3XLX1mmcm8UEuFEHQOU
|
|
47
46
|
jarvis/jarvis_platform/__init__.py,sha256=WLQHSiE87PPket2M50_hHzjdMIgPIBx2VF8JfB_NNRk,105
|
48
47
|
jarvis/jarvis_platform/base.py,sha256=xN0DGYs03eS-wSQk4JgBOzFl0kvDAmqnssUU59EOXU8,7775
|
49
48
|
jarvis/jarvis_platform/human.py,sha256=r8Vlltp_LirJZeZh1Mmi30iJr9tl1JaNFoqthSRHF6o,2826
|
50
|
-
jarvis/jarvis_platform/kimi.py,sha256=
|
49
|
+
jarvis/jarvis_platform/kimi.py,sha256=W5MKkH6rxS5JeNY3VZY0EOT9ugeZJqr_eHO9wd9cEW4,12444
|
51
50
|
jarvis/jarvis_platform/openai.py,sha256=uEjBikfFj7kp5wondLvOx4WdkmTX0aqF6kixxAufcHg,4806
|
52
51
|
jarvis/jarvis_platform/registry.py,sha256=Sz4ADAaxuufpAQG0KSQZuL1yALzH-aF3FDapkNn5foE,8107
|
53
|
-
jarvis/jarvis_platform/tongyi.py,sha256=
|
54
|
-
jarvis/jarvis_platform/yuanbao.py,sha256=
|
52
|
+
jarvis/jarvis_platform/tongyi.py,sha256=juvzMjZ2mbNzSWzem8snmFuE28YVOjjE_YdHCZa9Qnw,20698
|
53
|
+
jarvis/jarvis_platform/yuanbao.py,sha256=ZsKXWifESXGfvB9eOot1I6TnhlmgXwnaft3e2UXgSXk,21045
|
55
54
|
jarvis/jarvis_platform_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
56
55
|
jarvis/jarvis_platform_manager/main.py,sha256=Jm1ijKGZrSYo1HrgJ1R4JQZwPwiOIfDFYSVJXKPklPU,15585
|
57
56
|
jarvis/jarvis_platform_manager/service.py,sha256=rY1FmNl-tmbkkke_3SlH9h6ckyPIgmSwbaRorURp9Cc,14916
|
58
57
|
jarvis/jarvis_smart_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
59
58
|
jarvis/jarvis_smart_shell/main.py,sha256=DbhRSP1sZfSIaTltP1YWVDSQOTYEsbiOnfO9kSYwcNs,6959
|
60
59
|
jarvis/jarvis_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
61
|
-
jarvis/jarvis_tools/ask_user.py,sha256=
|
60
|
+
jarvis/jarvis_tools/ask_user.py,sha256=iz2PTGx66IRL8e4DOpj3XhEGHFWeKQl0ggEOl_zOwQ0,1972
|
62
61
|
jarvis/jarvis_tools/base.py,sha256=tFVmK6ppsImW2BzHZmrNmMRiOJdW-4aZP6Me3VxdYcA,1194
|
63
62
|
jarvis/jarvis_tools/edit_file.py,sha256=Hvqc5YyrwzlEbUT1CsarlKKaPj852970jszKjS5YMPE,11757
|
64
63
|
jarvis/jarvis_tools/execute_script.py,sha256=gMarE5yCCSPU6Dp6HlcL2KT-2xCzR-1p-oQNlYOJK58,6157
|
65
|
-
jarvis/jarvis_tools/file_analyzer.py,sha256=
|
64
|
+
jarvis/jarvis_tools/file_analyzer.py,sha256=aVe1jBSp0YmlypihxrGADJpYrU_7CxDETxGUNySuSlI,4044
|
66
65
|
jarvis/jarvis_tools/generate_new_tool.py,sha256=2YAs8DC7fJnxOkjSmhmSAwqSpBlicVhYc06WZ8YVBls,7679
|
67
66
|
jarvis/jarvis_tools/methodology.py,sha256=_K4GIDUodGEma3SvNRo7Qs5rliijgNespVLyAPN35JU,5233
|
68
67
|
jarvis/jarvis_tools/read_code.py,sha256=EnI-R-5HyIQYhMD391nZWXHIuHHBF-OJIRE0QpLcPX4,6417
|
@@ -75,20 +74,20 @@ jarvis/jarvis_tools/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
|
|
75
74
|
jarvis/jarvis_tools/cli/main.py,sha256=Mg6TQDxMdzB1Ua1UrZ2EE-uQWsbaeojWaEGHJp2HimA,6375
|
76
75
|
jarvis/jarvis_utils/__init__.py,sha256=67h0ldisGlh3oK4DAeNEL2Bl_VsI3tSmfclasyVlueM,850
|
77
76
|
jarvis/jarvis_utils/builtin_replace_map.py,sha256=EI8JnHqr-ZpAhpwocTu48DhHUMHNd8tNUpDNYI47OLE,1717
|
78
|
-
jarvis/jarvis_utils/config.py,sha256=
|
79
|
-
jarvis/jarvis_utils/embedding.py,sha256=
|
77
|
+
jarvis/jarvis_utils/config.py,sha256=MO2-1z_7f3KkSrv7heGK1650Zb0SjnljO2hzLE2jA5c,6598
|
78
|
+
jarvis/jarvis_utils/embedding.py,sha256=nOe_jvn8pr4env83D9gNCBcId8LaUsvQxa8awLP1_2Y,2437
|
80
79
|
jarvis/jarvis_utils/file_processors.py,sha256=XiM248SHS7lLgQDCbORVFWqinbVDUawYxWDOsLXDxP8,3043
|
81
|
-
jarvis/jarvis_utils/git_utils.py,sha256=
|
80
|
+
jarvis/jarvis_utils/git_utils.py,sha256=VBf1_9xM75kQSKSFFtKRdP-_3rVpdlt9scnjYlTeHGc,21397
|
82
81
|
jarvis/jarvis_utils/globals.py,sha256=9NTMfCVd0jvtloOv14-KE6clhcVStFmyN9jWxLmQ5so,3369
|
82
|
+
jarvis/jarvis_utils/http.py,sha256=Uqt1kcz0HWnAfXHHi1fNGwLb2lcVUqpbrG2Uk_-kcIU,4882
|
83
83
|
jarvis/jarvis_utils/input.py,sha256=ehvHkIgwqnBOHkwOeRCBFRggqOgOZuUdGQXn2ATUFwU,8049
|
84
|
-
jarvis/jarvis_utils/jarvis_history.py,sha256=Td6cmze9Oc5-Ewz0l9RKYeSg_-fbEu9ZhyEueHEMcLY,3664
|
85
84
|
jarvis/jarvis_utils/methodology.py,sha256=-cvM6pwgJK7BXCYg2uVjIId_j3v5RUh2z2PBcK_2vj4,8155
|
86
85
|
jarvis/jarvis_utils/output.py,sha256=PRCgudPOB8gMEP3u-g0FGD2c6tBgJhLXUMqNPglfjV8,10813
|
87
86
|
jarvis/jarvis_utils/tag.py,sha256=f211opbbbTcSyzCDwuIK_oCnKhXPNK-RknYyGzY1yD0,431
|
88
|
-
jarvis/jarvis_utils/utils.py,sha256=
|
89
|
-
jarvis_ai_assistant-0.1.
|
90
|
-
jarvis_ai_assistant-0.1.
|
91
|
-
jarvis_ai_assistant-0.1.
|
92
|
-
jarvis_ai_assistant-0.1.
|
93
|
-
jarvis_ai_assistant-0.1.
|
94
|
-
jarvis_ai_assistant-0.1.
|
87
|
+
jarvis/jarvis_utils/utils.py,sha256=zgkdtpQ6kN86pzYi0iBBa3IUJp_GMrm31RKh5V_6Vzg,15306
|
88
|
+
jarvis_ai_assistant-0.1.210.dist-info/licenses/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
|
89
|
+
jarvis_ai_assistant-0.1.210.dist-info/METADATA,sha256=CHgOUpcFWMUDiGpyAPis5qVu50OR6btWYFuBuESVbMs,19564
|
90
|
+
jarvis_ai_assistant-0.1.210.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
91
|
+
jarvis_ai_assistant-0.1.210.dist-info/entry_points.txt,sha256=SF46ViTZcQVZEfbqzJDKKVc9TrN1x-P1mQ6wup7u2HY,875
|
92
|
+
jarvis_ai_assistant-0.1.210.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
|
93
|
+
jarvis_ai_assistant-0.1.210.dist-info/RECORD,,
|
{jarvis_ai_assistant-0.1.208.dist-info → jarvis_ai_assistant-0.1.210.dist-info}/entry_points.txt
RENAMED
@@ -13,4 +13,5 @@ jarvis-smart-shell = jarvis.jarvis_smart_shell.main:main
|
|
13
13
|
jarvis-tool = jarvis.jarvis_tools.cli.main:main
|
14
14
|
jca = jarvis.jarvis_code_agent.code_agent:main
|
15
15
|
jgc = jarvis.jarvis_git_utils.git_commiter:main
|
16
|
+
jpm = jarvis.jarvis_platform_manager.main:main
|
16
17
|
jss = jarvis.jarvis_smart_shell.main:main
|
Binary file
|
@@ -1,98 +0,0 @@
|
|
1
|
-
import glob
|
2
|
-
import os
|
3
|
-
from datetime import datetime
|
4
|
-
from typing import Dict, List, Optional, Union
|
5
|
-
|
6
|
-
import yaml
|
7
|
-
|
8
|
-
|
9
|
-
class JarvisHistory:
|
10
|
-
def __init__(self):
|
11
|
-
self.records: List[Dict[str, str]] = []
|
12
|
-
self.current_file: Optional[str] = None
|
13
|
-
|
14
|
-
def start_record(self, data_dir: str) -> None:
|
15
|
-
"""Start a new recording session with timestamped filename"""
|
16
|
-
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
17
|
-
self.current_file = os.path.join(data_dir, f"history_{timestamp}.yaml")
|
18
|
-
self.records = []
|
19
|
-
|
20
|
-
def append_msg(self, role: str, msg: str) -> None:
|
21
|
-
"""Append a message to current recording session"""
|
22
|
-
if not self.current_file:
|
23
|
-
raise RuntimeError("Recording not started. Call start_record first.")
|
24
|
-
self.records.append({"role": role, "message": msg})
|
25
|
-
|
26
|
-
def save_history(self, filename: str) -> None:
|
27
|
-
"""Save recorded messages to YAML file"""
|
28
|
-
|
29
|
-
# Skip saving if records is empty
|
30
|
-
if not self.records:
|
31
|
-
return
|
32
|
-
|
33
|
-
# Ensure directory exists
|
34
|
-
os.makedirs(os.path.dirname(filename), exist_ok=True)
|
35
|
-
|
36
|
-
with open(filename, "w") as f:
|
37
|
-
yaml.safe_dump({"conversation": self.records}, f, allow_unicode=True)
|
38
|
-
|
39
|
-
def stop_record(self) -> None:
|
40
|
-
"""Stop recording session and save messages"""
|
41
|
-
if not self.current_file:
|
42
|
-
raise RuntimeError("No recording session to stop.")
|
43
|
-
|
44
|
-
self.save_history(self.current_file)
|
45
|
-
self.current_file = None
|
46
|
-
self.records = []
|
47
|
-
|
48
|
-
@staticmethod
|
49
|
-
def export_history_to_markdown(
|
50
|
-
input_dir: str, output_file: str, max_files: Optional[int] = None
|
51
|
-
) -> None:
|
52
|
-
"""
|
53
|
-
Export all history files in the directory to a single markdown file
|
54
|
-
|
55
|
-
Args:
|
56
|
-
input_dir: Directory containing history YAML files
|
57
|
-
output_file: Path to output markdown file
|
58
|
-
max_files: Maximum number of history files to export (None for all)
|
59
|
-
"""
|
60
|
-
# Find all history files in the directory
|
61
|
-
history_files = glob.glob(os.path.join(input_dir, "history_*.yaml"))
|
62
|
-
|
63
|
-
if not history_files:
|
64
|
-
raise FileNotFoundError(f"No history files found in {input_dir}")
|
65
|
-
|
66
|
-
# Sort files by modification time (newest first) and limit to max_files
|
67
|
-
history_files.sort(key=os.path.getmtime, reverse=True)
|
68
|
-
if max_files is not None:
|
69
|
-
history_files = history_files[:max_files]
|
70
|
-
|
71
|
-
# Ensure output directory exists
|
72
|
-
os.makedirs(os.path.dirname(output_file), exist_ok=True)
|
73
|
-
|
74
|
-
with open(output_file, "w", encoding="utf-8") as md_file:
|
75
|
-
md_file.write("# Jarvis Conversation History\n\n")
|
76
|
-
|
77
|
-
for history_file in sorted(history_files):
|
78
|
-
# Read YAML file
|
79
|
-
with open(history_file, "r", encoding="utf-8") as f:
|
80
|
-
data = yaml.safe_load(f)
|
81
|
-
|
82
|
-
if not data or "conversation" not in data:
|
83
|
-
continue
|
84
|
-
|
85
|
-
# Write file header with timestamp from filename
|
86
|
-
timestamp = os.path.basename(history_file)[
|
87
|
-
8:-5
|
88
|
-
] # Extract timestamp from "history_YYYYMMDD_HHMMSS.yaml"
|
89
|
-
md_file.write(
|
90
|
-
f"## Conversation at {timestamp[:4]}-{timestamp[4:6]}-{timestamp[6:8]} "
|
91
|
-
f"{timestamp[9:11]}:{timestamp[11:13]}:{timestamp[13:15]}\n\n"
|
92
|
-
)
|
93
|
-
|
94
|
-
# Write conversation messages
|
95
|
-
for msg in data["conversation"]:
|
96
|
-
md_file.write(f"**{msg['role']}**: {msg['message']}\n\n")
|
97
|
-
|
98
|
-
md_file.write("\n---\n\n")
|
File without changes
|
{jarvis_ai_assistant-0.1.208.dist-info → jarvis_ai_assistant-0.1.210.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
{jarvis_ai_assistant-0.1.208.dist-info → jarvis_ai_assistant-0.1.210.dist-info}/top_level.txt
RENAMED
File without changes
|