Cleaned up unnnecessary markers
This commit is contained in:
parent
9044e2afaa
commit
8bdd415b4d
4 changed files with 36 additions and 27 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
|
|
|
|||
|
|
@ -566,7 +566,19 @@ const createInvite = async () => {
|
|||
}
|
||||
}
|
||||
|
||||
const fallbackCopyText = (text: string): boolean => {
|
||||
const copyToClipboard = async (text: string): Promise<boolean> => {
|
||||
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<boolean> => {
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue