Merge pull request #239 from ylsislove/golang-code-analysis
feat: add function to parse Golang projects
This commit is contained in:
		
						commit
						d10fec81fa
					
				@ -148,3 +148,20 @@ def 解析一个C项目(txt, top_p, temperature, chatbot, history, systemPromptT
 | 
				
			|||||||
        return
 | 
					        return
 | 
				
			||||||
    yield from 解析源代码(file_manifest, project_folder, top_p, temperature, chatbot, history, systemPromptTxt)
 | 
					    yield from 解析源代码(file_manifest, project_folder, top_p, temperature, chatbot, history, systemPromptTxt)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@CatchException
 | 
				
			||||||
 | 
					def 解析一个Golang项目(txt, top_p, temperature, chatbot, history, systemPromptTxt, WEB_PORT):
 | 
				
			||||||
 | 
					    history = []    # 清空历史,以免输入溢出
 | 
				
			||||||
 | 
					    import glob, os
 | 
				
			||||||
 | 
					    if os.path.exists(txt):
 | 
				
			||||||
 | 
					        project_folder = txt
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
 | 
					        if txt == "": txt = '空空如也的输入栏'
 | 
				
			||||||
 | 
					        report_execption(chatbot, history, a = f"解析项目: {txt}", b = f"找不到本地项目或无权访问: {txt}")
 | 
				
			||||||
 | 
					        yield chatbot, history, '正常'
 | 
				
			||||||
 | 
					        return
 | 
				
			||||||
 | 
					    file_manifest = [f for f in glob.glob(f'{project_folder}/**/*.go', recursive=True)]
 | 
				
			||||||
 | 
					    if len(file_manifest) == 0:
 | 
				
			||||||
 | 
					        report_execption(chatbot, history, a = f"解析项目: {txt}", b = f"找不到任何golang文件: {txt}")
 | 
				
			||||||
 | 
					        yield chatbot, history, '正常'
 | 
				
			||||||
 | 
					        return
 | 
				
			||||||
 | 
					    yield from 解析源代码(file_manifest, project_folder, top_p, temperature, chatbot, history, systemPromptTxt)
 | 
				
			||||||
 | 
				
			|||||||
@ -14,6 +14,7 @@ def get_crazy_functionals():
 | 
				
			|||||||
    from crazy_functions.解析项目源代码 import 解析一个Python项目
 | 
					    from crazy_functions.解析项目源代码 import 解析一个Python项目
 | 
				
			||||||
    from crazy_functions.解析项目源代码 import 解析一个C项目的头文件
 | 
					    from crazy_functions.解析项目源代码 import 解析一个C项目的头文件
 | 
				
			||||||
    from crazy_functions.解析项目源代码 import 解析一个C项目
 | 
					    from crazy_functions.解析项目源代码 import 解析一个C项目
 | 
				
			||||||
 | 
					    from crazy_functions.解析项目源代码 import 解析一个Golang项目
 | 
				
			||||||
    from crazy_functions.高级功能函数模板 import 高阶功能模板函数
 | 
					    from crazy_functions.高级功能函数模板 import 高阶功能模板函数
 | 
				
			||||||
    from crazy_functions.代码重写为全英文_多线程 import 全项目切换英文
 | 
					    from crazy_functions.代码重写为全英文_多线程 import 全项目切换英文
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -35,6 +36,11 @@ def get_crazy_functionals():
 | 
				
			|||||||
            "AsButton": False,  # 加入下拉菜单中
 | 
					            "AsButton": False,  # 加入下拉菜单中
 | 
				
			||||||
            "Function": 解析一个C项目
 | 
					            "Function": 解析一个C项目
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        "解析整个Go项目": {
 | 
				
			||||||
 | 
					            "Color": "stop",    # 按钮颜色
 | 
				
			||||||
 | 
					            "AsButton": False,  # 加入下拉菜单中
 | 
				
			||||||
 | 
					            "Function": 解析一个Golang项目
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        "读Tex论文写摘要": {
 | 
					        "读Tex论文写摘要": {
 | 
				
			||||||
            "Color": "stop",    # 按钮颜色
 | 
					            "Color": "stop",    # 按钮颜色
 | 
				
			||||||
            "Function": 读文章写摘要
 | 
					            "Function": 读文章写摘要
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user