fix(gui): Resolve Markdown squashing, MiniMax compression error, and UI import issues
- Modularize discussion entry rendering to src/discussion_entry_renderer.py to fix layout squashing. - Fix MiniMax compression routing with robust case-insensitive check and synced base URL. - Implement src/ui_shared.py to resolve circular imports and consolidate shared UI helpers. - Finalize Structural File Editor integration and state unification.
This commit is contained in:
+15
-14
@@ -2469,7 +2469,7 @@ def get_token_stats(md_content: str) -> dict[str, Any]:
|
||||
total_tokens = cast(int, resp.total_tokens)
|
||||
except Exception:
|
||||
pass
|
||||
elif _provider == "gemini_cli":
|
||||
elif p == "gemini_cli":
|
||||
try:
|
||||
_ensure_gemini_client()
|
||||
if _gemini_client:
|
||||
@@ -2527,22 +2527,22 @@ def send(
|
||||
md_content, user_message, base_dir, file_items, discussion_history,
|
||||
pre_tool_callback, qa_callback, enable_tools, stream_callback, patch_callback
|
||||
)
|
||||
elif _provider == "gemini_cli":
|
||||
elif p == "gemini_cli":
|
||||
res = _send_gemini_cli(
|
||||
md_content, user_message, base_dir, file_items, discussion_history,
|
||||
pre_tool_callback, qa_callback, stream_callback, patch_callback
|
||||
)
|
||||
elif _provider == "anthropic":
|
||||
elif p == "anthropic":
|
||||
res = _send_anthropic(
|
||||
md_content, user_message, base_dir, file_items, discussion_history,
|
||||
pre_tool_callback, qa_callback, stream_callback=stream_callback, patch_callback=patch_callback
|
||||
)
|
||||
elif _provider == "deepseek":
|
||||
elif p == "deepseek":
|
||||
res = _send_deepseek(
|
||||
md_content, user_message, base_dir, file_items, discussion_history,
|
||||
stream, pre_tool_callback, qa_callback, stream_callback, patch_callback
|
||||
)
|
||||
elif _provider == "minimax":
|
||||
elif p == "minimax":
|
||||
res = _send_minimax(
|
||||
md_content, user_message, base_dir, file_items, discussion_history,
|
||||
stream, pre_tool_callback, qa_callback, stream_callback, patch_callback
|
||||
@@ -2598,7 +2598,7 @@ def run_subagent_summarization(file_path: str, content: str, is_code: bool, outl
|
||||
)
|
||||
)
|
||||
return resp.text or ""
|
||||
elif _provider == "anthropic":
|
||||
elif p == "anthropic":
|
||||
_ensure_anthropic_client()
|
||||
if _anthropic_client:
|
||||
resp = _anthropic_client.messages.create(
|
||||
@@ -2607,7 +2607,7 @@ def run_subagent_summarization(file_path: str, content: str, is_code: bool, outl
|
||||
messages=[{"role": "user", "content": prompt}]
|
||||
)
|
||||
return "".join([b.text for b in resp.content if hasattr(b, "text") and b.text])
|
||||
elif _provider == "deepseek":
|
||||
elif p == "deepseek":
|
||||
creds = _load_credentials()
|
||||
api_key = creds.get("deepseek", {}).get("api_key")
|
||||
if not api_key: return "ERROR: DeepSeek API key missing"
|
||||
@@ -2623,7 +2623,7 @@ def run_subagent_summarization(file_path: str, content: str, is_code: bool, outl
|
||||
return r.json()["choices"][0]["message"]["content"]
|
||||
except Exception as e:
|
||||
return f"ERROR: DeepSeek summarization failed: {e}"
|
||||
elif _provider == "gemini_cli":
|
||||
elif p == "gemini_cli":
|
||||
# Using the adapter for a one-off call
|
||||
adapter = GeminiCliAdapter(binary_path="gemini")
|
||||
resp_data = adapter.send(prompt, model=_model)
|
||||
@@ -2631,8 +2631,9 @@ def run_subagent_summarization(file_path: str, content: str, is_code: bool, outl
|
||||
return "ERROR: Unsupported provider for sub-agent summarization"
|
||||
|
||||
def run_discussion_compression(discussion_text: str) -> str:
|
||||
p = str(get_provider()).lower().strip()
|
||||
prompt = f"The following is a long conversation history.\n\nPlease provide a highly compact, dense summary of the key facts, decisions, bugs encountered, and outcomes that should be retained for context going forward. Categorize into User intent, Tool outputs, and AI reasoning. Omit pleasantries and redundant thoughts.\n\n[HISTORY]\n{discussion_text}"
|
||||
if _provider == "gemini":
|
||||
if p == "gemini":
|
||||
_ensure_gemini_client()
|
||||
if _gemini_client:
|
||||
resp = _gemini_client.models.generate_content(
|
||||
@@ -2641,7 +2642,7 @@ def run_discussion_compression(discussion_text: str) -> str:
|
||||
config=types.GenerateContentConfig(temperature=0.0, max_output_tokens=2048)
|
||||
)
|
||||
return resp.text or ""
|
||||
elif _provider == "anthropic":
|
||||
elif p == "anthropic":
|
||||
_ensure_anthropic_client()
|
||||
if _anthropic_client:
|
||||
resp = _anthropic_client.messages.create(
|
||||
@@ -2649,7 +2650,7 @@ def run_discussion_compression(discussion_text: str) -> str:
|
||||
messages=[{"role": "user", "content": prompt}]
|
||||
)
|
||||
return "".join([b.text for b in resp.content if hasattr(b, "text") and b.text])
|
||||
elif _provider == "deepseek":
|
||||
elif p == "deepseek":
|
||||
creds = _load_credentials()
|
||||
api_key = creds.get("deepseek", {}).get("api_key")
|
||||
if not api_key: return "ERROR: DeepSeek API key missing"
|
||||
@@ -2659,7 +2660,7 @@ def run_discussion_compression(discussion_text: str) -> str:
|
||||
return r.json()["choices"][0]["message"]["content"]
|
||||
except Exception as e:
|
||||
return f"ERROR: DeepSeek compression failed: {e}"
|
||||
elif _provider == "minimax":
|
||||
elif p == "minimax":
|
||||
_ensure_minimax_client()
|
||||
if _minimax_client:
|
||||
resp = _minimax_client.chat.completions.create(
|
||||
@@ -2669,10 +2670,10 @@ def run_discussion_compression(discussion_text: str) -> str:
|
||||
max_tokens=2048
|
||||
)
|
||||
return resp.choices[0].message.content or ""
|
||||
elif _provider == "gemini_cli":
|
||||
elif p == "gemini_cli":
|
||||
adapter = GeminiCliAdapter(binary_path="gemini")
|
||||
resp_data = adapter.send(prompt, model=_model)
|
||||
return resp_data.get("text", "")
|
||||
return "ERROR: Unsupported provider for discussion compression"
|
||||
return f"ERROR: Unsupported provider for discussion compression: '{p}'"
|
||||
|
||||
#endregion: Subagent Summarization
|
||||
|
||||
Reference in New Issue
Block a user