Skip to content

Commit 54d809e

Browse files
authored
Willy/starter command (#2027)
* fix: start should support button commands * chore: bump version * fix: make http session.delete async
1 parent d50282d commit 54d809e

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

backend/chainlit/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def __init__(
187187
http_cookie=http_cookie,
188188
)
189189

190-
def delete(self):
190+
async def delete(self):
191191
"""Delete the session."""
192192
if self.files_dir.is_dir():
193193
shutil.rmtree(self.files_dir)

backend/chainlit/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
except metadata.PackageNotFoundError:
66
# Case where package metadata is not available, default to a 'non-outdated' version.
77
# Ref: config.py::load_settings()
8-
__version__ = "2.4.2"
8+
__version__ = "2.4.201"

backend/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "chainlit"
3-
version = "2.4.2"
3+
version = "2.4.201"
44
keywords = [
55
'LLM',
66
'Agents',

frontend/src/components/chat/ScrollContainer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ export default function ScrollContainer({
7474
useEffect(() => {
7575
if (!ref.current) return;
7676

77-
if(messages.length === 0 && spacerRef.current) {
77+
if (messages.length === 0 && spacerRef.current) {
7878
spacerRef.current.style.height = `0px`;
79-
return
79+
return;
8080
}
8181

8282
// Get all message elements

frontend/src/components/chat/Starter.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useCallback, useContext } from 'react';
2+
import { useRecoilValue } from 'recoil';
23
import { v4 as uuidv4 } from 'uuid';
34

45
import {
@@ -12,12 +13,15 @@ import {
1213

1314
import { Button } from '@/components/ui/button';
1415

16+
import { persistentCommandState } from '@/state/chat';
17+
1518
interface StarterProps {
1619
starter: IStarter;
1720
}
1821

1922
export default function Starter({ starter }: StarterProps) {
2023
const apiClient = useContext(ChainlitContext);
24+
const selectedCommand = useRecoilValue(persistentCommandState);
2125
const { sendMessage } = useChatInteract();
2226
const { loading, connected } = useChatData();
2327
const { user } = useAuth();
@@ -28,6 +32,7 @@ export default function Starter({ starter }: StarterProps) {
2832
const message: IStep = {
2933
threadId: '',
3034
id: uuidv4(),
35+
command: selectedCommand?.id,
3136
name: user?.identifier || 'User',
3237
type: 'user_message',
3338
output: starter.message,
@@ -36,7 +41,7 @@ export default function Starter({ starter }: StarterProps) {
3641
};
3742

3843
sendMessage(message, []);
39-
}, [user, sendMessage, starter]);
44+
}, [user, selectedCommand, sendMessage, starter]);
4045

4146
return (
4247
<Button

0 commit comments

Comments
 (0)