chainlit 1.2.0__tar.gz → 1.3.0__tar.gz

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.

Files changed (111) hide show
  1. {chainlit-1.2.0 → chainlit-1.3.0}/PKG-INFO +24 -16
  2. {chainlit-1.2.0 → chainlit-1.3.0}/README.md +11 -11
  3. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/auth.py +9 -7
  4. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/cli/__init__.py +3 -1
  5. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/context.py +4 -6
  6. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/copilot/dist/index.js +252 -261
  7. chainlit-1.3.0/chainlit/data/__init__.py +25 -0
  8. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/data/dynamodb.py +10 -6
  9. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/data/literalai.py +168 -59
  10. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/data/sql_alchemy.py +91 -16
  11. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/element.py +3 -2
  12. chainlit-1.3.0/chainlit/frontend/dist/assets/DailyMotion-CwoOhIL8.js +1 -0
  13. chainlit-1.3.0/chainlit/frontend/dist/assets/Facebook-BhnGXlzq.js +1 -0
  14. chainlit-1.3.0/chainlit/frontend/dist/assets/FilePlayer-CPSVT6fz.js +1 -0
  15. chainlit-1.3.0/chainlit/frontend/dist/assets/Kaltura-COYaLzsL.js +1 -0
  16. chainlit-1.3.0/chainlit/frontend/dist/assets/Mixcloud-JdadNiQ5.js +1 -0
  17. chainlit-1.3.0/chainlit/frontend/dist/assets/Mux-CBN7RO2u.js +1 -0
  18. chainlit-1.3.0/chainlit/frontend/dist/assets/Preview-CxAFvvjV.js +1 -0
  19. chainlit-1.3.0/chainlit/frontend/dist/assets/SoundCloud-JlgmASWm.js +1 -0
  20. chainlit-1.3.0/chainlit/frontend/dist/assets/Streamable-CUWgr6Zw.js +1 -0
  21. chainlit-1.3.0/chainlit/frontend/dist/assets/Twitch-BiN1HEDM.js +1 -0
  22. chainlit-1.3.0/chainlit/frontend/dist/assets/Vidyard-qhPmrhDm.js +1 -0
  23. chainlit-1.3.0/chainlit/frontend/dist/assets/Vimeo-CrZVSCaT.js +1 -0
  24. chainlit-1.3.0/chainlit/frontend/dist/assets/Wistia-C891KrBP.js +1 -0
  25. chainlit-1.3.0/chainlit/frontend/dist/assets/YouTube-DKjw5Hbn.js +1 -0
  26. chainlit-1.3.0/chainlit/frontend/dist/assets/index-DLRdQOIx.js +723 -0
  27. chainlit-1.2.0/chainlit/frontend/dist/assets/react-plotly-f52a41eb.js → chainlit-1.3.0/chainlit/frontend/dist/assets/react-plotly-Dpmqg5Sy.js +94 -94
  28. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/frontend/dist/index.html +2 -3
  29. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/haystack/callbacks.py +1 -3
  30. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/langchain/callbacks.py +1 -2
  31. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/message.py +1 -1
  32. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/mistralai/__init__.py +0 -1
  33. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/oauth_providers.py +46 -3
  34. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/openai/__init__.py +3 -5
  35. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/server.py +19 -9
  36. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/session.py +8 -19
  37. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/socket.py +3 -3
  38. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/step.py +13 -20
  39. {chainlit-1.2.0 → chainlit-1.3.0}/pyproject.toml +25 -5
  40. chainlit-1.2.0/chainlit/data/__init__.py +0 -20
  41. chainlit-1.2.0/chainlit/frontend/dist/assets/DailyMotion-05f4fe48.js +0 -1
  42. chainlit-1.2.0/chainlit/frontend/dist/assets/Facebook-f25411d1.js +0 -1
  43. chainlit-1.2.0/chainlit/frontend/dist/assets/FilePlayer-40ff3414.js +0 -1
  44. chainlit-1.2.0/chainlit/frontend/dist/assets/Kaltura-6cbf3897.js +0 -1
  45. chainlit-1.2.0/chainlit/frontend/dist/assets/Mixcloud-34e7c912.js +0 -1
  46. chainlit-1.2.0/chainlit/frontend/dist/assets/Mux-8aaff6ac.js +0 -1
  47. chainlit-1.2.0/chainlit/frontend/dist/assets/Preview-2d3bf558.js +0 -1
  48. chainlit-1.2.0/chainlit/frontend/dist/assets/SoundCloud-b835f90f.js +0 -1
  49. chainlit-1.2.0/chainlit/frontend/dist/assets/Streamable-1293e4f3.js +0 -1
  50. chainlit-1.2.0/chainlit/frontend/dist/assets/Twitch-c69660cd.js +0 -1
  51. chainlit-1.2.0/chainlit/frontend/dist/assets/Vidyard-43bda599.js +0 -1
  52. chainlit-1.2.0/chainlit/frontend/dist/assets/Vimeo-54150039.js +0 -1
  53. chainlit-1.2.0/chainlit/frontend/dist/assets/Wistia-aa3c721b.js +0 -1
  54. chainlit-1.2.0/chainlit/frontend/dist/assets/YouTube-dd0f3cc2.js +0 -1
  55. chainlit-1.2.0/chainlit/frontend/dist/assets/index-cf48bedd.js +0 -729
  56. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/__init__.py +0 -0
  57. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/__main__.py +0 -0
  58. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/_utils.py +0 -0
  59. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/action.py +0 -0
  60. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/cache.py +0 -0
  61. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/callbacks.py +0 -0
  62. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/chat_context.py +0 -0
  63. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/chat_settings.py +0 -0
  64. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/config.py +0 -0
  65. /chainlit-1.2.0/chainlit/copilot/dist/assets/logo_dark-2a3cf740.svg → /chainlit-1.3.0/chainlit/copilot/dist/assets/logo_dark-IkGJ_IwC.svg +0 -0
  66. /chainlit-1.2.0/chainlit/copilot/dist/assets/logo_light-b078e7bc.svg → /chainlit-1.3.0/chainlit/copilot/dist/assets/logo_light-Bb_IPh6r.svg +0 -0
  67. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/data/acl.py +0 -0
  68. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/data/base.py +0 -0
  69. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/data/storage_clients.py +0 -0
  70. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/data/utils.py +0 -0
  71. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/discord/__init__.py +0 -0
  72. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/discord/app.py +0 -0
  73. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/emitter.py +0 -0
  74. /chainlit-1.2.0/chainlit/frontend/dist/assets/index-aaf974a9.css → /chainlit-1.3.0/chainlit/frontend/dist/assets/index-CwmincdQ.css +0 -0
  75. /chainlit-1.2.0/chainlit/frontend/dist/assets/logo_dark-2a3cf740.svg → /chainlit-1.3.0/chainlit/frontend/dist/assets/logo_dark-IkGJ_IwC.svg +0 -0
  76. /chainlit-1.2.0/chainlit/frontend/dist/assets/logo_light-b078e7bc.svg → /chainlit-1.3.0/chainlit/frontend/dist/assets/logo_light-Bb_IPh6r.svg +0 -0
  77. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/frontend/dist/favicon.svg +0 -0
  78. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/haystack/__init__.py +0 -0
  79. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/hello.py +0 -0
  80. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/input_widget.py +0 -0
  81. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/langchain/__init__.py +0 -0
  82. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/langflow/__init__.py +0 -0
  83. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/llama_index/__init__.py +0 -0
  84. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/llama_index/callbacks.py +0 -0
  85. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/logger.py +0 -0
  86. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/markdown.py +0 -0
  87. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/py.typed +0 -0
  88. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/secret.py +0 -0
  89. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/slack/__init__.py +0 -0
  90. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/slack/app.py +0 -0
  91. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/sync.py +0 -0
  92. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/teams/__init__.py +0 -0
  93. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/teams/app.py +0 -0
  94. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/telemetry.py +0 -0
  95. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/bn.json +0 -0
  96. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/en-US.json +0 -0
  97. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/gu.json +0 -0
  98. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/he-IL.json +0 -0
  99. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/hi.json +0 -0
  100. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/kn.json +0 -0
  101. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/ml.json +0 -0
  102. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/mr.json +0 -0
  103. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/ta.json +0 -0
  104. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/te.json +0 -0
  105. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/zh-CN.json +0 -0
  106. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations.py +0 -0
  107. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/types.py +0 -0
  108. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/user.py +0 -0
  109. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/user_session.py +0 -0
  110. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/utils.py +0 -0
  111. {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/version.py +0 -0
@@ -1,18 +1,25 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chainlit
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: Build Conversational AI.
5
- Home-page: https://github.com/Chainlit/chainlit
6
- License: Apache-2.0 license
5
+ Home-page: https://chainlit.io/
6
+ License: Apache-2.0
7
7
  Keywords: LLM,Agents,gen ai,chat ui,chatbot ui,openai,copilot,langchain,conversational ai
8
- Author: Chainlit
8
+ Author: Willy Douhard
9
9
  Requires-Python: >=3.9,<4.0.0
10
+ Classifier: Environment :: Web Environment
11
+ Classifier: Framework :: FastAPI
10
12
  Classifier: License :: Other/Proprietary License
13
+ Classifier: Programming Language :: JavaScript
11
14
  Classifier: Programming Language :: Python :: 3
12
15
  Classifier: Programming Language :: Python :: 3.9
13
16
  Classifier: Programming Language :: Python :: 3.10
14
17
  Classifier: Programming Language :: Python :: 3.11
15
18
  Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Communications :: Chat
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Topic :: Software Development :: User Interfaces
16
23
  Requires-Dist: aiofiles (>=23.1.0,<24.0.0)
17
24
  Requires-Dist: asyncer (>=0.0.7,<0.0.8)
18
25
  Requires-Dist: click (>=8.1.3,<9.0.0)
@@ -21,7 +28,7 @@ Requires-Dist: fastapi (>=0.110.1,<0.113)
21
28
  Requires-Dist: filetype (>=1.2.0,<2.0.0)
22
29
  Requires-Dist: httpx (>=0.23.0)
23
30
  Requires-Dist: lazify (>=0.4.0,<0.5.0)
24
- Requires-Dist: literalai (==0.0.607)
31
+ Requires-Dist: literalai (==0.0.623)
25
32
  Requires-Dist: nest-asyncio (>=1.6.0,<2.0.0)
26
33
  Requires-Dist: numpy (>=1.26,<2.0)
27
34
  Requires-Dist: packaging (>=23.1,<24.0)
@@ -36,6 +43,7 @@ Requires-Dist: tomli (>=2.0.1,<3.0.0)
36
43
  Requires-Dist: uptrace (>=1.22.0,<2.0.0)
37
44
  Requires-Dist: uvicorn (>=0.25.0,<0.26.0)
38
45
  Requires-Dist: watchfiles (>=0.20.0,<0.21.0)
46
+ Project-URL: Documentation, https://docs.chainlit.io/
39
47
  Project-URL: Repository, https://github.com/Chainlit/chainlit
40
48
  Description-Content-Type: text/markdown
41
49
 
@@ -60,20 +68,21 @@ Chainlit is an open-source async Python framework which allows developers to bui
60
68
  Full documentation is available [here](https://docs.chainlit.io). You can ask Chainlit related questions to [Chainlit Help](https://help.chainlit.io/), an app built using Chainlit!
61
69
 
62
70
  > [!NOTE]
63
- > Contact us [here](https://forms.gle/BX3UNBLmTF75KgZVA) for **Enterprise Support**.
64
71
  > Check out [Literal AI](https://literalai.com), our product to monitor and evaluate LLM applications! It works with any Python or TypeScript applications and [seamlessly](https://docs.chainlit.io/data-persistence/overview) with Chainlit by adding a `LITERAL_API_KEY` in your project.
72
+ >
73
+ > Chainlit is developed and maintained by the Literal AI team, which is currently focused on expanding the capabilities of Literal AI. While we continue to support and maintain Chainlit, we are also committed to enabling the community to contribute, particularly in areas like integrations and data layers.
65
74
 
66
75
  <p align="center">
67
- <img src="https://github.com/Chainlit/chainlit/assets/13104895/0c2cc7a9-766c-41d3-aae2-117a2d0eb8ed" width="80%" />
76
+ <img src="https://github.com/Chainlit/chainlit/assets/13104895/0c2cc7a9-766c-41d3-aae2-117a2d0eb8ed" alt="Chainlit user interface" width="80%"></img>
68
77
  </p>
69
78
 
70
79
  ## Installation
71
80
 
72
81
  Open a terminal and run:
73
82
 
74
- ```bash
75
- $ pip install chainlit
76
- $ chainlit hello
83
+ ```sh
84
+ pip install chainlit
85
+ chainlit hello
77
86
  ```
78
87
 
79
88
  If this opens the `hello app` in your browser, you're all set!
@@ -108,18 +117,17 @@ async def main(message: cl.Message):
108
117
  None.
109
118
  """
110
119
 
111
- final_answer = await cl.Message(content="").send()
112
120
 
113
121
  # Call the tool
114
- final_answer.content = await tool()
122
+ tool_res = await tool()
115
123
 
116
- await final_answer.update()
124
+ await cl.Message(content=tool_res).send()
117
125
  ```
118
126
 
119
127
  Now run it!
120
128
 
121
- ```
122
- $ chainlit run demo.py -w
129
+ ```sh
130
+ chainlit run demo.py -w
123
131
  ```
124
132
 
125
133
  <img src="/images/quick-start.png" alt="Quick Start"></img>
@@ -129,7 +137,7 @@ $ chainlit run demo.py -w
129
137
  Full documentation is available [here](https://docs.chainlit.io). Key features:
130
138
 
131
139
  - [💬 Multi Modal chats](https://docs.chainlit.io/advanced-features/multi-modal)
132
- - [💭 Chain of Thought visualisation](https://docs.chainlit.io/concepts/step)
140
+ - [💭 Chain of Thought visualization](https://docs.chainlit.io/concepts/step)
133
141
  - [💾 Data persistence + human feedback](https://docs.chainlit.io/data-persistence/overview)
134
142
  - [🐛 Debug Mode](https://docs.chainlit.io/data-persistence/enterprise#debug-mode)
135
143
  - [👤 Authentication](https://docs.chainlit.io/authentication/overview)
@@ -19,20 +19,21 @@ Chainlit is an open-source async Python framework which allows developers to bui
19
19
  Full documentation is available [here](https://docs.chainlit.io). You can ask Chainlit related questions to [Chainlit Help](https://help.chainlit.io/), an app built using Chainlit!
20
20
 
21
21
  > [!NOTE]
22
- > Contact us [here](https://forms.gle/BX3UNBLmTF75KgZVA) for **Enterprise Support**.
23
22
  > Check out [Literal AI](https://literalai.com), our product to monitor and evaluate LLM applications! It works with any Python or TypeScript applications and [seamlessly](https://docs.chainlit.io/data-persistence/overview) with Chainlit by adding a `LITERAL_API_KEY` in your project.
23
+ >
24
+ > Chainlit is developed and maintained by the Literal AI team, which is currently focused on expanding the capabilities of Literal AI. While we continue to support and maintain Chainlit, we are also committed to enabling the community to contribute, particularly in areas like integrations and data layers.
24
25
 
25
26
  <p align="center">
26
- <img src="https://github.com/Chainlit/chainlit/assets/13104895/0c2cc7a9-766c-41d3-aae2-117a2d0eb8ed" width="80%" />
27
+ <img src="https://github.com/Chainlit/chainlit/assets/13104895/0c2cc7a9-766c-41d3-aae2-117a2d0eb8ed" alt="Chainlit user interface" width="80%"></img>
27
28
  </p>
28
29
 
29
30
  ## Installation
30
31
 
31
32
  Open a terminal and run:
32
33
 
33
- ```bash
34
- $ pip install chainlit
35
- $ chainlit hello
34
+ ```sh
35
+ pip install chainlit
36
+ chainlit hello
36
37
  ```
37
38
 
38
39
  If this opens the `hello app` in your browser, you're all set!
@@ -67,18 +68,17 @@ async def main(message: cl.Message):
67
68
  None.
68
69
  """
69
70
 
70
- final_answer = await cl.Message(content="").send()
71
71
 
72
72
  # Call the tool
73
- final_answer.content = await tool()
73
+ tool_res = await tool()
74
74
 
75
- await final_answer.update()
75
+ await cl.Message(content=tool_res).send()
76
76
  ```
77
77
 
78
78
  Now run it!
79
79
 
80
- ```
81
- $ chainlit run demo.py -w
80
+ ```sh
81
+ chainlit run demo.py -w
82
82
  ```
83
83
 
84
84
  <img src="/images/quick-start.png" alt="Quick Start"></img>
@@ -88,7 +88,7 @@ $ chainlit run demo.py -w
88
88
  Full documentation is available [here](https://docs.chainlit.io). Key features:
89
89
 
90
90
  - [💬 Multi Modal chats](https://docs.chainlit.io/advanced-features/multi-modal)
91
- - [💭 Chain of Thought visualisation](https://docs.chainlit.io/concepts/step)
91
+ - [💭 Chain of Thought visualization](https://docs.chainlit.io/concepts/step)
92
92
  - [💾 Data persistence + human feedback](https://docs.chainlit.io/data-persistence/overview)
93
93
  - [🐛 Debug Mode](https://docs.chainlit.io/data-persistence/enterprise#debug-mode)
94
94
  - [👤 Authentication](https://docs.chainlit.io/authentication/overview)
@@ -42,14 +42,14 @@ def get_configuration():
42
42
  "requireLogin": require_login(),
43
43
  "passwordAuth": config.code.password_auth_callback is not None,
44
44
  "headerAuth": config.code.header_auth_callback is not None,
45
- "oauthProviders": get_configured_oauth_providers()
46
- if is_oauth_enabled()
47
- else [],
45
+ "oauthProviders": (
46
+ get_configured_oauth_providers() if is_oauth_enabled() else []
47
+ ),
48
48
  }
49
49
 
50
50
 
51
51
  def create_jwt(data: User) -> str:
52
- to_encode = data.to_dict() # type: Dict[str, Any]
52
+ to_encode: Dict[str, Any] = data.to_dict()
53
53
  to_encode.update(
54
54
  {
55
55
  "exp": datetime.utcnow() + timedelta(minutes=60 * 24 * 15), # 15 days
@@ -69,16 +69,18 @@ async def authenticate_user(token: str = Depends(reuseable_oauth)):
69
69
  )
70
70
  del dict["exp"]
71
71
  user = User(**dict)
72
- except Exception as e:
72
+ except Exception:
73
73
  raise HTTPException(status_code=401, detail="Invalid authentication token")
74
74
  if data_layer := get_data_layer():
75
75
  try:
76
76
  persisted_user = await data_layer.get_user(user.identifier)
77
- if persisted_user == None:
77
+ if persisted_user is None:
78
78
  persisted_user = await data_layer.create_user(user)
79
- except Exception as e:
79
+ except Exception:
80
80
  return user
81
81
 
82
+ if user and user.display_name:
83
+ persisted_user.display_name = user.display_name
82
84
  return persisted_user
83
85
  else:
84
86
  return user
@@ -5,8 +5,10 @@ import click
5
5
  import nest_asyncio
6
6
  import uvicorn
7
7
 
8
+ # Not sure if it is necessary to call nest_asyncio.apply() before the other imports
8
9
  nest_asyncio.apply()
9
10
 
11
+ # ruff: noqa: E402
10
12
  from chainlit.cache import init_lc_cache
11
13
  from chainlit.config import (
12
14
  BACKEND_ROOT,
@@ -183,7 +185,7 @@ def chainlit_run(
183
185
  no_cache = True
184
186
  # This is required to have OpenAI LLM providers available for the CI run
185
187
  os.environ["OPENAI_API_KEY"] = "sk-FAKE-OPENAI-API-KEY"
186
- # This is required for authenticationt tests
188
+ # This is required for authentication tests
187
189
  os.environ["CHAINLIT_AUTH_SECRET"] = "SUPER_SECRET"
188
190
  else:
189
191
  trace_event("chainlit run")
@@ -23,18 +23,17 @@ class ChainlitContext:
23
23
  loop: asyncio.AbstractEventLoop
24
24
  emitter: "BaseChainlitEmitter"
25
25
  session: Union["HTTPSession", "WebsocketSession"]
26
- active_steps: List["Step"]
27
26
 
28
27
  @property
29
28
  def current_step(self):
30
- if self.active_steps:
31
- return self.active_steps[-1]
29
+ if previous_steps := local_steps.get():
30
+ return previous_steps[-1]
32
31
 
33
32
  @property
34
33
  def current_run(self):
35
- if self.active_steps:
34
+ if previous_steps := local_steps.get():
36
35
  return next(
37
- (step for step in self.active_steps if step.name in CL_RUN_NAMES), None
36
+ (step for step in previous_steps if step.name in CL_RUN_NAMES), None
38
37
  )
39
38
 
40
39
  def __init__(
@@ -46,7 +45,6 @@ class ChainlitContext:
46
45
 
47
46
  self.loop = asyncio.get_running_loop()
48
47
  self.session = session
49
- self.active_steps = []
50
48
 
51
49
  if emitter:
52
50
  self.emitter = emitter