chainlit 0.7.604rc1__py3-none-any.whl → 0.7.700__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/cache.py CHANGED
@@ -14,11 +14,11 @@ def init_lc_cache():
14
14
  except ImportError:
15
15
  return
16
16
  from langchain.cache import SQLiteCache
17
+ from langchain.globals import set_llm_cache
17
18
 
18
19
  if config.project.lc_cache_path is not None:
19
- langchain.llm_cache = SQLiteCache(
20
- database_path=config.project.lc_cache_path
21
- )
20
+ set_llm_cache(SQLiteCache(database_path=config.project.lc_cache_path))
21
+
22
22
  if not os.path.exists(config.project.lc_cache_path):
23
23
  logger.info(
24
24
  f"LangChain cache created at: {config.project.lc_cache_path}"
chainlit/cli/__init__.py CHANGED
@@ -36,6 +36,16 @@ def cli():
36
36
  def run_chainlit(target: str):
37
37
  host = os.environ.get("CHAINLIT_HOST", DEFAULT_HOST)
38
38
  port = int(os.environ.get("CHAINLIT_PORT", DEFAULT_PORT))
39
+
40
+ ws_per_message_deflate_env = os.environ.get(
41
+ "UVICORN_WS_PER_MESSAGE_DEFLATE", "true"
42
+ )
43
+ ws_per_message_deflate = ws_per_message_deflate_env.lower() in [
44
+ "true",
45
+ "1",
46
+ "yes",
47
+ ] # Convert to boolean
48
+
39
49
  config.run.host = host
40
50
  config.run.port = port
41
51
 
@@ -64,6 +74,7 @@ def run_chainlit(target: str):
64
74
  port=port,
65
75
  log_level=log_level,
66
76
  ws_max_size=max_message_size,
77
+ ws_per_message_deflate=ws_per_message_deflate,
67
78
  )
68
79
  server = uvicorn.Server(config)
69
80
  await server.serve()
chainlit/client/cloud.py CHANGED
@@ -169,6 +169,8 @@ class ChainlitCloudClient(ChainlitGraphQLClient):
169
169
  self.check_for_errors(res, raise_error=True)
170
170
  data = res.get("data")
171
171
  conversation = data.get("conversation") if data else None
172
+ if not conversation:
173
+ return None
172
174
  return (
173
175
  conversation["appUser"].get("username") if conversation["appUser"] else None
174
176
  )
chainlit/config.py CHANGED
@@ -47,6 +47,12 @@ cache = false
47
47
  # Show the prompt playground
48
48
  prompt_playground = true
49
49
 
50
+ # Process and display HTML in messages. This can be a security risk (see https://stackoverflow.com/questions/19603097/why-is-it-dangerous-to-render-user-generated-html-or-javascript)
51
+ unsafe_allow_html = false
52
+
53
+ # Process and display mathematical expressions. This can clash with "$" characters in messages.
54
+ latex = false
55
+
50
56
  # Authorize users to upload files with messages
51
57
  multi_modal = true
52
58
 
@@ -157,6 +163,8 @@ class SpeechToTextFeature:
157
163
  class FeaturesSettings(DataClassJsonMixin):
158
164
  prompt_playground: bool = True
159
165
  multi_modal: bool = True
166
+ latex: bool = False
167
+ unsafe_allow_html: bool = False
160
168
  speech_to_text: Optional[SpeechToTextFeature] = None
161
169
 
162
170
 
@@ -261,7 +269,7 @@ def load_module(target: str, force_refresh: bool = False):
261
269
  and module.__file__
262
270
  and module.__file__.startswith(target_dir)
263
271
  ):
264
- del sys.modules[module_name]
272
+ sys.modules.pop(module_name, None)
265
273
 
266
274
  spec = util.spec_from_file_location(target, target)
267
275
  if not spec or not spec.loader: