Spaces:
Sleeping
Sleeping
Merge pull request #239 from ylsislove/golang-code-analysis
Browse files- crazy_functions/解析项目源代码.py +17 -0
- functional_crazy.py +6 -0
crazy_functions/解析项目源代码.py
CHANGED
|
@@ -148,3 +148,20 @@ def 解析一个C项目(txt, top_p, temperature, chatbot, history, systemPromptT
|
|
| 148 |
return
|
| 149 |
yield from 解析源代码(file_manifest, project_folder, top_p, temperature, chatbot, history, systemPromptTxt)
|
| 150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
return
|
| 149 |
yield from 解析源代码(file_manifest, project_folder, top_p, temperature, chatbot, history, systemPromptTxt)
|
| 150 |
|
| 151 |
+
@CatchException
|
| 152 |
+
def 解析一个Golang项目(txt, top_p, temperature, chatbot, history, systemPromptTxt, WEB_PORT):
|
| 153 |
+
history = [] # 清空历史,以免输入溢出
|
| 154 |
+
import glob, os
|
| 155 |
+
if os.path.exists(txt):
|
| 156 |
+
project_folder = txt
|
| 157 |
+
else:
|
| 158 |
+
if txt == "": txt = '空空如也的输入栏'
|
| 159 |
+
report_execption(chatbot, history, a = f"解析项目: {txt}", b = f"找不到本地项目或无权访问: {txt}")
|
| 160 |
+
yield chatbot, history, '正常'
|
| 161 |
+
return
|
| 162 |
+
file_manifest = [f for f in glob.glob(f'{project_folder}/**/*.go', recursive=True)]
|
| 163 |
+
if len(file_manifest) == 0:
|
| 164 |
+
report_execption(chatbot, history, a = f"解析项目: {txt}", b = f"找不到任何golang文件: {txt}")
|
| 165 |
+
yield chatbot, history, '正常'
|
| 166 |
+
return
|
| 167 |
+
yield from 解析源代码(file_manifest, project_folder, top_p, temperature, chatbot, history, systemPromptTxt)
|
functional_crazy.py
CHANGED
|
@@ -14,6 +14,7 @@ def get_crazy_functionals():
|
|
| 14 |
from crazy_functions.解析项目源代码 import 解析一个Python项目
|
| 15 |
from crazy_functions.解析项目源代码 import 解析一个C项目的头文件
|
| 16 |
from crazy_functions.解析项目源代码 import 解析一个C项目
|
|
|
|
| 17 |
from crazy_functions.高级功能函数模板 import 高阶功能模板函数
|
| 18 |
from crazy_functions.代码重写为全英文_多线程 import 全项目切换英文
|
| 19 |
|
|
@@ -35,6 +36,11 @@ def get_crazy_functionals():
|
|
| 35 |
"AsButton": False, # 加入下拉菜单中
|
| 36 |
"Function": 解析一个C项目
|
| 37 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
"读Tex论文写摘要": {
|
| 39 |
"Color": "stop", # 按钮颜色
|
| 40 |
"Function": 读文章写摘要
|
|
|
|
| 14 |
from crazy_functions.解析项目源代码 import 解析一个Python项目
|
| 15 |
from crazy_functions.解析项目源代码 import 解析一个C项目的头文件
|
| 16 |
from crazy_functions.解析项目源代码 import 解析一个C项目
|
| 17 |
+
from crazy_functions.解析项目源代码 import 解析一个Golang项目
|
| 18 |
from crazy_functions.高级功能函数模板 import 高阶功能模板函数
|
| 19 |
from crazy_functions.代码重写为全英文_多线程 import 全项目切换英文
|
| 20 |
|
|
|
|
| 36 |
"AsButton": False, # 加入下拉菜单中
|
| 37 |
"Function": 解析一个C项目
|
| 38 |
},
|
| 39 |
+
"解析整个Go项目": {
|
| 40 |
+
"Color": "stop", # 按钮颜色
|
| 41 |
+
"AsButton": False, # 加入下拉菜单中
|
| 42 |
+
"Function": 解析一个Golang项目
|
| 43 |
+
},
|
| 44 |
"读Tex论文写摘要": {
|
| 45 |
"Color": "stop", # 按钮颜色
|
| 46 |
"Function": 读文章写摘要
|