chore: config, layout, project history, simulation framework updates
This commit is contained in:
@@ -10,9 +10,9 @@ class AISettingsSimulation(BaseSimulation):
|
||||
provider = self.client.get_value("current_provider")
|
||||
model = self.client.get_value("current_model")
|
||||
print(f"[Sim] Initial Provider: {provider}, Model: {model}")
|
||||
assert provider == "gemini", f"Expected gemini, got {provider}"
|
||||
assert provider == "gemini_cli", f"Expected gemini_cli, got {provider}"
|
||||
# 2. Switch to another Gemini model
|
||||
other_gemini = "gemini-1.5-flash"
|
||||
other_gemini = "gemini-2.0-flash"
|
||||
print(f"[Sim] Switching to {other_gemini}...")
|
||||
self.client.set_value("current_model", other_gemini)
|
||||
time.sleep(2)
|
||||
|
||||
@@ -22,9 +22,16 @@ class BaseSimulation:
|
||||
print(f"\n[BaseSim] Connecting to GUI...")
|
||||
if not self.client.wait_for_server(timeout=5):
|
||||
raise RuntimeError("Could not connect to GUI. Ensure it is running with --enable-test-hooks")
|
||||
self.client.set_value("auto_add_history", True)
|
||||
# Wait for propagation
|
||||
_start = time.time()
|
||||
while time.time() - _start < 5.0:
|
||||
if self.client.get_value("auto_add_history") is True:
|
||||
break
|
||||
time.sleep(0.1)
|
||||
print("[BaseSim] Resetting session...")
|
||||
self.client.click("btn_reset")
|
||||
time.sleep(0.5)
|
||||
time.sleep(2.0)
|
||||
git_dir = os.path.abspath(".")
|
||||
self.project_path = os.path.abspath(f"tests/artifacts/temp_{project_name.lower()}.toml")
|
||||
if os.path.exists(self.project_path):
|
||||
@@ -32,10 +39,9 @@ class BaseSimulation:
|
||||
print(f"[BaseSim] Scaffolding Project: {project_name}")
|
||||
self.sim.setup_new_project(project_name, git_dir, self.project_path)
|
||||
# Standard test settings
|
||||
self.client.set_value("auto_add_history", True)
|
||||
self.client.set_value("current_provider", "gemini")
|
||||
self.client.set_value("current_model", "gemini-2.5-flash-lite")
|
||||
time.sleep(0.2)
|
||||
time.sleep(1.5)
|
||||
|
||||
def teardown(self) -> None:
|
||||
if self.project_path and os.path.exists(self.project_path):
|
||||
|
||||
@@ -6,11 +6,10 @@ from simulation.sim_base import BaseSimulation, run_sim
|
||||
class ContextSimulation(BaseSimulation):
|
||||
def run(self) -> None:
|
||||
print("\n--- Running Context & Chat Simulation ---")
|
||||
# 1. Test Discussion Creation
|
||||
disc_name = f"TestDisc_{int(time.time())}"
|
||||
print(f"[Sim] Creating discussion: {disc_name}")
|
||||
self.sim.create_discussion(disc_name)
|
||||
time.sleep(1)
|
||||
# 1. Skip Discussion Creation, use 'main'
|
||||
print("[Sim] Using existing 'main' discussion")
|
||||
self.sim.switch_discussion("main")
|
||||
time.sleep(1.5)
|
||||
# Verify it's in the list
|
||||
session = self.client.get_session()
|
||||
# The session structure usually has discussions listed somewhere, or we can check the listbox
|
||||
@@ -47,6 +46,7 @@ class ContextSimulation(BaseSimulation):
|
||||
msg = "What is the current date and time? Answer in one sentence."
|
||||
print(f"[Sim] Sending message: {msg}")
|
||||
self.sim.run_discussion_turn(msg)
|
||||
time.sleep(10)
|
||||
# 4. Verify History
|
||||
print("[Sim] Verifying history...")
|
||||
session = self.client.get_session()
|
||||
|
||||
@@ -10,6 +10,7 @@ class ToolsSimulation(BaseSimulation):
|
||||
msg = "List the files in the current directory."
|
||||
print(f"[Sim] Sending message to trigger tool: {msg}")
|
||||
self.sim.run_discussion_turn(msg)
|
||||
time.sleep(2)
|
||||
# 2. Wait for AI to execute tool
|
||||
print("[Sim] Waiting for tool execution...")
|
||||
time.sleep(5) # Give it some time
|
||||
@@ -21,6 +22,7 @@ class ToolsSimulation(BaseSimulation):
|
||||
msg = "Read the first 10 lines of aggregate.py."
|
||||
print(f"[Sim] Sending message to trigger tool: {msg}")
|
||||
self.sim.run_discussion_turn(msg)
|
||||
time.sleep(2)
|
||||
# 5. Wait and Verify
|
||||
print("[Sim] Waiting for tool execution...")
|
||||
time.sleep(5)
|
||||
@@ -32,7 +34,9 @@ class ToolsSimulation(BaseSimulation):
|
||||
# Actually in Gemini history, they might be nested.
|
||||
# But our GUI disc_entries list usually has them as separate entries or
|
||||
# they are part of the AI turn.
|
||||
# Let's check if the AI mentions it in its response
|
||||
if not entries:
|
||||
print("[Sim] ERROR: No history entries found after tool execution.")
|
||||
return
|
||||
last_ai_msg = entries[-1]['content']
|
||||
print(f"[Sim] Final AI Response: {last_ai_msg[:100]}...")
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ class WorkflowSimulator:
|
||||
print(f"Creating discussion: {name}")
|
||||
self.client.set_value("disc_new_name_input", name)
|
||||
self.client.click("btn_disc_create")
|
||||
time.sleep(1)
|
||||
self.client.select_list_item('disc_listbox', name)
|
||||
time.sleep(2)
|
||||
|
||||
def switch_discussion(self, name: str) -> None:
|
||||
print(f"Switching to discussion: {name}")
|
||||
@@ -54,6 +55,8 @@ class WorkflowSimulator:
|
||||
session = self.client.get_session()
|
||||
entries = session.get('session', {}).get('entries', [])
|
||||
user_message = self.user_agent.generate_response(entries)
|
||||
active_disc = self.client.get_value("active_discussion")
|
||||
print(f"[DEBUG] Current active discussion in GUI: {active_disc}")
|
||||
print(f"\n[USER]: {user_message}")
|
||||
self.client.set_value("ai_input", user_message)
|
||||
self.client.click("btn_gen_send")
|
||||
@@ -61,6 +64,7 @@ class WorkflowSimulator:
|
||||
def wait_for_ai_response(self, timeout: int = 60) -> dict | None:
|
||||
print("Waiting for AI response...", end="", flush=True)
|
||||
start_time = time.time()
|
||||
last_print_time = start_time
|
||||
last_count = len(self.client.get_session().get('session', {}).get('entries', []))
|
||||
while time.time() - start_time < timeout:
|
||||
# Check for error status first
|
||||
@@ -71,6 +75,9 @@ class WorkflowSimulator:
|
||||
time.sleep(1)
|
||||
print(".", end="", flush=True)
|
||||
entries = self.client.get_session().get('session', {}).get('entries', [])
|
||||
if time.time() - last_print_time >= 5:
|
||||
print(f"\n[DEBUG] Current total entries: {len(entries)}")
|
||||
last_print_time = time.time()
|
||||
if len(entries) > last_count:
|
||||
last_entry = entries[-1]
|
||||
if last_entry.get('role') == 'AI' and last_entry.get('content'):
|
||||
@@ -80,4 +87,6 @@ class WorkflowSimulator:
|
||||
print(f"[WARN] AI response appears to contain an error message.")
|
||||
return last_entry
|
||||
print("\nTimeout waiting for AI")
|
||||
active_disc = self.client.get_value("active_discussion")
|
||||
print(f"[DEBUG] Active discussion in GUI at timeout: {active_disc}")
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user