Skip to content

Commit

Permalink
prepare release (Chainlit#1081)
Browse files Browse the repository at this point in the history
* prepare release
  • Loading branch information
willydouhard authored Jun 17, 2024
1 parent 69668f2 commit b32c872
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 54 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

Nothing unreleased.

## [1.1.302] - 2024-06-16

### Added

- Width and height option for the copilot bubble

### Fixed

- Chat profile icon in copilot should load

### Removed

- Running toast when an action is running

## [1.1.301] - 2024-06-14

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Full documentation is available [here](https://docs.chainlit.io). Key features:
- [💬 Multi Modal chats](https://docs.chainlit.io/advanced-features/multi-modal)
- [💭 Chain of Thought visualisation](https://docs.chainlit.io/concepts/step)
- [💾 Data persistence + human feedback](https://docs.chainlit.io/data-persistence/overview)
- [🛝 In context Prompt Playground](https://docs.chainlit.io/advanced-features/prompt-playground/overview)
- [🐛 Debug Mode](https://docs.chainlit.io/data-persistence/enterprise#debug-mode)
- [👤 Authentication](https://docs.chainlit.io/authentication/overview)

Chainlit is compatible with all Python programs and libraries. That being said, it comes with integrations for:
Expand Down
2 changes: 1 addition & 1 deletion backend/chainlit/langchain/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ def _start_trace(self, run: Run) -> None:
elif run.run_type == "embedding":
step_type = "embedding"

if not self.steps:
if not self.steps and step_type != "llm":
step_type = "run"

disable_feedback = not self._is_annotable(run)
Expand Down
1 change: 0 additions & 1 deletion backend/chainlit/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
AudioChunkPayload,
AudioEndPayload,
MessagePayload,
SystemMessagePayload,
)
from chainlit.user_session import user_sessions

Expand Down
5 changes: 0 additions & 5 deletions backend/chainlit/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@ class MessagePayload(TypedDict):
fileReferences: Optional[List[FileReference]]


class SystemMessagePayload(TypedDict):
content: str
metadata: Optional[Dict[str, Any]]


class AudioChunkPayload(TypedDict):
isStart: bool
mimeType: str
Expand Down
5 changes: 3 additions & 2 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "chainlit"
version = "1.1.301"
version = "1.1.302"
keywords = [
'LLM',
'Agents',
Expand Down Expand Up @@ -60,7 +60,8 @@ optional = true
[tool.poetry.group.tests.dependencies]
openai = "^1.11.1"
langchain = "^0.1.5"
llama-index = "^0.10.15"
llama-index = "^0.10.45"
tenacity = "8.3.0" # pin until fixed https://github.com/langchain-ai/langchain/issues/22972
transformers = "^4.30.1"
matplotlib = "3.7.1"
farm-haystack = "^1.18.0"
Expand Down
16 changes: 14 additions & 2 deletions frontend/src/components/molecules/messages/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { MessageContext } from 'contexts/MessageContext';
import { memo, useContext } from 'react';

import Box from '@mui/material/Box';
import Skeleton from '@mui/material/Skeleton';
import Stack from '@mui/material/Stack';

import { AskUploadButton } from './components/AskUploadButton';
Expand Down Expand Up @@ -96,9 +97,20 @@ const Message = memo(
/>
</Box>
{forceDisplayCursor && (
<Box mt={1}>
<Stack
direction="row"
gap="1rem"
alignItems="center"
my={0.5}
width="100%"
>
<Skeleton
variant="circular"
width="1.6rem"
height="1.6rem"
/>
<BlinkingCursor />
</Box>
</Stack>
)}
</Box>
) : (
Expand Down
21 changes: 1 addition & 20 deletions libs/copilot/src/chat/messages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,7 @@ const Messages = (): JSX.Element => {

const callActionWithToast = useCallback(
(action: IAction) => {
const promise = callAction(action);
if (promise) {
toast.promise(promise, {
loading: `Running ${action.name}`,
success: (res) => {
if (res.response) {
return res.response;
} else {
return `${action.name} executed successfully`;
}
},
error: (res) => {
if (res.response) {
return res.response;
} else {
return `${action.name} failed`;
}
}
});
}
callAction(action);
},
[callAction]
);
Expand Down
41 changes: 24 additions & 17 deletions libs/copilot/src/components/ChatProfiles.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import size from 'lodash/size';
import { useState } from 'react';
import { useContext, useState } from 'react';

import { SelectInput } from '@chainlit/app/src/components/atoms/inputs';
import NewChatDialog from '@chainlit/app/src/components/molecules/newChatDialog';
import {
ChainlitContext,
useChatInteract,
useChatMessages,
useChatSession,
useConfig
} from '@chainlit/react-client';

export default function ChatProfiles() {
const apiClient = useContext(ChainlitContext);
const { config } = useConfig();
const { chatProfile, setChatProfile } = useChatSession();
const { firstInteraction } = useChatMessages();
Expand Down Expand Up @@ -43,22 +45,27 @@ export default function ChatProfiles() {
return null;
}

const items = config.chatProfiles.map((item) => ({
label: item.name,
value: item.name,
icon: item.icon ? (
<img
src={item.icon}
className="chat-profile-icon"
style={{
width: '24px',
height: '24px',
borderRadius: '50%',
objectFit: 'cover'
}}
/>
) : undefined
}));
const items = config.chatProfiles.map((item) => {
const icon = item.icon?.includes('/public')
? apiClient.buildEndpoint(item.icon)
: item.icon;
return {
label: item.name,
value: item.name,
icon: icon ? (
<img
src={icon}
className="chat-profile-icon"
style={{
width: '24px',
height: '24px',
borderRadius: '50%',
objectFit: 'cover'
}}
/>
) : undefined
};
});

return (
<>
Expand Down
5 changes: 3 additions & 2 deletions libs/copilot/src/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import Header from 'components/Header';

interface Props {
anchorEl?: HTMLElement | null;
buttonHeight: string;
}

export default function PopOver({ anchorEl }: Props) {
export default function PopOver({ anchorEl, buttonHeight }: Props) {
const [expanded, setExpanded] = useState(false);
return (
<Popper
Expand All @@ -23,7 +24,7 @@ export default function PopOver({ anchorEl }: Props) {
display: 'flex',
flexDirection: 'column',
inset: 'auto auto 14px -24px !important',
height: 'min(730px, calc(100vh - 100px))',
height: `min(730px, calc(100vh - ${buttonHeight} - 48px))`,
width: expanded ? '80vw' : 'min(400px, 80vw)',
overflow: 'hidden',
borderRadius: '12px',
Expand Down
2 changes: 2 additions & 0 deletions libs/copilot/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export interface IWidgetConfig {
imageUrl?: string;
style?: {
size?: string;
width?: string;
height?: string;
bgcolor?: string;
color?: string;
bgcolorHover?: string;
Expand Down
7 changes: 4 additions & 3 deletions libs/copilot/src/widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ interface Props {
export default function Widget({ config }: Props) {
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>();
const customStyle = config.button?.style || {};
const buttonHeight = customStyle.height || customStyle.size || '60px';
const style = {
width: customStyle.size || '60px',
height: customStyle.size || '60px',
width: customStyle.width || customStyle.size || '60px',
height: buttonHeight,
bgcolor: customStyle.bgcolor || '#F80061',
color: customStyle.color || 'white',
'&:hover': {
Expand All @@ -35,7 +36,7 @@ export default function Widget({ config }: Props) {

return (
<>
<PopOver anchorEl={anchorEl} />
<PopOver anchorEl={anchorEl} buttonHeight={buttonHeight} />
<Fab
disableRipple
aria-label="open copilot"
Expand Down

0 comments on commit b32c872

Please sign in to comment.