From 8bdd415b4d12c453ba28e077fdd1fa63cc6f0d71 Mon Sep 17 00:00:00 2001 From: Viswamedha Nalabotu Date: Sun, 22 Mar 2026 21:30:51 +0000 Subject: [PATCH] Cleaned up unnnecessary markers --- apps/onboarding/consumers/base.py | 7 +------ apps/onboarding/consumers/progress.py | 1 - apps/onboarding/consumers/prompts.py | 25 +++++++++++++++++++--- site/src/views/OrganizationManage.vue | 30 ++++++++++++--------------- 4 files changed, 36 insertions(+), 27 deletions(-) diff --git a/apps/onboarding/consumers/base.py b/apps/onboarding/consumers/base.py index 86f5be6..0285f0f 100644 --- a/apps/onboarding/consumers/base.py +++ b/apps/onboarding/consumers/base.py @@ -40,7 +40,6 @@ class BaseOnboardingConsumer(AsyncWebsocketConsumer): logger: logging.Logger = logger moderator: ContentModerator = ContentModerator() - ### Connection Management ### async def connect(self): self.user = self.scope["user"] if not self.user.is_authenticated: @@ -54,7 +53,6 @@ class BaseOnboardingConsumer(AsyncWebsocketConsumer): async def disconnect(self, close_code: int): self.logger.info(f"WebSocket disconnected: user={self.user.full_name} close_code={close_code}") - ### Event Handling ### async def receive(self, text_data: str): """ Main entry point for incoming messages. @@ -76,8 +74,7 @@ class BaseOnboardingConsumer(AsyncWebsocketConsumer): await self.send_error(f"An unexpected error occurred when processing the event.") self.logger.exception(f"WebSocket receive critical failure: {str(e)}") - ### MCP Handling ### - async def orchestrate(self, message: str, config: AgentConfig, minimum_turns: int = 2, maximum_turns: int = 5, + async def orchestrate(self, message: str, config: AgentConfig, minimum_turns: int = 2, maximum_turns: int = 5, max_tokens: int | None = None, raise_on_error: bool = False, request_timeout: float = settings.INFERENCE_REQUEST_TIMEOUT) -> str: """ Orchestrates a multi-turn conversation with the agent, including tool calls and reasoning steps. @@ -179,7 +176,6 @@ class BaseOnboardingConsumer(AsyncWebsocketConsumer): self.logger.exception("Streaming LLM call failed: %s", e) return None - ### Regular Helpers ### async def send_log(self, log_type: LogType, message: str, content: str | dict | None = None): if log_type == LogType.ERROR: self.logger.error(f"[{log_type.value}]: message={str(message)[:100]} content={str(content)[:60]}") @@ -212,7 +208,6 @@ class BaseOnboardingConsumer(AsyncWebsocketConsumer): return max_tokens return None - ### Database Helpers ### @database_sync_to_async def get_config(self, config_uuid): return AgentConfig.objects.get(uuid = config_uuid) diff --git a/apps/onboarding/consumers/progress.py b/apps/onboarding/consumers/progress.py index 12c4098..438eea5 100644 --- a/apps/onboarding/consumers/progress.py +++ b/apps/onboarding/consumers/progress.py @@ -62,7 +62,6 @@ class OnboardingProgressConsumer(BaseOnboardingConsumer): "is_completed": progress_context.get("is_completed", False), }) - ### Database Helpers ### @database_sync_to_async def get_role_progress_context(self, role_uuid, user_id, flow_uuid=None): diff --git a/apps/onboarding/consumers/prompts.py b/apps/onboarding/consumers/prompts.py index 61a97b6..bf547b6 100644 --- a/apps/onboarding/consumers/prompts.py +++ b/apps/onboarding/consumers/prompts.py @@ -45,13 +45,32 @@ class OnboardingPrompts: "If no indexed documents are available, provide a concise best-practice overview and clearly say no indexed documents were found. " "Use Markdown formatting and do NOT include a table of contents in this section. " "Generate substantial depth: target 900-1400 words. " - "Include these sections in order: Overview, Core Concepts, Role-Specific Workflow, Practical Examples, Common Pitfalls, and Action Checklist. " - "In Practical Examples, provide at least 2 concrete examples relevant to this role/topic. " - "In Action Checklist, provide at least 8 actionable checklist items.\n\n" + "Choose a section structure that genuinely fits this topic — do not use a fixed template. " + "For example: a procedural topic suits step-by-step sections; a conceptual topic suits definitions and examples; " + "a compliance topic suits policy context, requirements, and consequences. " + "You may draw on headings such as Overview, Key Concepts, Step-by-Step Process, Worked Examples, " + "Common Mistakes, Policy Requirements, Quick Reference, or a Checklist — but only include sections " + "that add value for this specific topic. Always end with at least 6 actionable checklist items.\n\n" f"Topic: {topic}\n" f"MCP search context:\n{context_markdown}" ) + # @staticmethod + # def knowledge_generation_prompt(topic, context_markdown): + # return ( + # f"Write a practical onboarding training guide for the topic '{topic}'. " + # "Think step-by-step internally before writing the final answer. " + # "Use the MCP search context below as your primary source, and call additional tools if needed. " + # "If no indexed documents are available, provide a concise best-practice overview and clearly say no indexed documents were found. " + # "Use Markdown formatting and do NOT include a table of contents in this section. " + # "Generate substantial depth: target 900-1400 words. " + # "Include these sections in order: Overview, Core Concepts, Role-Specific Workflow, Practical Examples, Common Pitfalls, and Action Checklist. " + # "In Practical Examples, provide at least 2 concrete examples relevant to this role/topic. " + # "In Action Checklist, provide at least 8 actionable checklist items.\n\n" + # f"Topic: {topic}\n" + # f"MCP search context:\n{context_markdown}" + # ) + @staticmethod def quiz_generation_prompt(question_count, module_briefs): return ( diff --git a/site/src/views/OrganizationManage.vue b/site/src/views/OrganizationManage.vue index e6abf33..07669e0 100644 --- a/site/src/views/OrganizationManage.vue +++ b/site/src/views/OrganizationManage.vue @@ -566,7 +566,19 @@ const createInvite = async () => { } } -const fallbackCopyText = (text: string): boolean => { +const copyToClipboard = async (text: string): Promise => { + const safeText = String(text || '').trim() + if (!safeText) return false + + if (window.isSecureContext && window.navigator.clipboard?.writeText) { + try { + await window.navigator.clipboard.writeText(safeText) + return true + } catch { + // Fallback to older method if clipboard API fails + } + } + const textarea = document.createElement('textarea') textarea.value = text textarea.setAttribute('readonly', 'true') @@ -582,22 +594,6 @@ const fallbackCopyText = (text: string): boolean => { return copied } -const copyToClipboard = async (text: string): Promise => { - const safeText = String(text || '').trim() - if (!safeText) return false - - if (window.isSecureContext && window.navigator.clipboard?.writeText) { - try { - await window.navigator.clipboard.writeText(safeText) - return true - } catch { - // Fall through to legacy copy for restricted browser contexts. - } - } - - return fallbackCopyText(safeText) -} - const copyInviteUrl = async () => { const copied = await copyToClipboard(newInviteUrl.value) if (copied) {