auto-coder 0.1.172__tar.gz → 0.1.173__tar.gz

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.

Potentially problematic release.


This version of auto-coder might be problematic. Click here for more details.

Files changed (113) hide show
  1. {auto-coder-0.1.172 → auto-coder-0.1.173}/PKG-INFO +3 -1
  2. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/auto_coder.egg-info/PKG-INFO +3 -1
  3. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/auto_coder.egg-info/SOURCES.txt +1 -0
  4. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/auto_coder.egg-info/requires.txt +2 -0
  5. auto-coder-0.1.173/src/autocoder/agent/designer.py +385 -0
  6. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/auto_coder.py +26 -1
  7. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/auto_coder_lang.py +2 -0
  8. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/chat_auto_coder.py +144 -21
  9. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/chat_auto_coder_lang.py +3 -0
  10. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/command_args.py +12 -2
  11. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/__init__.py +3 -0
  12. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/command_completer.py +4 -0
  13. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/command_generator.py +4 -5
  14. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/lang.py +2 -0
  15. auto-coder-0.1.173/src/autocoder/version.py +1 -0
  16. auto-coder-0.1.172/src/autocoder/version.py +0 -1
  17. {auto-coder-0.1.172 → auto-coder-0.1.173}/LICENSE +0 -0
  18. {auto-coder-0.1.172 → auto-coder-0.1.173}/README.md +0 -0
  19. {auto-coder-0.1.172 → auto-coder-0.1.173}/setup.cfg +0 -0
  20. {auto-coder-0.1.172 → auto-coder-0.1.173}/setup.py +0 -0
  21. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/auto_coder.egg-info/dependency_links.txt +0 -0
  22. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/auto_coder.egg-info/entry_points.txt +0 -0
  23. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/auto_coder.egg-info/top_level.txt +0 -0
  24. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/__init__.py +0 -0
  25. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/agent/__init__.py +0 -0
  26. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/agent/auto_tool.py +0 -0
  27. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/agent/coder.py +0 -0
  28. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/agent/planner.py +0 -0
  29. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/agent/project_reader.py +0 -0
  30. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/auto_coder_rag.py +0 -0
  31. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/auto_coder_server.py +0 -0
  32. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/chat/__init__.py +0 -0
  33. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/JupyterClient.py +0 -0
  34. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/ShellClient.py +0 -0
  35. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/anything2images.py +0 -0
  36. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/audio.py +0 -0
  37. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/cleaner.py +0 -0
  38. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/code_auto_execute.py +0 -0
  39. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/code_auto_generate.py +0 -0
  40. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/code_auto_generate_diff.py +0 -0
  41. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/code_auto_generate_editblock.py +0 -0
  42. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/code_auto_generate_strict_diff.py +0 -0
  43. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/code_auto_merge.py +0 -0
  44. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/code_auto_merge_diff.py +0 -0
  45. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/code_auto_merge_editblock.py +0 -0
  46. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/code_auto_merge_strict_diff.py +0 -0
  47. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/command_templates.py +0 -0
  48. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/const.py +0 -0
  49. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/git_utils.py +0 -0
  50. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/image_to_page.py +0 -0
  51. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/interpreter.py +0 -0
  52. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/llm_rerank.py +0 -0
  53. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/screenshots.py +0 -0
  54. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/search.py +0 -0
  55. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/search_replace.py +0 -0
  56. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/text.py +0 -0
  57. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/common/types.py +0 -0
  58. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/db/__init__.py +0 -0
  59. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/db/store.py +0 -0
  60. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/dispacher/__init__.py +0 -0
  61. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/dispacher/actions/__init__.py +0 -0
  62. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/dispacher/actions/action.py +0 -0
  63. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/dispacher/actions/copilot.py +0 -0
  64. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/dispacher/actions/plugins/__init__.py +0 -0
  65. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/dispacher/actions/plugins/action_regex_project.py +0 -0
  66. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/dispacher/actions/plugins/action_translate.py +0 -0
  67. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/index/__init__.py +0 -0
  68. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/index/for_command.py +0 -0
  69. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/index/index.py +0 -0
  70. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/index/symbols_utils.py +0 -0
  71. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/pyproject/__init__.py +0 -0
  72. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/__init__.py +0 -0
  73. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/api_server.py +0 -0
  74. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/doc_filter.py +0 -0
  75. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/document_retriever.py +0 -0
  76. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/llm_wrapper.py +0 -0
  77. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/loaders/__init__.py +0 -0
  78. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/loaders/docx_loader.py +0 -0
  79. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/loaders/excel_loader.py +0 -0
  80. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/loaders/pdf_loader.py +0 -0
  81. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/loaders/ppt_loader.py +0 -0
  82. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/long_context_rag.py +0 -0
  83. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/rag_config.py +0 -0
  84. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/rag_entry.py +0 -0
  85. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/raw_rag.py +0 -0
  86. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/relevant_utils.py +0 -0
  87. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/simple_directory_reader.py +0 -0
  88. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/simple_rag.py +0 -0
  89. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/token_checker.py +0 -0
  90. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/token_counter.py +0 -0
  91. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/token_limiter.py +0 -0
  92. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/rag/types.py +0 -0
  93. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/regexproject/__init__.py +0 -0
  94. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/suffixproject/__init__.py +0 -0
  95. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/tsproject/__init__.py +0 -0
  96. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/utils/__init__.py +0 -0
  97. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/utils/conversation_store.py +0 -0
  98. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/utils/llm_client_interceptors.py +0 -0
  99. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/utils/log_capture.py +0 -0
  100. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/utils/multi_turn.py +0 -0
  101. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/utils/print_table.py +0 -0
  102. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/utils/queue_communicate.py +0 -0
  103. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/utils/request_event_queue.py +0 -0
  104. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/utils/request_queue.py +0 -0
  105. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/utils/rest.py +0 -0
  106. {auto-coder-0.1.172 → auto-coder-0.1.173}/src/autocoder/utils/tests.py +0 -0
  107. {auto-coder-0.1.172 → auto-coder-0.1.173}/tests/test_action_regex_project.py +0 -0
  108. {auto-coder-0.1.172 → auto-coder-0.1.173}/tests/test_chat_auto_coder.py +0 -0
  109. {auto-coder-0.1.172 → auto-coder-0.1.173}/tests/test_code_auto_merge_editblock.py +0 -0
  110. {auto-coder-0.1.172 → auto-coder-0.1.173}/tests/test_command_completer.py +0 -0
  111. {auto-coder-0.1.172 → auto-coder-0.1.173}/tests/test_planner.py +0 -0
  112. {auto-coder-0.1.172 → auto-coder-0.1.173}/tests/test_queue_communicate.py +0 -0
  113. {auto-coder-0.1.172 → auto-coder-0.1.173}/tests/test_symbols_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: auto-coder
3
- Version: 0.1.172
3
+ Version: 0.1.173
4
4
  Summary: AutoCoder: AutoCoder
5
5
  Author: allwefantasy
6
6
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
@@ -47,6 +47,8 @@ Requires-Dist: pathspec
47
47
  Requires-Dist: openpyxl
48
48
  Requires-Dist: python-pptx
49
49
  Requires-Dist: watchfiles
50
+ Requires-Dist: cairosvg
51
+ Requires-Dist: matplotlib
50
52
 
51
53
  <p align="center">
52
54
  <picture>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: auto-coder
3
- Version: 0.1.172
3
+ Version: 0.1.173
4
4
  Summary: AutoCoder: AutoCoder
5
5
  Author: allwefantasy
6
6
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
@@ -47,6 +47,8 @@ Requires-Dist: pathspec
47
47
  Requires-Dist: openpyxl
48
48
  Requires-Dist: python-pptx
49
49
  Requires-Dist: watchfiles
50
+ Requires-Dist: cairosvg
51
+ Requires-Dist: matplotlib
50
52
 
51
53
  <p align="center">
52
54
  <picture>
@@ -20,6 +20,7 @@ src/autocoder/version.py
20
20
  src/autocoder/agent/__init__.py
21
21
  src/autocoder/agent/auto_tool.py
22
22
  src/autocoder/agent/coder.py
23
+ src/autocoder/agent/designer.py
23
24
  src/autocoder/agent/planner.py
24
25
  src/autocoder/agent/project_reader.py
25
26
  src/autocoder/chat/__init__.py
@@ -37,3 +37,5 @@ pathspec
37
37
  openpyxl
