mrhblfx commited on
Commit
c6610b2
1 Parent(s): 613be55

新增解析一个Lua项目

Browse files
crazy_functions/解析项目源代码.py CHANGED
@@ -231,3 +231,25 @@ def 解析一个Golang项目(txt, llm_kwargs, plugin_kwargs, chatbot, history, s
231
  yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
232
  return
233
  yield from 解析源代码新(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
232
  return
233
  yield from 解析源代码新(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt)
234
+
235
+
236
+ @CatchException
237
+ def 解析一个Lua项目(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, web_port):
238
+ history = [] # 清空历史,以免输入溢出
239
+ import glob, os
240
+ if os.path.exists(txt):
241
+ project_folder = txt
242
+ else:
243
+ if txt == "": txt = '空空如也的输入栏'
244
+ report_execption(chatbot, history, a = f"解析项目: {txt}", b = f"找不到本地项目或无权访问: {txt}")
245
+ yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
246
+ return
247
+ file_manifest = [f for f in glob.glob(f'{project_folder}/**/*.lua', recursive=True)] + \
248
+ [f for f in glob.glob(f'{project_folder}/**/*.xml', recursive=True)] + \
249
+ [f for f in glob.glob(f'{project_folder}/**/*.json', recursive=True)] + \
250
+ [f for f in glob.glob(f'{project_folder}/**/*.toml', recursive=True)]
251
+ if len(file_manifest) == 0:
252
+ report_execption(chatbot, history, a = f"解析项目: {txt}", b = f"找不到任何lua文件: {txt}")
253
+ yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
254
+ return
255
+ yield from 解析源代码新(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt)