diff --git a/desktop_env/evaluators/metrics/vscode.py b/desktop_env/evaluators/metrics/vscode.py index 61976f1..d207aae 100644 --- a/desktop_env/evaluators/metrics/vscode.py +++ b/desktop_env/evaluators/metrics/vscode.py @@ -236,6 +236,9 @@ def check_html_background_image(src_path: str, rule: Dict = None) -> float: Check if the background image is correctly set. multi-app:bb7db4c2-30b5-4be7-8dd7-b8c4ec7d3108 """ + if not src_path: + return 0.0 + from bs4 import BeautifulSoup with open(src_path, 'r') as f: html_content = f.read() @@ -252,6 +255,9 @@ def compare_result_files(src_path, tgt_path): Compare whether the content of two files are the same. multi-app:7f35355e-02a6-45b5-b140-f0be698bcf85 """ + if not src_path or not tgt_path: + return 0.0 + with open(src_path, 'r') as f: src_content = f.read().strip() with open(tgt_path, 'r') as f: diff --git a/desktop_env/server/main.py b/desktop_env/server/main.py index efa62c7..d53232e 100644 --- a/desktop_env/server/main.py +++ b/desktop_env/server/main.py @@ -63,7 +63,7 @@ def execute_command(): # Execute the command without any safety checks. try: - result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell, text=True) + result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell, text=True, timeout=120) return jsonify({ 'status': 'success', 'output': result.stdout, diff --git a/evaluation_examples/examples/libreoffice_impress/ac9bb6cb-1888-43ab-81e4-a98a547918cd.json b/evaluation_examples/examples/libreoffice_impress/ac9bb6cb-1888-43ab-81e4-a98a547918cd.json index c0d6ba0..053421c 100644 --- a/evaluation_examples/examples/libreoffice_impress/ac9bb6cb-1888-43ab-81e4-a98a547918cd.json +++ b/evaluation_examples/examples/libreoffice_impress/ac9bb6cb-1888-43ab-81e4-a98a547918cd.json @@ -63,6 +63,12 @@ "type": "vm_file", "path": "/home/user/Desktop/saa-format-guide.pptx", "dest": "saa-format-guide.pptx" + }, + "expected": { + "type": "rule", + "rules": { + "color": "red" + } } } } diff --git a/evaluation_examples/examples/multi_apps/4c26e3f3-3a14-4d86-b44a-d3cedebbb487.json b/evaluation_examples/examples/multi_apps/4c26e3f3-3a14-4d86-b44a-d3cedebbb487.json index 0a70b11..447a862 100644 --- a/evaluation_examples/examples/multi_apps/4c26e3f3-3a14-4d86-b44a-d3cedebbb487.json +++ b/evaluation_examples/examples/multi_apps/4c26e3f3-3a14-4d86-b44a-d3cedebbb487.json @@ -30,12 +30,12 @@ ], "evaluator": { "func": "check_brightness_decrease_and_structure_sim", - "expected": { + "result": { "type": "vm_file", "path": "/home/user/Desktop/background.png", "dest": "background.png" }, - "result": { + "expected": { "type": "cloud_file", "path": "https://drive.usercontent.google.com/download?id=13if1UwZ5ay6ADAVW2jp3rcyvAEBse6MJ&export=download&authuser=0&confirm=t&uuid=2ea03068-1874-4240-baa1-f8bb2f917a99&at=APZUnTXq6dVlASg819jCaI1A-rm2:1710136385956", "dest": "image_original.png" diff --git a/evaluation_examples/examples/multi_apps/demo.py b/evaluation_examples/examples/multi_apps/demo.py deleted file mode 100644 index ffa2b85..0000000 --- a/evaluation_examples/examples/multi_apps/demo.py +++ /dev/null @@ -1,19 +0,0 @@ -import pandas as pd - -file_path = "/Users/lxc/Downloads/Speedtest.csv" -# 找到csv第二行的第二个数据格里的值 -# with open(file_path, "r") as f: -# for i, line in enumerate(f): -# if i == 1: -# data = line.split(",")[1] -# break -# print(data) - -with open(file_path, "r") as f: - reader = pd.read_csv(f, sep=',', header=None) - # for column in reader.columns: - # if column.startswith("TEST_DATE"): - # data_col = column - # break - for data in reader['TEST_DATE']: - print(data) \ No newline at end of file