summary refs log tree commit diff stats
path: root/classification
diff options
context:
space:
mode:
authorChristian Krinitsin <mail@krinitsin.com>2025-07-03 07:27:29 +0000
committerChristian Krinitsin <mail@krinitsin.com>2025-07-03 07:27:29 +0000
commit7f4364274750eb8cb39a3e7493132fca1c01232e (patch)
tree7fcda7569962109304a794ecfd7a9ae381c789a1 /classification
parentbf49cfef2f923bcaaf6e4f44470b0c29cb829c34 (diff)
downloadqemu-analysis-7f4364274750eb8cb39a3e7493132fca1c01232e.tar.gz
qemu-analysis-7f4364274750eb8cb39a3e7493132fca1c01232e.zip
change order of preambel
Diffstat (limited to 'classification')
-rwxr-xr-xclassification/classifier.py8
-rw-r--r--classification/preambel9
2 files changed, 8 insertions, 9 deletions
diff --git a/classification/classifier.py b/classification/classifier.py
index 7b08439ab..21fbbd4e8 100755
--- a/classification/classifier.py
+++ b/classification/classifier.py
@@ -16,11 +16,13 @@ args = parser.parse_args()
 
 positive_categories = ['semantic', 'TCG', 'assembly', 'architecture', 'mistranslation', 'register', 'user-level']
 architectures = ['x86', 'arm', 'risc-v', 'i386', 'ppc']
-negative_categories = ['boot', 'network', 'KVM', 'vnc', 'graphic', 'device', 'socket', 'debug', 'files', 'PID', 'permissions', 'performance', 'kernel', 'peripherals', 'VMM', 'hypervisor', 'virtual', 'other']
+negative_categories = ['boot', 'network', 'kvm', 'vnc', 'graphic', 'device', 'socket', 'debug', 'files', 'PID', 'permissions', 'performance', 'kernel', 'peripherals', 'VMM', 'hypervisor', 'virtual', 'other']
 categories = positive_categories + negative_categories + architectures
 
 def list_files_recursive(directory, basename = False):
     result = []
+    if not path.isdir(directory):
+        return result
     for entry in listdir(directory):
         full_path = path.join(directory, entry)
         if path.isdir(full_path):
@@ -132,8 +134,8 @@ def main():
             text = file.read()
 
         if args.deepseek:
-            response = chat(args.deepseek, [{'role': 'user', 'content': preambel + "\n" + text,}])
-            category = sub(r'[^a-zA-Z]', '', response['message']['content'].split()[-1])
+            response = chat(args.deepseek, [{'role': 'user', 'content': text + "\n" + preambel,}])
+            category = sub(r'[^a-zA-Z]', '', response['message']['content'].split()[-1]).lower()
             if not category in categories:
                 category = "manual-review"
             output(text, category, [], [], path.basename(bug), response['message']['content'])
diff --git a/classification/preambel b/classification/preambel
index 3f3cc7412..55bebebdd 100644
--- a/classification/preambel
+++ b/classification/preambel
@@ -1,4 +1,5 @@
-Classify the following bug report. it is part of qemu.
+
+Classify the given bug report. It is part of qemu.
 
 These are the possible categories:
 
@@ -9,7 +10,7 @@ device
 graphic
 socket
 network
-KVM
+kvm
 boot
 vnc
 debug
@@ -21,7 +22,3 @@ peripherals
 hypervisor
 
 Respond only with a single word, the name of the category. 
-
-Bug report follows:
-
-