binary-husky commited on
Commit
7d414f6
2 Parent(s): 3e1cecd 5e602ca

Merge pull request #439 from mrhblfx/patch-2

Browse files
crazy_functional.py CHANGED
@@ -155,6 +155,15 @@ def get_crazy_functions():
155
 
156
  except Exception as err:
157
  print(f'[下载arxiv论文并翻译摘要] 插件导入失败 {str(err)}')
 
 
 
 
 
 
 
 
 
158
 
159
  ###################### 第n组插件 ###########################
160
  return function_plugins
 
155
 
156
  except Exception as err:
157
  print(f'[下载arxiv论文并翻译摘要] 插件导入失败 {str(err)}')
158
+
159
+ from crazy_functions.解析项目源代码 import 解析一个Lua项目
160
+ function_plugins.update({
161
+ "解析整个Lua项目": {
162
+ "Color": "stop", # 按钮颜色
163
+ "AsButton": False, # 加入下拉菜单中
164
+ "Function": HotReload(解析一个Lua项目)
165
+ },
166
+ })
167
 
168
  ###################### 第n组插件 ###########################
169
  return function_plugins
crazy_functions/解析项目源代码.py CHANGED
@@ -234,3 +234,25 @@ def 解析一个Golang项目(txt, llm_kwargs, plugin_kwargs, chatbot, history, s
234
  yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
235
  return
236
  yield from 解析源代码新(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
235
  return
236
  yield from 解析源代码新(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt)
237
+
238
+
239
+ @CatchException
240
+ def 解析一个Lua项目(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, web_port):
241
+ history = [] # 清空历史,以免输入溢出
242
+ import glob, os
243
+ if os.path.exists(txt):
244
+ project_folder = txt
245
+ else:
246
+ if txt == "": txt = '空空如也的输入栏'
247
+ report_execption(chatbot, history, a = f"解析项目: {txt}", b = f"找不到本地项目或无权访问: {txt}")
248
+ yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
249
+ return
250
+ file_manifest = [f for f in glob.glob(f'{project_folder}/**/*.lua', recursive=True)] + \
251
+ [f for f in glob.glob(f'{project_folder}/**/*.xml', recursive=True)] + \
252
+ [f for f in glob.glob(f'{project_folder}/**/*.json', recursive=True)] + \
253
+ [f for f in glob.glob(f'{project_folder}/**/*.toml', recursive=True)]
254
+ if len(file_manifest) == 0:
255
+ report_execption(chatbot, history, a = f"解析项目: {txt}", b = f"找不到任何lua文件: {txt}")
256
+ yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
257
+ return
258
+ yield from 解析源代码新(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt)