📄 config.cpython-312.pyc
/home/palash/git/local-ai/server/__pycache__/config.cpython-312.pyc
Language: pyc • Lines: 382
�

�U�j�m���ddlZddlZddlmZe�dZe�d�ZdZe�d�Zejjd�Z
ejjd�Zejjdd	�Zd
Zejjdd�Zd
Zejjdd�Zejjdd�Zejjdd�Zejjdd�Zeejjdd��Zejjdd�Zejjdd�j3�j5d�ZdZdZejjdd�j5d�Zejjdd �Zejjd!d�Z ejjd"d#�Z!ejjd$d�Z"ejjd%d�Z#ejjd&e"�Z$ejjd'e�d(��Z%ejjd)e�d*e$�d+��Z&ejjd,e�d*e$�d��Z'd-d.d/d0�Z(ejjd1ejjd2��Z)ejjd3d4�j3�jU�Z+e+d5vrd4Z+d6Z,d7Z-d8Z.d9Z/d:d;hZ0ejjd<�Z1d=�Z2e2e1ejjd>��\Z3Z4ejjd?�Z5ejjd@�Z6ejjdA�Z7ejjdBejjdC��Z8ejre8d6�D�dEZ:dFZ;gdG�d�dH�dI�dJ�ejjdK��dL�dM�e;�dN�dO�dP�dQ�dR�dS�dT�dS�dU�dV�dW�dX�dW�dY�dZ�d[�d\�d]�e8�d^�d_�d`�da�db�dc�dd�de�Z<gdG�d�dH�df�dJ�ejjdK��dL�dg�dE�dN�dh�dP�di�dR�dS�dU�dV�dj�dX�dj�dk�e=e��dl�dm�d^�d_�d`�da�db�dc�dd�dn�do�d_�dp�dq�d]�e8�Z>ejjdr�Z?ejj�e?ds�ZAejj�eAdt�ZBejj�e?du�ZCejjd?�ZDejjdv�ZEejjdw�ZFejjdx�ZGejjdy�ZHdzZId{ZJdZKeLejjd|�d}d~��5ZMej�eM�ZOddd�d�d�d�d�d�d�d��d�d�d��d�d�d��d��d�gd��d��d��d�d�d�d�d�d�d��d�d�d��d��d�gd��d��d��d�d�d�d�d�d�d��d�d�d��d�ePeOj���d�d�j�eOj��D��cgc]\}}d�|�d�|d��d����c}}�zd��d�gd��d�d��d��d�d�gd��d��d��d�d�d�d�d�d�d��d�d�d��d�d�d��d��d�d�gd��d��d��d�d�d�d�igd��d��d��d�d�d�d�d�d�d�d��id�gd��d��d��d�d�d�d�d�d�d�d��id�gd��d��d��d�d�d�d�d�d�d�d��id�gd��d��d��d�d�d�d�d�gd��d�d��d�d�d��d�d�d��d�d�d��d�gd��d�d��d�gdâd�d��d�d�d��d�d�d��d�d�d��dÈœ	d�gd��d��d��d�d�d�d�d�gdÌ¢d�d��d�d�d��d�d�d��d�d�d��d�d�d��d�d�d��d�d�d��d�d�d��d�d�d��d�d�d��d�d�d�gd�d��d�d�d��dÛœd�gd��d��d��g
ZSeTej�eS��dzZVd܄ZWy#1swY���xYwcc}}w)��N)�load_dotenvzhttp://localhost:8081z/v1/chat/completionszhttp://localhost:8079z"~/local-ai/ComfyUI/venv/bin/pythonz~/local-ai/ComfyUI�SEARXNG_URLzhttp://127.0.0.1:8080/zhttp://localhost:8188�	CHAT_HOSTz0.0.0.0i��GODADDY_API_KEY��GODADDY_API_SECRET�DDNS_DOMAINzpalashkantikundu.in�DDNS_SUBDOMAIN�home�DDNS_CHECK_INTERVAL�300�
HEARTBEAT_URLz http://10.66.66.1:9863/heartbeat�SHARE_BASE_URL�/i��AUTHENTIK_BASE_URLz$https://home.palashkantikundu.in/sso�AUTH_CLIENT_IDzlocal-ai�AUTH_CLIENT_SECRET�
AUTH_SCOPEzopenid profile email groups�AUTH_AGENTS_CLIENT_ID�AUTH_AGENTS_CLIENT_SECRET�AUTH_AGENTS_APP_SLUG�AUTH_AGENTS_TOKEN_URLz/application/o/token/�AUTH_AGENTS_JWKS_URLz/application/o/z/jwks/�AUTH_AGENTS_ISSUER�admin�premium�free)rrr�CONTEXTS_DIRz~/local-ai-files/contexts�SELF_CHAT_MODE�cpu)r!�gpuT�ip��editor�	moderatorz~/local-ai-files/model.jsonc�n�d}d}	t|dd��5}tj|�}ddd�tt�rkt|j
d�xs|j
d�xsd�j�}t|j
d�xs|�j�}|s8	t|d�5}|j�j�}ddd�|s|}||fS#1swY��xYw#ttjf$rY�ewxYw#1swY�<xYw#ttf$rY�PwxYw)	z�Return the (gpu, cpu) model ids for the given config files.

    ``model_file`` is the JSON config holding per-mode ids; ``legacy_file`` is
    the plain-text single-model file used as a fallback.
    r�r�utf-8��encodingNr"�defaultr!)�open�json�load�
