Spaces:
Runtime error
Runtime error
wenx29
commited on
Commit
·
321a51b
1
Parent(s):
a593e2e
增加解析C#项目功能
Browse files- crazy_functional.py +6 -0
- crazy_functions/解析项目源代码.py +20 -0
crazy_functional.py
CHANGED
|
@@ -17,6 +17,7 @@ def get_crazy_functions():
|
|
| 17 |
from crazy_functions.代码重写为全英文_多线程 import 全项目切换英文
|
| 18 |
from crazy_functions.Latex全文润色 import Latex英文润色
|
| 19 |
from crazy_functions.解析项目源代码 import 解析一个Lua项目
|
|
|
|
| 20 |
function_plugins = {
|
| 21 |
|
| 22 |
"解析整个Python项目": {
|
|
@@ -52,6 +53,11 @@ def get_crazy_functions():
|
|
| 52 |
"AsButton": False, # 加入下拉菜单中
|
| 53 |
"Function": HotReload(解析一个Lua项目)
|
| 54 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
"读Tex论文写摘要": {
|
| 56 |
"Color": "stop", # 按钮颜色
|
| 57 |
"Function": HotReload(读文章写摘要)
|
|
|
|
| 17 |
from crazy_functions.代码重写为全英文_多线程 import 全项目切换英文
|
| 18 |
from crazy_functions.Latex全文润色 import Latex英文润色
|
| 19 |
from crazy_functions.解析项目源代码 import 解析一个Lua项目
|
| 20 |
+
from crazy_functions.解析项目源代码 import 解析一个CSharp项目
|
| 21 |
function_plugins = {
|
| 22 |
|
| 23 |
"解析整个Python项目": {
|
|
|
|
| 53 |
"AsButton": False, # 加入下拉菜单中
|
| 54 |
"Function": HotReload(解析一个Lua项目)
|
| 55 |
},
|
| 56 |
+
"解析整个CSharp项目": {
|
| 57 |
+
"Color": "stop", # 按钮颜色
|
| 58 |
+
"AsButton": False, # 加入下拉菜单中
|
| 59 |
+
"Function": HotReload(解析一个CSharp项目)
|
| 60 |
+
},
|
| 61 |
"读Tex论文写摘要": {
|
| 62 |
"Color": "stop", # 按钮颜色
|
| 63 |
"Function": HotReload(读文章写摘要)
|
crazy_functions/解析项目源代码.py
CHANGED
|
@@ -244,3 +244,23 @@ def 解析一个Lua项目(txt, llm_kwargs, plugin_kwargs, chatbot, history, syst
|
|
| 244 |
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
| 245 |
return
|
| 246 |
yield from 解析源代码新(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 244 |
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
| 245 |
return
|
| 246 |
yield from 解析源代码新(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt)
|
| 247 |
+
|
| 248 |
+
|
| 249 |
+
@CatchException
|
| 250 |
+
def 解析一个CSharp项目(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, web_port):
|
| 251 |
+
history = [] # 清空历史,以免输入溢出
|
| 252 |
+
import glob, os
|
| 253 |
+
if os.path.exists(txt):
|
| 254 |
+
project_folder = txt
|
| 255 |
+
else:
|
| 256 |
+
if txt == "": txt = '空空如也的输入栏'
|
| 257 |
+
report_execption(chatbot, history, a = f"解析项目: {txt}", b = f"找不到本地项目或无权访问: {txt}")
|
| 258 |
+
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
| 259 |
+
return
|
| 260 |
+
file_manifest = [f for f in glob.glob(f'{project_folder}/**/*.cs', recursive=True)] + \
|
| 261 |
+
[f for f in glob.glob(f'{project_folder}/**/*.csproj', recursive=True)]
|
| 262 |
+
if len(file_manifest) == 0:
|
| 263 |
+
report_execption(chatbot, history, a = f"解析项目: {txt}", b = f"找不到任何CSharp文件: {txt}")
|
| 264 |
+
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
| 265 |
+
return
|
| 266 |
+
yield from 解析源代码新(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt)
|