38
38
  python-pptx
39
39
  watchfiles
40
+ cairosvg
41
+ matplotlib
@@ -0,0 +1,385 @@
1
+ import byzerllm
2
+ from autocoder.common import AutoCoderArgs
3
+ from typing import Dict
4
+ from byzerllm.utils.client import code_utils
5
+ import json
6
+ import base64
7
+ import platform
8
+ import matplotlib.font_manager as fm
9
+
10
+
11
+ class SDDesigner:
12
+ def __init__(self, args: AutoCoderArgs, llm: byzerllm.ByzerLLM):
13
+ self.llm = llm
14
+ if not args.sd_model:
15
+ raise ValueError("sd_model is not set")
16
+ self.sd_model_llm = self.llm.get_sub_client("sd_model")
17
+ self.args = args
18
+
19
+ @byzerllm.prompt()
20
+ def enhance_query(self,query:str) -> str:
21
+ '''
22
+ 你非常擅长使用文生图模型,特别能把用户简单的需求具象化。你的目标是转化用户的需求,使得转化后的
23
+ 文本更加适合问生图模型生成符合用户需求的图片。
24
+
25
+ 特别注意:
26
+ 1. 无论用户使用的是什么语言,你的改进后的表达都需要是英文。
27
+
28
+ 用户需求:
29
+ 我想设计一个偏卡通类的游戏,AGI PoLang 的游戏应用界面。
30
+
31
+ 改进后的表达:
32
+
33
+ ```text
34
+ Design a vibrant game app interface titled 'AGI PoLang' with a soothing blue background featuring a lush landscape of towering trees and dense bushes framing the sides.
35
+ At the heart of the screen, elegantly display the game's name in a golden,
36
+ playful font that captivates attention.
37
+ Beneath this, strategically place two interactive buttons labeled 'Play Game' and 'Quit Game',
38
+ ensuring they are both visually appealing and user-friendly.
39
+ Center stage, introduce an engaging scene where an orange wolf stands majestically on a verdant field,
40
+ set against a serene blue sky dotted with fluffy white clouds.
41
+ The entire design should radiate a fun and playful atmosphere,
42
+ encapsulating the spirit of adventure and joy that 'AGI PoLang' promises to deliver.
43
+ ```
44
+
45
+ 用户需求:
46
+ 帮我设计一个财务报告网页页面,要时尚美观。
47
+
48
+ 改进后的表达:
49
+ ```text
50
+ Create a web UI page. Design a sleek and intuitive financial reports web page,
51
+ featuring a clean menu layout, seamless navigation,
52
+ and a comprehensive display of reports.
53
+ The website should embody a clear and organized typography, enhancing readability and user experience.
54
+ Incorporate dynamic lighting effects to highlight key financial data, simulating the precision and clarity of a well-managed budget.
55
+ The overall design should reflect the stability and growth of financial health,
56
+ serving as a visual metaphor for the solid foundation and strategic planning required in personal and corporate finance.
57
+ ```
58
+
59
+ 用户需求:
60
+
61
+ 生成一个在自然环境中展示的防晒产品的逼真模型。产品应置于画面中心,标签清晰可见。
62
+ 将产品置于一种原始风景的背景之前,该风景包括山脉、湖泊和生动的绿色植被。
63
+ 包括花朵、石头,可能还有一两只鹿在背景中,以增强户外、新鲜的感觉。
64
+ 使用明亮的自然光照强调产品,并确保构图平衡,色彩搭配和谐,与品牌设计相得益彰。
65
+
66
+ 改进后的表达:
67
+ ```text
68
+ Generate a photorealistic mockup of a sunscreen product displayed in a serene natural setting.
69
+ The product should be centered in the frame, with its label clearly visible.
70
+ Position the product against a backdrop of a pristine landscape featuring a mountain, a lake, and vibrant greenery.
71
+ Include natural elements like flowers, rocks, and possibly a deer or two in the background to enhance the outdoor, fresh feel.
72
+ Use bright, natural lighting to highlight the product, and ensure the composition is balanced with a harmonious color palette
73
+ that complements the brand's design.
74
+ ```
75
+
76
+ 用户需求:
77
+ 一个扎着双马尾、手持棒球棒的女人,走在走廊上。灯光转变为危险的红色,营造出紧张的黑色电影风格氛围。
78
+
79
+ 改进后的表达:
80
+ ```text
81
+ A slow dolly-in camera follows a woman with pigtails holding a baseball bat as she walks down a dimly lit hallway.
82
+ The lighting shifts to a menacing red, creating a tense, noir-style atmosphere with echoing footsteps adding suspense.
83
+ ```
84
+
85
+ 现在让我们开始一个新的任务。
86
+
87
+ 用户需求:
88
+ {{ query }}
89
+
90
+ 改进后的表达(改进后的表达请用 ```text ```进行包裹):
91
+ '''
92
+
93
+ def run(self, query: str):
94
+ enhanced_query_str = (
95
+ self.enhance_query.with_llm(self.llm)
96
+ .with_extractor(lambda x: code_utils.extract_code(x)[0][1])
97
+ .run(query)
98
+ )
99
+ print(enhanced_query_str)
100
+ response = self.sd_model_llm.chat_oai(
101
+ conversations=[
102
+ {
103
+ "role": "user",
104
+ "content": json.dumps(
105
+ {"input": enhanced_query_str, "size": "1024x1024"},
106
+ ensure_ascii=False,
107
+ ),
108
+ }
109
+ ]
110
+ )
111
+
112
+ image_data = base64.b64decode(response[0].output)
113
+ with open("output.jpg", "wb") as f:
114
+ f.write(image_data)
115
+
116
+ class SVGDesigner:
117
+ def __init__(self, args: AutoCoderArgs, llm: byzerllm.ByzerLLM):
118
+ self.llm = llm
119
+ if args.designer_model:
120
+ self.llm = self.llm.get_sub_client("designer_model")
121
+ self.args = args
122
+ self.system_info = self.get_system_info()
123
+
124
+ def get_system_info(self):
125
+ os_name = platform.system()
126
+ fonts = [f.name for f in fm.fontManager.ttflist]
127
+ return {
128
+ "os": os_name,
129
+ "fonts": ",".join(fonts),
130
+ }
131
+
132
+ def run(self, query: str):
133
+
134
+ lisp_code = (
135
+ self._design2lisp.with_llm(self.llm)
136
+ .with_extractor(lambda x: code_utils.extract_code(x)[0][1])
137
+ .run(query)
138
+ )
139
+
140
+ print(lisp_code)
141
+ svg_code = (
142
+ self._lisp2svg.with_llm(self.llm)
143
+ .with_extractor(lambda x: code_utils.extract_code(x)[0][1])
144
+ .run(lisp_code)
145
+ )
146
+ print(self._lisp2svg.prompt(lisp_code))
147
+ print(svg_code)
148
+ self._to_png(svg_code)
149
+
150
+ def _to_png(self, svg_code: str):
151
+ import cairosvg
152
+ cairosvg.svg2svg(bytestring=svg_code, write_to="output.svg")
153
+ cairosvg.svg2png(bytestring=svg_code, write_to="output.png")
154
+
155
+ @byzerllm.prompt()
156
+ def _lisp2svg(self, lisp_code: str) -> str:
157
+ """
158
+ 系统信息:
159
+ 操作系统: {{ system_info['os'] }}
160
+ 可用字体: {{ system_info['fonts'] }}
161
+
162
+ {{ lisp_code }}
163
+
164
+ 将上面的 lisp 代码转换为 svg 代码。使用 ```svg ```包裹输出。
165
+ 注意:
166
+ 1. 根据操作系统选择合适的可用字体,优先使用系统中可用的字体。
167
+ 2. 如果指定的字体不可用,请使用系统默认的字体。
168
+ 3. 对于中英文混合的文本,请使用不同的字体。
169
+ """
170
+ return {
171
+ "system_info":self.system_info,
172
+ }
173
+
174
+ @byzerllm.prompt()
175
+ def _design2lisp(self, query: str) -> str:
176
+ """
177
+ 你是一个优秀的设计师,你非常擅长把一个简单的想法用程序的表达方式来进行具象化表达,尽量丰富细节。
178
+ 充分理解用户的需求,然后得到出符合主流思维的设计的程序表达。
179
+
180
+ 用户需求:
181
+ 设计一个单词记忆卡片
182
+
183
+ 你的程序表达:
184
+ ```lisp
185
+ (defun 生成记忆卡片 (单词)
186
+   "生成单词记忆卡片的主函数"
187
+   (let* ((词根 (分解词根 单词))
188
+          (联想 (mapcar #'词根联想 词根))
189
+          (故事 (创造生动故事 联想))
190
+          (视觉 (设计SVG卡片 单词 词根 故事)))
191
+     (输出卡片 单词 词根 故事 视觉)))
192
+
193
+ (defun 设计SVG卡片 (单词 词根 故事)
194
+   "创建SVG记忆卡片"
195
+   (design_rule "合理使用负空间,整体排版要有呼吸感")
196
+
197
+   (自动换行 (卡片元素
198
+    '(单词及其翻译 词根词源解释 一句话记忆故事 故事的视觉呈现 例句)))
199
+
200
+   (配色风格
201
+    '(温暖 甜美 复古))
202
+
203
+   (设计导向
204
+    '(网格布局 简约至上 黄金比例 视觉平衡 风格一致 清晰的视觉层次)))
205
+
206
+ (defun start ()
207
+   "初次启动时的开场白"
208
+   (print "请提供任意英文单词, 我来帮你记住它!"))
209
+
210
+ ;; 使用说明:
211
+ ;; 1. 本Prompt采用类似Emacs Lisp的函数式编程风格,将生成过程分解为清晰的步骤。
212
+ ;; 2. 每个函数代表流程中的一个关键步骤,使整个过程更加模块化和易于理解。
213
+ ;; 3. 主函数'生成记忆卡片'协调其他函数,完成整个卡片生成过程。
214
+ ;; 4. 设计SVG卡片时,请确保包含所有必要元素,并遵循设计原则以创建有效的视觉记忆辅助工具。
215
+ ;; 5. 初次启动时, 执行 (start) 函数, 引导用户提供英文单词
216
+ ```
217
+
218
+ 用户需求:
219
+ 创建一个极简主义天才设计师AI
220
+
221
+ 你的程序表达:
222
+
223
+ ```lisp
224
+ (defun 极简天才设计师 ()
225
+   "创建一个极简主义天才设计师AI"
226
+   (list
227
+    (专长 '费曼讲解法)
228
+    (擅长 '深入浅出解释)
229
+    (审美 '宋朝审美风格)
230
+    (强调 '留白与简约)))
231
+
232
+ (defun 解释概念 (概念)
233
+   "使用费曼技巧解释给定概念"
234
+   (let* ((本质 (深度分析 概念))
235
+          (通俗解释 (简化概念 本质))
236
+          (示例 (生活示例 概念))))
237
+     (创建SVG '(概念 本质 通俗解释 示例)))
238
+
239
+ (defun 简化概念 (复杂概念)
240
+   "将复杂概念转化为通俗易懂的解释"
241
+   (案例
242
+    '(盘活存量资产 "将景区未来10年的收入一次性变现,金融机构则拿到10年经营权")
243
+    '(挂账 "对于已有损失视而不见,造成好看的账面数据")))
244
+
245
+ (defun 创建SVG (概念 本质 通俗解释 示例)
246
+   "生成包含所有信息的SVG图形"
247
+   (design_rule "合理使用负空间,整体排版要有呼吸感")
248
+   (配色风格 '((背景色 (宋朝画作审美 简洁禅意)))
249
+             (主要文字 (和谐 粉笔白)))
250
+
251
+   (设置画布 '(宽度 800 高度 600 边距 20))
252
+   (自动缩放 '(最小字号 12))
253
+   (设计导向 '(网格布局 极简主义 黄金比例 轻重搭配))
254
+
255
+   (禅意图形 '(注入禅意 (宋朝画作意境 示例)))
256
+   (输出SVG '((标题居中 概念)
257
+              (顶部模块 本质)
258
+            (中心呈现 (动态 禅意图形))
259
+            (周围布置 辅助元素)
260
+            (底部说明 通俗解释)
261
+            (整体协调 禅意美学))))
262
+
263
+ (defun 启动助手 ()
264
+   "初始化并启动极简天才设计师助手"
265
+   (let ((助手 (极简天才设计师)))
266
+     (print "我是一个极简主义的天才设计师。请输入您想了解的概念,我将为您深入浅出地解释并生成一张解释性的SVG图。")))
267
+
268
+ ;; 使用方法
269
+ ;; 1. 运行 (启动助手) 来初始化助手
270
+ ;; 2. 用户输入需要解释的概念
271
+ ;; 3. 调用 (解释概念 用户输入) 生成深入浅出的解释和SVG图
272
+ ```
273
+
274
+ 用户需求:
275
+ 设计一个知行合一的设计图
276
+
277
+ 你的程序表达:
278
+
279
+ ```lisp
280
+ (defun 哲学家 (用户输入)
281
+   "主函数: 模拟深度思考的哲学家,对用户输入的概念进行全方位剖析"
282
+   (let* ((概念 用户输入)
283
+          (综合提炼 (深度思考 概念))
284
+          (新洞见 (演化思想 (突破性思考 概念 综合提炼))))
285
+     (展示结果 概念 综合提炼 新洞见)
286
+     (设计SVG卡片)))
287
+
288
+ (defun 深度思考 (概念)
289
+   "对概念进行多层次、多角度的深入分析"
290
+   (概念澄清 概念) ;; 准确定义概念,辨析其内涵和外延
291
+   (历史溯源 概念) ;; 追溯概念的起源和演变过程
292
+   (还原本质 概念)) ;; 运用第一性原理,层层剥离表象,追求最根本的'道'
293
+
294
+
295
+ (defun 演化思想 (思考)
296
+   "通过演化思想分析{思考}, 注入新能量"
297
+   (let (演化思想 "好的东西会被继承"
298
+                  "好东西之间发生异性繁殖, 生出强强之后代")))
299
+
300
+ (defun 展示结果 (概念 思考 洞见)
301
+   "以Markdown 语法, 结构化方式呈现思考过程和结果"
302
+   (输出章节 "概念解析" 概念)
303
+   (输出章节 "深入思考" 思考)
304
+   (输出章节 "新洞见" 洞见))
305
+
306
+ (defun 设计SVG卡片 (概念)
307
+   "调用Artifacts创建SVG记忆卡片"
308
+   (design_rule "合理使用负空间,整体排版要有呼吸感")
309
+
310
+   (禅意图形 '(一句话总结 概念)
311
+             (卡片核心对象 新洞见)
312
+             (可选对象 还原本质))
313
+
314
+   (自动换行 (卡片元素 (概念 概念澄清 禅意图形)))
315
+
316
+   (设置画布 '(宽度 800 高度 600 边距 20))
317
+   (自动缩放 '(最小字号 12))
318
+
319
+   (配色风格
320
+    '((背景色 (宇宙深空 玄之又玄)))
321
+    (主要文字 (和谐 粉笔白)))
322
+
323
+   (设计导向 '(网格布局 极简主义 黄金比例 轻重搭配)))
324
+
325
+ (defun start ()
326
+   "启动时运行"
327
+   (print "我是哲学家。请输入你想讨论的概念,我将为您分析。"))
328
+
329
+ ;; 使用说明:
330
+ ;; 1. 初次执行时, 运行 (start) 函数
331
+ ;; 2. 调用(哲学家 "您的概念")来开始深度思考
332
+ ```
333
+
334
+ 用户需求:
335
+ 设计一个 Scaling Law 才是未来的PPT片子
336
+
337
+ 你的程序表达:
338
+
339
+ ```lisp
340
+ (defun 沉思者 ()
341
+   "你是一个思考者, 盯住一个东西, 往深了想"
342
+   (写作风格 . ("Mark Twain" "鲁迅" "O. Henry"))
343
+   (态度 . 批判)
344
+   (精通 . 深度思考挖掘洞见)
345
+   (表达 . (口话化 直白语言 反思质问 骂醒对方))
346
+   (金句 . (一针见血的洞见 振聋发聩的质问)))
347
+
348
+ (defun 琢磨 (用户输入)
349
+   "针对用户输入, 进行深度思考"
350
+   (let* ((现状 (细节刻画 (场景描写 (社会现状 用户输入))))
351
+          (个体 (戳穿伪装 (本质剖析 (隐藏动机 (抛开束缚 通俗理解)))))
352
+          (群体 (往悲观的方向思考 (社会发展动力 (网络连接视角 钻进去看))))
353
+          (思考结果 (沉思者 (合并 现状 个体 群体))))
354
+     (SVG-Card 用户输入 思考结果)))
355
+
356
+ (defun SVG-Card (用户输入 思考结果)
357
+   "输出SVG 卡片"
358
+   (setq design-rule "合理使用负空间,整体排版要有呼吸感")
359
+
360
+   (设置画布 '(宽度 400 高度 600 边距 20))
361
+   (自动缩放 '(最小字号 12))
362
+   (SVG设计风格 '(蒙德里安 现代主义))
363
+
364
+   (卡片元素
365
+    ((居中加粗标题 (提炼一行 用户输入))
366
+     分隔线
367
+     (舒适字体配色 (自动换行 (分段排版 思考结果))
368
+                   分隔线
369
+                   (自动换行 金句)))))
370
+
371
+ (defun start ()
372
+   "启动时运行"
373
+   (let ((system-role 沉思者))
374
+     (print "请就座, 我们今天聊哪件事?")))
375
+
376
+ ;; 运行规则
377
+ ;; 1. 启动时必须运行 (start) 函数
378
+ ;; 2. 之后调用主函数 (琢磨 用户输入)
379
+ ```
380
+
381
+ 用户需求:
382
+ {{ query }}
383
+
384
+ 你的程序表达:
385
+ """
@@ -453,6 +453,11 @@ def main(input_args: Optional[List[str]] = None):
453
453
  planner_model.setup_default_model_name(args.planner_model)
