We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation .
在 crazy_functions 路?下,放置???的新?件。
crazy_functions
在 crazy_functional.py 中,?照其他?件的格式,把新?件加入到列表中。
crazy_functional.py
(非必要步?) 在 tests/test_plugins.py 中,添加?元??,?行无UI的快速Debug。
tests/test_plugins.py
高?功能函?模板
i_say = f'?史中?些事件?生在 { currentMonth } 月 { currentDay } 日?列?????送相??片。?送?片?,?使用Markdown,?Unsplash API中的PUT_YOUR_QUERY_HERE替?成描述?事件的一?最重要的??。' gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive ( inputs = i_say , # 提?的?容,?chatgpt看的 inputs_show_user = i_say , # 提?的?容,?用?看的(可以?藏??的??) llm_kwargs = llm_kwargs , # 无聊的chatgpt?部?? chatbot = chatbot , # 聊天?句柄,原??? history = [], # 之前的聊天?容,只有之前的聊天?容中有?得抽取的信息?,才是必要的 sys_prompt = "??想?送一?照片?,?使用Markdown, ?且不要有反斜?, 不要用代??。使用 Unsplash API (https://source.unsplash.com/1280x720/? < PUT_YOUR_QUERY_HERE >)。" )
源代?解析_多?程
for index , fp in enumerate ( file_manifest ): # ??for循??遍列表中的每一?文件 with open ( fp , 'r' , encoding = 'utf-8' , errors = 'replace' ) as f : file_content = f . read () # ?取文件 prefix = "接下???逐文件分析下面的工程" if index == 0 else "" i_say = prefix + f'??下面的程序文件做一??述文件名是 { os . path . relpath ( fp , project_folder ) } ,文件代?是 ``` { file_content } ```' i_say_show_user = prefix + f'[ { index } / { len ( file_manifest ) } ] ??下面的程序文件做一??述: { os . path . abspath ( fp ) } ' # ???求?容,?里有四?列表,列表的?度就是子任?的?。比如10?文件,列表的?度就是10。 inputs_array . append ( i_say ) # 要求解?10?文件的指令 inputs_show_user_array . append ( i_say_show_user ) # 要求解?10?文件的指令,?用?看的?候,只?示一?文件名,避免被??代?糊?上 history_array . append ([]) # 和??文不一?,?里不需要上下文也能分析的?出色 sys_prompt_array . append ( "?是一?程序架?分析?,正在分析一?源代??目。?的回答必???明了。" ) gpt_response_collection = yield from request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency ( inputs_array = inputs_array , inputs_show_user_array = inputs_show_user_array , history_array = history_array , sys_prompt_array = sys_prompt_array , llm_kwargs = llm_kwargs , chatbot = chatbot , show_user_at_complete = True )
函??件支持?更新,?在改?的任何代?都??刻生效,不需要重??目。??方法???,在 crazy_functional.py 中用HotReload修?器包一下?可,例如:
"[?供????] 批量??PDF文?" : { "Color" : "stop" , "Function" : HotReload ( 批量??PDF文? ) # HotReload 的意思是?更新,修改函??件代?后,不需要重?程序,代?直接生效 },
Important
新版本??需要修改config.py中的配置 PLUGIN_HOT_RELOAD = True 才能激活?件?加?
PLUGIN_HOT_RELOAD = True
可在 tests/test_plugins.py 中????代?。
函??件如果能??成立一? .py 文件,把新?的函?都放在其中,再好不?了。如果新增函??多,?在 crazy_functions 新建一?二?文件?盛放?的工具。
.py
新增的pip依?不需要放?requirements.txt,但是需要在函????着import一下,如果失?,?一下安?指令,比如 crazy_functions/批量??PDF文?.py ?中:
crazy_functions/批量??PDF文?.py
# ???入依?,如果缺少依?,??出安?建? try : import fitz # ???入依? except : # 如果缺少依?fitz,??出安?建?,?里是建?安?pymupdf,安?完pymupdf就有了fitz report_execption ( chatbot , history , a = f"解析?目: { txt } " , b = f"?入?件依?失?。使用?模?需要?外依?,安?方法```pip install --upgrade pymupdf```。" ) yield chatbot , history , '正常' return
# 基本信息:功能、??者 chatbot . append ([ "函??件功能?" , "批量??PDF文?。函??件??者: ValeriaWong" ]) yield chatbot , history , '正常'