chainlit 1.0.504__py3-none-any.whl → 1.0.506__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of chainlit might be problematic. Click here for more details.
- chainlit/config.py +7 -3
- chainlit/copilot/dist/index.js +262 -262
- chainlit/data/__init__.py +36 -8
- chainlit/data/sql_alchemy.py +246 -144
- chainlit/emitter.py +19 -9
- chainlit/frontend/dist/assets/{index-a8e1b559.js → index-d4233b49.js} +119 -119
- chainlit/frontend/dist/assets/{react-plotly-b225b63c.js → react-plotly-2b7fa4f9.js} +1 -1
- chainlit/frontend/dist/index.html +1 -1
- chainlit/input_widget.py +2 -0
- chainlit/llama_index/callbacks.py +2 -3
- chainlit/openai/__init__.py +5 -9
- chainlit/server.py +0 -3
- chainlit/session.py +4 -0
- chainlit/socket.py +5 -1
- chainlit/types.py +19 -1
- chainlit/user_session.py +1 -0
- {chainlit-1.0.504.dist-info → chainlit-1.0.506.dist-info}/METADATA +2 -2
- {chainlit-1.0.504.dist-info → chainlit-1.0.506.dist-info}/RECORD +20 -20
- {chainlit-1.0.504.dist-info → chainlit-1.0.506.dist-info}/WHEEL +0 -0
- {chainlit-1.0.504.dist-info → chainlit-1.0.506.dist-info}/entry_points.txt +0 -0
chainlit/emitter.py
CHANGED
|
@@ -2,6 +2,7 @@ import asyncio
|
|
|
2
2
|
import uuid
|
|
3
3
|
from typing import Any, Dict, List, Literal, Optional, Union, cast
|
|
4
4
|
|
|
5
|
+
from chainlit.config import config
|
|
5
6
|
from chainlit.data import get_data_layer
|
|
6
7
|
from chainlit.element import Element, File
|
|
7
8
|
from chainlit.logger import logger
|
|
@@ -175,22 +176,31 @@ class ChainlitEmitter(BaseChainlitEmitter):
|
|
|
175
176
|
else:
|
|
176
177
|
user_id = None
|
|
177
178
|
try:
|
|
178
|
-
|
|
179
|
-
|
|
179
|
+
should_tag_thread = (
|
|
180
|
+
self.session.chat_profile and config.features.auto_tag_thread
|
|
181
|
+
)
|
|
182
|
+
tags = [self.session.chat_profile] if should_tag_thread else None
|
|
183
|
+
asyncio.create_task(
|
|
184
|
+
data_layer.update_thread(
|
|
185
|
+
thread_id=self.session.thread_id,
|
|
186
|
+
name=interaction,
|
|
187
|
+
user_id=user_id,
|
|
188
|
+
tags=tags,
|
|
189
|
+
)
|
|
180
190
|
)
|
|
181
|
-
asyncio.create_task(data_layer.update_thread(
|
|
182
|
-
thread_id=self.session.thread_id,
|
|
183
|
-
name=interaction,
|
|
184
|
-
user_id=user_id,
|
|
185
|
-
tags=tags,
|
|
186
|
-
))
|
|
187
191
|
except Exception as e:
|
|
188
192
|
logger.error(f"Error updating thread: {e}")
|
|
189
193
|
asyncio.create_task(self.session.flush_method_queue())
|
|
190
194
|
|
|
191
195
|
async def init_thread(self, interaction: str):
|
|
192
196
|
await self.flush_thread_queues(interaction)
|
|
193
|
-
await self.emit(
|
|
197
|
+
await self.emit(
|
|
198
|
+
"first_interaction",
|
|
199
|
+
{
|
|
200
|
+
"interaction": interaction,
|
|
201
|
+
"thread_id": self.session.thread_id,
|
|
202
|
+
},
|
|
203
|
+
)
|
|
194
204
|
|
|
195
205
|
async def process_user_message(self, payload: UIMessagePayload):
|
|
196
206
|
step_dict = payload["message"]
|