From 3c51af9bcf034abbb78e59c9035e94a7774d3fa2 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sat, 16 May 2026 01:23:30 -0400 Subject: [PATCH] rm tmp files --- src/app_controller.py_tmp2 | 102 ------------------------------------- src/gui_2.py_tmp | 5 -- 2 files changed, 107 deletions(-) delete mode 100644 src/app_controller.py_tmp2 delete mode 100644 src/gui_2.py_tmp diff --git a/src/app_controller.py_tmp2 b/src/app_controller.py_tmp2 deleted file mode 100644 index 87272565..00000000 --- a/src/app_controller.py_tmp2 +++ /dev/null @@ -1,102 +0,0 @@ -def _api_generate(controller: 'AppController', req: GenerateRequest) -> dict[str, Any]: - """ - - Triggers an AI generation request using the current project context. - [SDM: src/app_controller.py:_api_generate] - """ - if not req.prompt.strip(): - raise HTTPException(status_code=400, detail="Prompt cannot be empty") - with controller._send_thread_lock: - start_time = time.time() - try: - # 1. Build context - from src import aggregate - full_md, path, file_items, stable_md, disc_text = controller._do_generate() - controller._last_stable_md = stable_md - controller.last_md = md - controller.last_md_path = path - controller.last_file_items = file_items - - user_msg = req.prompt - - # 2. RAG Retrieval - if controller.rag_engine and controller.rag_config and controller.rag_config.enabled: - try: - chunks = controller.rag_engine.search(user_msg) - if chunks: - context_block = "## Retrieved Context\n\n" - for i, chunk in enumerate(chunks): - path = chunk.get("metadata", {}).get("path", "unknown") - context_block += f"### Chunk {i+1} (Source: {path})\n{chunk.get('document', '')}\n\n" - user_msg = context_block + user_msg - except Exception as e: - sys.stderr.write(f"RAG search error: {e}\n") - sys.stderr.flush() - - # 3. Symbol Resolution - try: - from src.markdown_helper import parse_symbols, get_symbol_definition - symbols = parse_symbols(user_msg) - file_paths = [f.path if hasattr(f, "path") else f.get("path") if isinstance(f, dict) else str(f) for f in controller.last_file_items] - for symbol in symbols: - res = get_symbol_definition(symbol, file_paths) - if res: - file_path, definition, line = res - user_msg += f'\n\n[Definition: {symbol} from {file_path} (line {line})]\n```python\n{definition}\n```' - except Exception as e: - sys.stderr.write(f"Symbol resolution error: {e}\n") - sys.stderr.flush() - - base_dir = controller.active_project_root - csp = filter(bool, [controller.ui_global_system_prompt.strip(), controller.ui_project_system_prompt.strip()]) - ai_client.set_custom_system_prompt("\n\n".join(csp)) - ai_client.set_base_system_prompt(controller.ui_base_system_prompt) - ai_client.set_use_default_base_prompt(controller.ui_use_default_base_prompt) - ai_client.set_project_context_marker(controller.ui_project_context_marker) - temp = req.temperature if req.temperature is not None else controller.temperature - top_p = req.top_p if req.top_p is not None else controller.top_p - tokens = req.max_tokens if req.max_tokens is not None else controller.max_tokens - ai_client.set_model_params(temp, tokens, controller.history_trunc_limit, top_p) - ai_client.set_agent_tools(controller.ui_agent_tools) - - if req.auto_add_history: - with controller._pending_history_adds_lock: - controller._pending_history_adds.append({ - "role": "User", - "content": user_msg, - "collapsed": True, - "ts": project_manager.now_ts() - }) - - try: - resp = ai_client.send(stable_md, user_msg, base_dir, controller.last_file_items, disc_text, rag_engine=None) - - if req.auto_add_history: - with controller._pending_history_adds_lock: - controller._pending_history_adds.append({ - "role": "AI", - "content": resp, - "collapsed": True, - "ts": project_manager.now_ts() - }) - - controller._recalculate_session_usage() - duration = time.time() - start_time - return { - "text": resp, - "metadata": { - "provider": controller.current_provider, - "model": controller.current_model, - "duration_sec": round(duration, 3), - "timestamp": project_manager.now_ts() - }, - "usage": controller.session_usage - } - except ai_client.ProviderError as e: - raise HTTPException(status_code=500, detail=e.ui_message()) - except Exception as e: - raise HTTPException(status_code=500, detail=str(e)) - except Exception as e: - import traceback - traceback.print_exc() - raise HTTPException(status_code=500, detail=str(e)) \ No newline at end of file diff --git a/src/gui_2.py_tmp b/src/gui_2.py_tmp deleted file mode 100644 index 2ff87802..00000000 --- a/src/gui_2.py_tmp +++ /dev/null @@ -1,5 +0,0 @@ - def __setattr__(self, name: str, value: Any) -> None: - if name != 'controller' and hasattr(self, 'controller') and hasattr(self.controller, name): - setattr(self.controller, name, value) - else: - object.__setattr__(self, name, value) \ No newline at end of file