§
    éƒtjÄ  ã                  ó`   — d Z ddlmZ ddlZdZdZdZdd„Zdd„Zddddddœdd„Z	dd„Z
dd„ZdS )uY   Natural assistant voice â€” identity, help, and LLM context without repetitive templates.é    )ÚannotationsNu!  You are {agent_name}, an AI assistant that answers from the user's uploaded knowledge base.

The user asked about your identity â€” not about their files.
Write 2â€“4 natural sentences. Be warm and professional.
- Say you are an AI assistant (not a person) â€” neither a boy nor a girl; you don't have a gender.
- Your focus: answering questions using documents they upload to Knowledge, plus general questions.
- If they have documents loaded, mention that briefly in ONE short phrase â€” do not list every capability or filename.
- If the user's name is known, you may use it once naturally.
- Do NOT repeat a full onboarding script.
- Do NOT mention RAG, vectors, embeddings, or internal systems.
- No greeting if you already spoke this session; no goodbye.

{context_block}
User: {question}
Reply:u  You are {agent_name}, an AI assistant for uploaded knowledge-base documents.

The user asked how you can help â€” not for a specific document answer yet.
Write 2â€“4 natural sentences. Give 2â€“3 concrete examples as questions they could ask (e.g. summarize the file, find a name or date, explain a section).
If documents are loaded, reference that you can use their uploaded files â€” without repeating the same capability paragraph from earlier in the chat.
If the user's name is known, you may use it once.
Vary your wording from prior turns; do not copy-paste previous replies.
Do NOT list filenames unless they explicitly asked what files you have.
Do NOT mention RAG, vectors, or internal systems.
No greeting if you already spoke this session.

{context_block}
User: {question}
Reply:uL  You are {agent_name}, a helpful AI assistant.

The user asked a general knowledge question â€” NOT about their uploaded documents unless they explicitly tied it to their files.
Answer accurately in 2â€“5 short sentences. Start with a brief natural lead-in when it fits ("Good question.", "Sure â€”", etc.) â€” not every time.
Do not invent document-specific numbers. Do not quote or summarize uploaded documents unless the question is about them.
If the user's name is known, you may use it once.
Never mention RAG, datasets, or internal systems.

{context_block}
User: {question}
Answer:ÚquestionÚstrÚreturnÚboolc                ór   — | pd                      ¦   «         }t          t          j        d|¦  «        ¦  «        S )NÚ a�  (?i)\b(who\s+(?:are|r)\s+you|tell\s+me\s+about\s+(?:yourself|you|the\s+bot|this\s+bot|the\s+assistant|alex)|about\s+(?:yourself|you)\b|what\s+are\s+you\b|are\s+you\s+(?:a\s+)?(?:boy|girl|male|female|man|woman|guy|human|robot|ai|bot|person)|are\s+you\s+(?:male\s+or\s+female|a\s+boy\s+or\s+(?:a\s+)?girl|real)|your\s+gender|what\s+gender\s+are\s+you|do\s+you\s+have\s+(?:a\s+)?gender)\b)Ústripr   ÚreÚsearch©r   Úqs     ú0/var/www/html/CA-Chatbot/app/saas/personality.pyÚis_identity_questionr   3   sB   € Ø	ˆ�R×ÒÑ Ô €AÝÝ
Œ	ð	ð ñ	
ô 	
ñô ð ó    c                ó”   — | pd                      ¦   «         }t          |¦  «        rdS t          t          j        d|¦  «        ¦  «        S )Nr	   Fz½(?i)\b(how\s+can\s+you\s+help|what\s+can\s+you\s+do|how\s+do\s+you\s+work|what\s+do\s+you\s+do|help\s+me\s+(?:with|out)|what\s+are\s+you\s+(?:able|capable)|what\s+(?:can|could)\s+i\s+ask)\b)r
   r   r   r   r   r   s     r   Úis_capability_questionr   F   sW   € Ø	ˆ�R×ÒÑ Ô €AÝ˜AÑÔð ØˆuÝÝ
Œ	ðð
 ñ	
ô 	
ñ	ô 	ð 	r   Fr	   ©Ú	user_nameÚhas_knowledgeÚhas_statementÚhistoryÚalready_spoker   ú
str | Noner   r   r   r   c                óÆ  — g }| r|                      d| › d�¦  «         |r|                      d¦  «         n-|r|                      d¦  «         n|                      d¦  «         |r|                      d¦  «         |                     ¦   «         r<|                      d¦  «         |                      |                     ¦   «         ¦  «         |rd                     |¦  «        nd	S )
NzThe user's name is ú.z1They have an uploaded statement ready to analyze.z,They have documents in their knowledge base.zNo documents uploaded yet.uG   You have already chatted this session â€” do not re-introduce yourself.r	   Ú
zNo extra context.)Úappendr
   Újoin)r   r   r   r   r   Úliness         r   Úbuild_context_blockr!   V   só   € ð €EØð 9Ø�ŠÐ7¨9Ð7Ð7Ð7Ñ8Ô8Ð8Øð 3Ø�ŠÐHÑIÔIÐIÐIØ	ð 3Ø�ŠÐCÑDÔDÐDÐDà�ŠÐ1Ñ2Ô2Ð2Øð `Ø�ŠÐ^Ñ_Ô_Ð_Ø‡}‚}�„ð &Ø�Š�RÑÔÐØ�Š�W—]’]‘_”_Ñ%Ô%Ð%Ø$Ð=ˆ4�9Š9�UÑÔÐÐ*=Ð=r   Ú
agent_namec                ó¸   — t          |||||¬¦  «        }t          |¦  «        rt          nt          }|                     | ||                     ¦   «         ¬¦  «        S )Nr   ©r"   Úcontext_blockr   )r!   r   ÚIDENTITY_PROMPTÚCAPABILITY_PROMPTÚformatr
   )	r"   r   r   r   r   r   r   ÚctxÚtemplates	            r   Úbuild_meta_promptr+   o   sn   € õ ØØ#Ø#ØØ#ðñ ô €Cõ #7°xÑ"@Ô"@ÐW�ˆÕFW€HØ�?Š?ØØØ—’Ñ!Ô!ð ñ ô ð r   c                óà   — t          ||¬¦  «        }t                               | ||                     ¦   «         ¬¦  «        }|                     ¦   «         r|                     ¦   «         › d|› �}|S )N)r   r   r$   zL

Answer the latest user question. Use conversation context when relevant.

)r!   ÚCONCEPT_WITH_CONTEXTr(   r
   )r"   r   r   r   r)   Úbases         r   Úbuild_concept_promptr/   ˆ   sƒ   € õ ¨	¸7Ð
CÑ
CÔ
C€CÝ×&Ò&ØØØ—’Ñ!Ô!ð 'ñ ô €Dð
 ‡}‚}�„ð 
à�}Š}‰Œð ð àðð ð 	ð
 €Kr   )r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   )r"   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )
r"   r   r   r   r   r   r   r   r   r   )Ú__doc__Ú
__future__r   r   r&   r'   r-   r   r   r!   r+   r/   © r   r   ú<module>r3      sÆ   ðØ _Ð _à "Ð "Ð "Ð "Ð "Ð "à 	€	€	€	ð
€ð 
Ð ð
Ð ðð ð ð ð&ð ð ð ð$ !ØØØØð>ð >ð >ð >ð >ð >ð2ð ð ð ð2ð ð ð ð ð r   