isinstance�dict�str�get�strip�FileNotFoundError�JSONDecodeError�read�OSError)�
model_file�legacy_filer"r!�file�datas      �server/config.py�_load_model_idsr>�s!��
�C�
�C�
�
�*�c�G�
4�	#���9�9�T�?�D�	#��d�D�!��d�h�h�u�o�B����)�)<�B��C�I�I�K�C��d�h�h�u�o�,��-�3�3�5�C��	��k�3�'�
*�4��i�i�k�'�'�)��
*���C���8�O�	#�	#��

�t�3�3�4�
��
��
*�
*��!�7�+�	��	�sR�C7�C+�BC7�0D"�<D�D"�+C4�0C7�7D�D�D�D"�"D4�3D4z~/local-ai-files/model.txtz~/local-ai-files/ComfyUI/outputz~/local-ai-files/uploadsz+~/local-ai/llama.cpp/build/bin/llama-server�LLAMA_SLOT_SAVE_DIRz~/local-ai-files/kv-slots)�exist_ok�0�99z--hostz--port�8081z--models-dirz~/local-ai-files/my-models/z--jinjaz-nglz-fa�onz
--ctx-size�24576z-ctk�q8_0z-ctvz--no-mmproj-offloadz-t�8z-tbz-ub�512z	--timeout�3600z--slot-save-pathz--tempz1.0z--top-pz0.95z--top-k�64z--min-pz0.05�8079z--n-gpu-layers�off�65536�6z--reasoning-budgetz--reasoning-budget-messagez0Reasoning limit reached, summarize final answer.z0.0z--repeat-penaltyz--device�nonez~/local-ai-files�sessionz
sessions.jsonzshares.jsonz~/local-ai-files/ComfyUI/inputz~/local-ai-files/sys_prompt.txtz~/local-ai-files/tasks.dbz~/local-ai-files/themes.dbi�i z~/local-ai-files/models.jsonr(r)r*�function�
web_searchu�Search the web for real-time/current information. Use this for weather, news, sports, stock prices, recent events, or any query where up-to-date data matters. Do NOT answer time-sensitive questions from memory — always search. The results contain snippets only; if the snippets are insufficient to answer the question fully, follow up with fetch_page to read the full content of the relevant page.�object�stringzThe search query)�type�descriptionz�Current date and time. Pass ONLY for time-sensitive queries (news, events, hours, etc.) where recency matters. Omit for direct-link lookups or general information.z�User's location. Pass ONLY for location-specific results (weather, local news, nearby places, events). If you don't know the user's location, call get_user_location first to obtain it. Do NOT guess or fabricate location.)�query�current_time�current_locationrW)rU�
properties�required)�namerV�
parameters)rUrQ�
fetch_pagea�Fetch and read the full text content of a web page. Use this AFTER web_search when the search snippets are not enough to answer the question (e.g. you need details, data, or an article's body). Pass the full URL of the page to read. Long pages are returned one chunk at a time; if the result reports total_chunks greater than 1, call fetch_page again with chunk=2, 3, ... to read the rest. PDFs with no extractable text expose page_images rendered from the scanned pages.zLThe full URL of the web page to fetch (must start with http:// or https://).�integerzJWhich chunk of the page to read (1 = first). Omit to read the first chunk.)�url�chunkr`�generate_imagez9Generate or draw an image. You MUST choose a style model.z5Detailed visual description of what to draw/generate.zThings to avoid in the imagezArt style to use. Options: z, �'z' (rV�))rU�enumrV)�	landscape�portrait�squarez�Image framing/aspect ratio. landscape = wide scene (default), portrait = tall or single-subject close-up, square = balanced illustration.)�prompt�negative_prompt�model�aspect_ratiorirk�
edit_imagezqGeneric Img2Img image editor to modify, restyle, recolor, add elements, or transform existing or uploaded images.z?Complete description of what the edited image should look like.z/Elements to exclude from the visual generation.�numberz�Denoising value (0.1 to 1.0). Use 0.25-0.4 for subtle color/lighting changes, 0.45-0.65 for structural edits and object additions, and 0.7-0.85 for massive re-imaginings.)rirj�denoisero�get_user_locationa	Request the user's current geographical location. Call this ONLY when you need location for a location-specific query (weather, local news, nearby places, etc.) and you don't already have the user's location. Returns the user's city/area or 'denied' if they refuse.�	read_fileaRead the text content of an uploaded file (PDF, DOC, DOCX, XLS, XLSX). Call this when the user has attached a file and you need to read its content to answer their question. The file URL is provided in the user message as [FILE: url]. Pass that url as the file_url parameter.�file_urlz;The file URL from the user message (the /uploads/... path).�
read_imageaView/read an image that was attached or generated earlier in the conversation. The image URL appears in the conversation as [IMAGE: url]. Call this when you actually need to see the image content to answer or describe it accurately. Pass that url as the url parameter.zSThe image URL from the conversation, e.g. /uploads/<file>.jpg or /output/<file>.png�update_user_contextuStore information about the current user that persists across conversations. Saves preferences, personal details, important facts, or anything the user should not need to repeat. This APPENDS to existing context — only add NEW information, do not repeat what was already saved.�contentz_The new information to append to the user's context. Keep it concise and focused on what's new.�manage_tasksz�Manage to-do tasks. Can create, update, complete, delete, list, or get task details. Use this when the user wants to track tasks, set reminders, or manage their to-do list.)�create�update�complete�delete�listr3zThe operation to perform.z5Required for update/complete/delete/get. The task ID.z Required for create. Task title.zTask description or details.)�low�medium�highz Task priority (default: medium).)�pending�in_progress�	completed�	cancelledzFor update: new status.z2Due date in ISO format (e.g. 2026-08-15T17:00:00).zVReminder time in ISO format. The system will notify about this task at the given time.z/Session ID to link this task to a conversation.)	�	operation�task_id�titlerV�priority�status�due_date�reminder_at�
session_idr��track_themea�Dedicated theme/combination tracker that guarantees creative variety across all generated content. It records every already-used combination of task-detail fields + mood + genre + role + persona, both globally (across ALL users) and per-user scope. Call BEFORE agreeing on a creative idea to see what has already been produced (never repeat it), and call again AFTER locking in an idea to log it. Use this INSTEAD of manage_tasks for theme/idea tracking.)r{�logry�check�statsz�Which user scope the theme belongs to (the user whose content is being generated). For the self-chat window always use 'self-chat' so all agents share one history. Optional for list/stats, required for log/check.�booleanzxlist/stats only: include the history across ALL users instead of just scope. Use to keep track of all users at a glance.zSlog only: a short 3-6 word slug of the concrete creative theme/premise/idea chosen.zlog/check only: the task genre.z#log/check only: the mood/tone used.z;log/check only: the relationship dynamic or role pair used.z$log/check only: the persona(s) used.zHlog/check only: the resolved task-detail fields as {field: value} pairs.z<complete only: the id of the theme record to mark completed.�activer�z+log only: initial status (default: active).z8list only: max number of records to return (default 50).)r��scope�global�theme�genre�mood�role�persona�details�theme_idr��limitc	�T�ttd�5}|j�}ddd�djd�tj�D��}j
d|�}|j
dtttj����}|S#1swY�}xYw)Nr(z; c3�6K�|]\}}|�d|d�����y�w)z: rVN�)�.0�k�vs   r=�	<genexpr>z$build_sys_content.<locals>.<genexpr>As%����W�$�!�Q�a�S��1�]�#3�"4�5�W�s�z%model_list%z
%_image_keys%)
r-�PROMPT_PATHr7�join�IMAGE_MODELS�items�replacer2r{�keys)r;�sys_content�
model_lists   r=�build_sys_contentr�>s���	
�k�3�	�"�4��i�i�k��"����W�,�BT�BT�BV�W�W�J��%�%�n�j�A�K��%�%�o�s�4��@Q�@Q�@S�;T�7U�V�K���"�"�s�B�B')Xr.�os�
server.dotenvr�
LLAMA_BASE�	LLAMA_URL�LLAMA_BASE_CPU�
LLAMA_URL_CPU�path�
expanduser�VENV_PYTHON�COMFYUI_DIR�environr3r�COMFYUI_URL�HOST�PORTrrr	r
�intrrr4�rstripr�REASONING_BUDGET�CPU_PARALLEL_SLOTSrrrrrrrrrr�AUTH_ROLE_GROUPSr�lowerr �FORCE_GPU_LANE�VERIFY_RETRIES�VERIFY_FETCH_CHARS�VERIFY_MAX_CITES_PER_URL�TOOL_FREE_AGENTS�MODEL_CONFIG_FILEr>�MODEL_ID�MODEL_ID_CPU�COMFYUI_OUTPUT�UPLOADS_DIR�LLAMA_SERVER_PATHr?�makedirs�LLAMA_QWEN_NGL�LLAMA_GEMMA_NGL�LLAMA_SERVER_ARGSr2�LLAMA_SERVER_ARGS_CPU�	FILES_DIRr��SESSIONS_DIR�
SESSIONS_FILE�SHARES_FILE�IMG_PATH�
COMFYUI_INPUTr��TASKS_DB�	THEMES_DB�IMAGE_TOKEN_COST�AUDIO_TOKEN_COST�PER_MESSAGE_OVERHEADr-r;r/r�r{r�r��TOOLS�len�dumps�TOOLS_TOKEN_COSTr�)r�r�s00r=�<module>r�sL���	�%��
�
$�
��l�.�/�	�)��!�"�"6�7�
��g�g� � �!E�F���g�g� � �!5�6���j�j�n�n�]�,D�E��%��	�z�z�~�~�k�9�-�����*�*�.�.�!2�B�7���Z�Z�^�^�$8�"�=���j�j�n�n�]�,A�B������� 0�&�9���"�*�*�.�.�)>��F�G��
�
�
����0R�S�
������ 0�"�5�;�;�=�D�D�S�I�������Z�Z�^�^�$8�:`�a�h�h�il�m������� 0�*�=���Z�Z�^�^�$8�"�=��
�Z�Z�^�^�L�*G�
H�
�
�
�
���'>��C���J�J�N�N�+F��K���z�z�~�~�&<�>S�T���
�
������/�0����z�z�~�~����/�*>�)?�v�F����Z�Z�^�^����/�*>�)?�q�A���������z�z�~�~�n�b�g�g�.@�.@�A\�.]�^������� 0�%�8�>�>�@�F�F�H����'��N����������k�*���G�G�&�&�'D�E���6)��r�w�w�)�)�*F�G����,����#�#�$E�F���g�g� � �!;�<���G�G�&�&�'T�U�� �j�j�n�n��2�7�7�-�-�.I�J��������$�/�����������������G�G�&�&�'D�E���	���
��
����������
����
����	���� 
�!� �!�"
�#�"�#�$�%�$�%�.�/�.,�/�4
�5�4�5�6�7�6�7�8�9�8�9�:�;�:�;��L!��!��!��!��!��!��G�G�&�&�'D�E�!��	!��!��!�
�!��!��!��!��!�
�!��!� 	�!!� �!!�"
�#!�"�#!�(�)!�(�.�/�)!�*!�+!�*#U�+!�.
�/!�.�/!�0�1!�0�1!�2�3!�2�3!�4�5!�4�5!�6�7!�6�7!�8�9!�8�9!�@�A!�@,�A!��F
�G�G���1�2�	��w�w�|�|�I�y�1�������\�?�;�
��g�g�l�l�9�m�4��
�7�7���?�@�����"�"�#C�D�
��g�g� � �!B�C��
�7�7���9�:���G�G���;�<�	�������	��G�G���5�6��g��#�	��4�9�9�T�?�L�#��$� q�$�*2�CU�!V�19�Kp�)q�5=�Om�-n�#�
")�	���	
�"� �u� �!)�'u��
!*�'s��	�#�G�
�
��,�$�V� �!)�'^��
!)�'E�(�
!)� $�\�%6�%6�%8� 9�'D��)�)�-9�,>�,>�,@��$(�A�q�#$�A�3�c�!�M�*:�);�1� =���(�
�!)� C�(S�%�)�8&�w�/�=�#
�&�P� �O� �!)�'h��
!)�'X�(�
!)�(T� �
�&�y�1�!�
��4�'�g� � ���
����q� �� (�'d�!��(�L�	�

��$� �j� �� (�'|���#�G�	�

��$�)�u� �� (�(I� ��'�K�	�

��$�"�J� �!)� Y�'B�"�!)�'^� �
!)�'I��
!)�'E�$�
!)� 9�'I�!�!)� T�'@��!)�'[�!�
!)�'�$�
!)�'X�#�I(�R)�M�W,�0
�3�j�!�d� �!)� M�'B�"�!)�(~��
!*�(b��
!)�'|��
!)�'H��
!)�'L��
!)�'d��
!)�'M� �
!)�'q� �
!)�'e�!�
!)�!)�;� 7�'T��!*�'a��_3�h)�M�m7�;
�>�sX	��t�z�t�z�z�%�(�)�Q�.���E	#�#��@s�
_	�_ �	_