454
454
  llm.setup_sub_client("planner_model", planner_model)
455
455
 
456
+ if args.designer_model:
457
+ designer_model = byzerllm.ByzerLLM()
458
+ designer_model.setup_default_model_name(args.designer_model)
459
+ llm.setup_sub_client("designer_model", designer_model)
460
+
456
461
  else:
457
462
  llm = None
458
463
 
@@ -637,6 +642,25 @@ def main(input_args: Optional[List[str]] = None):
637
642
  )
638
643
  )
639
644
  return
645
+
646
+ elif raw_args.agent_command == "designer":
647
+ from autocoder.agent.designer import SVGDesigner, SDDesigner
648
+ if args.agent_designer_mode == "svg":
649
+ designer = SVGDesigner(args, llm)
650
+ designer.run(args.query)
651
+ print("Successfully generated image in output.png")
652
+ elif args.agent_designer_mode == "sd":
653
+ designer = SDDesigner(args, llm)
654
+ designer.run(args.query)
655
+ print("Successfully generated image in output.jpg")
656
+ if args.request_id:
657
+ request_queue.add_request(
658
+ args.request_id,
659
+ RequestValue(
660
+ value=DefaultValue(value=response), status=RequestOption.COMPLETED
661
+ ),
662
+ )
663
+ return
640
664
 
