Private
Public Access
more org
This commit is contained in:
@@ -1,29 +0,0 @@
|
|||||||
"""Minimal reproducer for the auto_switch_sim GUI crash."""
|
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
import os
|
|
||||||
sys.path.insert(0, 'C:/projects/manual_slop')
|
|
||||||
sys.path.insert(0, 'C:/projects/manual_slop/src')
|
|
||||||
|
|
||||||
from src.api_hook_client import ApiHookClient
|
|
||||||
client = ApiHookClient()
|
|
||||||
if not client.wait_for_server(timeout=15):
|
|
||||||
print('FAIL: server not up')
|
|
||||||
sys.exit(1)
|
|
||||||
print('OK: server up')
|
|
||||||
|
|
||||||
print('Step 1: click btn_reset')
|
|
||||||
client.click('btn_reset')
|
|
||||||
time.sleep(1.0)
|
|
||||||
print('Step 1 done, status=', client.get_value('ai_status'))
|
|
||||||
|
|
||||||
print('Step 2: set_value current_provider gemini_cli')
|
|
||||||
client.set_value('current_provider', 'gemini_cli')
|
|
||||||
time.sleep(1.0)
|
|
||||||
print('Step 2 done')
|
|
||||||
|
|
||||||
print('Step 3: set_value gcli_path')
|
|
||||||
mock_path = os.path.abspath('tests/mock_concurrent_mma.py')
|
|
||||||
client.set_value('gcli_path', '"' + sys.executable + '" "' + mock_path + '"')
|
|
||||||
time.sleep(1.0)
|
|
||||||
print('Step 3 done')
|
|
||||||
+6
-12
@@ -1,3 +1,4 @@
|
|||||||
|
import difflib
|
||||||
import shutil
|
import shutil
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@@ -25,12 +26,10 @@ def parse_hunk_header(line: str) -> Optional[tuple[int, int, int, int]]:
|
|||||||
"""
|
"""
|
||||||
[C: tests/test_diff_viewer.py:test_parse_hunk_header]
|
[C: tests/test_diff_viewer.py:test_parse_hunk_header]
|
||||||
"""
|
"""
|
||||||
if not line.startswith("@@"):
|
if not line.startswith("@@"): return None
|
||||||
return None
|
|
||||||
|
|
||||||
parts = line.split()
|
parts = line.split()
|
||||||
if len(parts) < 2:
|
if len(parts) < 2: return None
|
||||||
return None
|
|
||||||
|
|
||||||
old_part = parts[1][1:]
|
old_part = parts[1][1:]
|
||||||
new_part = parts[2][1:]
|
new_part = parts[2][1:]
|
||||||
@@ -117,20 +116,15 @@ def get_line_color(line: str) -> Optional[str]:
|
|||||||
"""
|
"""
|
||||||
[C: tests/test_diff_viewer.py:test_get_line_color]
|
[C: tests/test_diff_viewer.py:test_get_line_color]
|
||||||
"""
|
"""
|
||||||
if line.startswith("+"):
|
if line.startswith("+"): return "green"
|
||||||
return "green"
|
elif line.startswith("-"): return "red"
|
||||||
elif line.startswith("-"):
|
elif line.startswith("@@"): return "cyan"
|
||||||
return "red"
|
|
||||||
elif line.startswith("@@"):
|
|
||||||
return "cyan"
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def apply_patch_to_file(patch_text: str, base_dir: str = ".") -> Tuple[bool, str]:
|
def apply_patch_to_file(patch_text: str, base_dir: str = ".") -> Tuple[bool, str]:
|
||||||
"""
|
"""
|
||||||
[C: src/gui_2.py:App._apply_pending_patch, tests/test_diff_viewer.py:test_apply_patch_simple, tests/test_diff_viewer.py:test_apply_patch_with_context]
|
[C: src/gui_2.py:App._apply_pending_patch, tests/test_diff_viewer.py:test_apply_patch_simple, tests/test_diff_viewer.py:test_apply_patch_with_context]
|
||||||
"""
|
"""
|
||||||
import difflib
|
|
||||||
|
|
||||||
diff_files = parse_diff(patch_text)
|
diff_files = parse_diff(patch_text)
|
||||||
if not diff_files:
|
if not diff_files:
|
||||||
return False, "No valid diff found"
|
return False, "No valid diff found"
|
||||||
|
|||||||
+4
-9
File diff suppressed because one or more lines are too long
@@ -196,8 +196,6 @@ class GeminiCliAdapter:
|
|||||||
|
|
||||||
def count_tokens(self, contents: list[str]) -> int:
|
def count_tokens(self, contents: list[str]) -> int:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
Provides a character-based token estimation for the Gemini CLI.
|
Provides a character-based token estimation for the Gemini CLI.
|
||||||
Uses 4 chars/token as a conservative average.
|
Uses 4 chars/token as a conservative average.
|
||||||
[C: tests/test_gemini_cli_adapter_parity.py:TestGeminiCliAdapterParity.test_count_tokens_fallback]
|
[C: tests/test_gemini_cli_adapter_parity.py:TestGeminiCliAdapterParity.test_count_tokens_fallback]
|
||||||
|
|||||||
Reference in New Issue
Block a user