mirror of
https://github.com/yv1ing/MollyAudit.git
synced 2025-09-16 14:55:50 +08:00
Fixed some bugs and packaged them into executable files
This commit is contained in:
10
app/ui.py
10
app/ui.py
@@ -146,7 +146,7 @@ class MainWindow(QWidget):
|
|||||||
main_layout.addLayout(output_layout)
|
main_layout.addLayout(output_layout)
|
||||||
|
|
||||||
self.setLayout(main_layout)
|
self.setLayout(main_layout)
|
||||||
self.setWindowTitle('MollyAudit - created by yvling')
|
self.setWindowTitle('茉莉审计 - by yvling')
|
||||||
screen = QGuiApplication.primaryScreen().geometry()
|
screen = QGuiApplication.primaryScreen().geometry()
|
||||||
window_width = 1000
|
window_width = 1000
|
||||||
window_height = 600
|
window_height = 600
|
||||||
@@ -156,9 +156,13 @@ class MainWindow(QWidget):
|
|||||||
|
|
||||||
# 导出结果
|
# 导出结果
|
||||||
export_button_layout = QHBoxLayout()
|
export_button_layout = QHBoxLayout()
|
||||||
|
link_label = QLabel('联系作者:<a href="https://github.com/yv1ing">Github</a> <a href=mailto:me@yvling.cn>Email</a>')
|
||||||
|
link_label.setOpenExternalLinks(True)
|
||||||
|
export_button_layout.addWidget(link_label)
|
||||||
|
export_button_layout.addStretch(1)
|
||||||
|
|
||||||
self.export_button = QPushButton('导出结果')
|
self.export_button = QPushButton('导出结果')
|
||||||
self.export_button.clicked.connect(self.export_result)
|
self.export_button.clicked.connect(self.export_result)
|
||||||
export_button_layout.addStretch(1) # 添加伸缩项,使按钮靠右
|
|
||||||
export_button_layout.addWidget(self.export_button)
|
export_button_layout.addWidget(self.export_button)
|
||||||
main_layout.addLayout(export_button_layout)
|
main_layout.addLayout(export_button_layout)
|
||||||
|
|
||||||
@@ -268,4 +272,4 @@ class MainWindow(QWidget):
|
|||||||
del os.environ['OPENAI_API_BASE']
|
del os.environ['OPENAI_API_BASE']
|
||||||
if 'OPENAI_API_KEY' in os.environ:
|
if 'OPENAI_API_KEY' in os.environ:
|
||||||
del os.environ['OPENAI_API_KEY']
|
del os.environ['OPENAI_API_KEY']
|
||||||
self.log.info('已终止代码审计流程')
|
self.log.critical('已终止代码审计流程')
|
||||||
|
|||||||
@@ -3,5 +3,5 @@ import datetime
|
|||||||
|
|
||||||
def get_now_date():
|
def get_now_date():
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
formatted = now.strftime("%Y-%m-%d %H:%M:%S")
|
formatted = now.strftime("%Y-%m-%d-%H-%M-%S")
|
||||||
return formatted
|
return formatted
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ class Audit:
|
|||||||
def __init__(self, base_url, api_key, reasoning_model, embedding_model, process_output_callback, result_output_callback):
|
def __init__(self, base_url, api_key, reasoning_model, embedding_model, process_output_callback, result_output_callback):
|
||||||
self.raw_chain = None
|
self.raw_chain = None
|
||||||
self.source_files_list = []
|
self.source_files_list = []
|
||||||
self.max_token = 4096
|
|
||||||
self.reasoning_model = reasoning_model
|
self.reasoning_model = reasoning_model
|
||||||
self.embedding_model = embedding_model
|
self.embedding_model = embedding_model
|
||||||
self.fortify_rules = FROTIFY_RULES
|
self.fortify_rules = FROTIFY_RULES
|
||||||
|
|||||||
1
build.bat
Normal file
1
build.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.\.venv\Scripts\pyinstaller.exe --hidden-import=tiktoken_ext.openai_public --hidden-import=tiktoken_ext --hidden-import=pydantic --hidden-import=pydantic-core --hidden-import=pydantic.deprecated.decorator --add-data "logo.ico;." -F -w -i logo.ico -n MollyAudit main.py
|
||||||
10
main.py
10
main.py
@@ -1,4 +1,6 @@
|
|||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
|
from PyQt6.QtGui import QIcon
|
||||||
from PyQt6.QtWidgets import QApplication
|
from PyQt6.QtWidgets import QApplication
|
||||||
from app import load_config
|
from app import load_config
|
||||||
from app.ui import MainWindow
|
from app.ui import MainWindow
|
||||||
@@ -6,6 +8,13 @@ from app.ui import MainWindow
|
|||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
|
|
||||||
|
|
||||||
|
def resource_path(relative_path):
|
||||||
|
try:
|
||||||
|
base_path = sys._MEIPASS
|
||||||
|
except AttributeError:
|
||||||
|
base_path = os.path.abspath(".")
|
||||||
|
return os.path.join(base_path, relative_path)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
app.exec()
|
app.exec()
|
||||||
@@ -19,6 +28,7 @@ if __name__ == '__main__':
|
|||||||
load_config()
|
load_config()
|
||||||
|
|
||||||
window = MainWindow()
|
window = MainWindow()
|
||||||
|
window.setWindowIcon(QIcon(resource_path('logo.ico')))
|
||||||
window.show()
|
window.show()
|
||||||
|
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
|||||||
Reference in New Issue
Block a user