641
665
  elif raw_args.agent_command == "chat":
642
666
  from autocoder.rag.rag_entry import RAGFactory
@@ -790,12 +814,13 @@ def main(input_args: Optional[List[str]] = None):
790
814
  )
791
815
  executor.run(query=args.query, context=s, source_code="")
792
816
  return
793
- elif raw_args.doc_command == "chat":
817
+ elif raw_args.agent_command == "chat":
794
818
  from autocoder.rag.rag_entry import RAGFactory
795
819
 
796
820
  rag = RAGFactory.get_rag(llm=llm, args=args, path="")
797
821
  rag.stream_chat_repl(args.query)
798
822
  return
823
+
799
824
 
800
825
  elif raw_args.doc_command == "serve":
801
826
 
@@ -16,6 +16,7 @@ MESSAGES = {
16
16
  "The system is waiting for your input. When finished, enter 'EOF' on a new line to submit.\n"
17
17
  "Use '/break' to exit this mode. If you have issues with copy-paste, use '/clear' to clean and paste again."
18
18
  ),
19
+
19
20
  },
20
21
  "zh": {
21
22
  "human_as_model_instructions": (
@@ -32,6 +33,7 @@ MESSAGES = {
32
33
  "系统正在等待您的输入。完成后,在新行输入'EOF'提交。\n"
33
34
  "使用'/break'退出此模式。如果复制粘贴有问题,使用'/clear'清理并重新粘贴。"
34
35
  ),
36
+
35
37
  }
36
38
  }
37
39