CoolFace
Apppublic

cathub/LocalChatGPT

sourceHugging Facegpl-3.0updated 3y agoView on Hugging Face
0likes
overwrites.cpython-39.pyc33 linesDownload Raw Back to __pycache__
1a

2o~d��	@s�ddlmZddlZddlmZddlmZmZddlZddl	Tddl3Tdddd�d	d4�Zddd�d
d�Ze
dddd��NZe
dddd�� Ze��Ze��ZWd�n1s�0YWd�n1s�0Ydd�ZejjjZdS)�)�annotationsN)�Prompt)�List�Tuple)�*rz	List[str])�prompt�text_chunks�returncCsNt�d�dd�|D�}dd�t|�D�}d�|�}|j|ddd�}|�|�S)Nu%Compacting text chunks...🚀🚀🚀cSsg|]}|��r|���qS�)�strip)�.0�cr5r6�K/Users/treediagram/Documents/Developer/ChuanhuChatGPT/modules/overwrites.py�7<listcomp>�z'compact_text_chunks.<locals>.<listcomp>cSs$g|]\}}d|d�d|���qS)�[�z] r8)r�indexr
r9r10rrrz11 12r)�padding)�logging�debug�	enumerate�joinZget_text_splitter_given_promptZ13split_text)�selfrrZcombined_strZ
text_splitterr14r15r�compact_text_chunkss1617rz#List[Tuple[str | None, str | None]])�yr	cCsP|dus|gkrgS|d\}}t|�s0t|�}t|�s@t|�}||f|d<|S)a*18    Parameters:19        y: List of tuples representing the message and response pairs. Each message and response should be a string, which may be in Markdown format.20    Returns:21        List of tuples representing the message and response. Each message and response will be a string of HTML.22    N�����)�detect_converted_mark�convert_asis�convert_mdtext)rr�user�botr23r24r�postprocesss	r"z./assets/custom.js�rzutf-8)�encodingz./assets/Kelpy-Codos.jscs4td�dt�dt�d���fdd�}|tjj_dS)NzReloading javascript...z<script>z</script><script>z	</script>cs6t|i|��}|j�d��d��d��|_|��|S)Ns</html>z</html>�utf8)�GradioTemplateResponseOriginal�body�replace�encode�init_headers)�args�kwargs�res��jsr25r�template_response0sz,reload_javascript.<locals>.template_response)�print�customJS�26kelpyCodos�gr�routes�	templates�TemplateResponse)r0r27r.r�reload_javascript-sr8)�28__future__rrZllama_indexr�typingrr�29mdtex2html�modules.presetsZmodules.llama_funcrr"�open�f�f2�readr2r3r8r4r5r6r7r&r30r31r32r�<module>s33 D