Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@ai-sdk/google": "^2.0.19",
"@ai-sdk/mistral": "^2.0.17",
"@ai-sdk/openai": "^2.0.44",
"@jupyter/chat": "^0.18.2",
"@jupyter/chat": "^0.19.0-alpha.0",
"@jupyterlab/application": "^4.0.0",
"@jupyterlab/apputils": "^4.5.6",
"@jupyterlab/cells": "^4.4.6",
Expand Down
20 changes: 10 additions & 10 deletions src/components/clear-button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { InputToolbarRegistry, TooltippedButton } from '@jupyter/chat';
import { InputToolbarRegistry } from '@jupyter/chat';

import ClearIcon from '@mui/icons-material/Clear';

import { Button } from '@mui/material';

import React from 'react';

import { AIChatModel } from '../chat-model';
Expand All @@ -23,18 +25,16 @@ export interface IClearButtonProps
export function ClearButton(props: IClearButtonProps): JSX.Element {
const tooltip = 'Clear chat';
return (
<TooltippedButton
<Button
onClick={props.clearMessages}
tooltip={tooltip}
buttonProps={{
size: 'small',
variant: 'outlined',
color: 'secondary',
title: tooltip
}}
aria-label={tooltip}
size={'small'}
variant={'outlined'}
color={'secondary'}
title={tooltip}
>
<ClearIcon />
</TooltippedButton>
</Button>
);
}

Expand Down
50 changes: 23 additions & 27 deletions src/components/model-select.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { InputToolbarRegistry, TooltippedButton } from '@jupyter/chat';
import { InputToolbarRegistry } from '@jupyter/chat';
import CheckIcon from '@mui/icons-material/Check';
import { Menu, MenuItem, Typography } from '@mui/material';
import { Button, Menu, MenuItem, Typography } from '@mui/material';
import React, { useCallback, useEffect, useState } from 'react';
import { AIChatModel } from '../chat-model';
import { AISettingsModel } from '../models/settings-model';
Expand Down Expand Up @@ -97,16 +97,14 @@ export function ModelSelect(props: IModelSelectProps): JSX.Element {
// Show a message if no providers are configured
if (availableModels.length === 0) {
return (
<TooltippedButton
<Button
onClick={() => {}}
tooltip="No providers configured. Please go to AI Settings to add a provider."
buttonProps={{
size: 'small',
variant: 'outlined',
color: 'warning',
disabled: true,
title: 'No Providers Available'
}}
aria-label="No providers configured. Please go to AI Settings to add a provider."
size={'small'}
variant={'outlined'}
color={'warning'}
disabled={true}
title={'No Providers Available'}
sx={{
minWidth: 'auto',
display: 'flex',
Expand All @@ -120,30 +118,28 @@ export function ModelSelect(props: IModelSelectProps): JSX.Element {
>
No Providers
</Typography>
</TooltippedButton>
</Button>
);
}

return (
<>
<TooltippedButton
<Button
onClick={e => {
openMenu(e.currentTarget);
}}
tooltip={`Current Model: ${currentProviderLabel} - ${currentModel}`}
buttonProps={{
size: 'small',
variant: 'contained',
color: 'primary',
title: 'Select AI Model',
onKeyDown: e => {
if (e.key !== 'Enter' && e.key !== ' ') {
return;
}
openMenu(e.currentTarget);
// Stop propagation to prevent sending message
e.stopPropagation();
aria-label={`Current Model: ${currentProviderLabel} - ${currentModel}`}
size={'small'}
variant={'contained'}
color={'primary'}
title={'Select AI Model'}
onKeyDown={e => {
if (e.key !== 'Enter' && e.key !== ' ') {
return;
}
openMenu(e.currentTarget);
// Stop propagation to prevent sending message
e.stopPropagation();
}}
sx={{
minWidth: 'auto',
Expand All @@ -158,7 +154,7 @@ export function ModelSelect(props: IModelSelectProps): JSX.Element {
>
{currentProviderLabel}
</Typography>
</TooltippedButton>
</Button>

<Menu
open={menuOpen}
Expand Down
20 changes: 10 additions & 10 deletions src/components/stop-button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { InputToolbarRegistry, TooltippedButton } from '@jupyter/chat';
import { InputToolbarRegistry } from '@jupyter/chat';

import StopIcon from '@mui/icons-material/Stop';

import { Button } from '@mui/material';

import React from 'react';

import { AIChatModel } from '../chat-model';
Expand All @@ -23,18 +25,16 @@ export interface IStopButtonProps
export function StopButton(props: IStopButtonProps): JSX.Element {
const tooltip = 'Stop streaming';
return (
<TooltippedButton
<Button
onClick={props.stopStreaming}
tooltip={tooltip}
buttonProps={{
size: 'small',
variant: 'contained',
color: 'error',
title: tooltip
}}
aria-label={tooltip}
size={'small'}
variant={'contained'}
color={'error'}
title={tooltip}
>
<StopIcon />
</TooltippedButton>
</Button>
);
}

Expand Down
32 changes: 15 additions & 17 deletions src/components/tool-select.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { InputToolbarRegistry, TooltippedButton } from '@jupyter/chat';
import { InputToolbarRegistry } from '@jupyter/chat';

import BuildIcon from '@mui/icons-material/Build';

import CheckIcon from '@mui/icons-material/Check';

import { Menu, MenuItem, Tooltip, Typography } from '@mui/material';
import { Button, Menu, MenuItem, Tooltip, Typography } from '@mui/material';

import React, { useCallback, useEffect, useState } from 'react';

Expand Down Expand Up @@ -107,24 +107,22 @@ export function ToolSelect(props: IToolSelectProps): JSX.Element {

return (
<>
<TooltippedButton
<Button
onClick={e => {
openMenu(e.currentTarget);
}}
tooltip={`Tools (${selectedToolNames.length}/${tools.length} selected)`}
buttonProps={{
size: 'small',
variant: selectedToolNames.length > 0 ? 'contained' : 'outlined',
color: 'primary',
title: 'Select AI Tools',
onKeyDown: e => {
if (e.key !== 'Enter' && e.key !== ' ') {
return;
}
openMenu(e.currentTarget);
// Stop propagation to prevent sending message
e.stopPropagation();
aria-label={`Tools (${selectedToolNames.length}/${tools.length} selected)`}
size={'small'}
variant={selectedToolNames.length > 0 ? 'contained' : 'outlined'}
color={'primary'}
title={'Select AI Tools'}
onKeyDown={e => {
if (e.key !== 'Enter' && e.key !== ' ') {
return;
}
openMenu(e.currentTarget);
// Stop propagation to prevent sending message
e.stopPropagation();
}}
sx={
selectedToolNames.length === 0
Expand All @@ -133,7 +131,7 @@ export function ToolSelect(props: IToolSelectProps): JSX.Element {
}
>
<BuildIcon />
</TooltippedButton>
</Button>

<Menu
open={menuOpen}
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2234,9 +2234,9 @@ __metadata:
languageName: node
linkType: hard

"@jupyter/chat@npm:^0.18.2":
version: 0.18.2
resolution: "@jupyter/chat@npm:0.18.2"
"@jupyter/chat@npm:^0.19.0-alpha.0":
version: 0.19.0-alpha.0
resolution: "@jupyter/chat@npm:0.19.0-alpha.0"
dependencies:
"@emotion/react": ^11.10.5
"@emotion/styled": ^11.10.5
Expand All @@ -2262,7 +2262,7 @@ __metadata:
clsx: ^2.1.0
react: ^18.2.0
react-dom: ^18.2.0
checksum: eb345e4404e1d9ade075608238ef96e7ff1f260e817dbe9ed65cdbfb75498f9754ae774ca996f76357020f23b5c514634d058f6e23bf5abdf961dbce76dd2bd9
checksum: d69399cb80bdcb59387fc44f0cd176aa626374a46b5c5a2d25512e053b2262edcb6acd5e7477eae3da36dd3bfd865103388b504ca486622fb640e88267b3411a
languageName: node
linkType: hard

Expand Down Expand Up @@ -3019,7 +3019,7 @@ __metadata:
"@ai-sdk/google": ^2.0.19
"@ai-sdk/mistral": ^2.0.17
"@ai-sdk/openai": ^2.0.44
"@jupyter/chat": ^0.18.2
"@jupyter/chat": ^0.19.0-alpha.0
"@jupyterlab/application": ^4.0.0
"@jupyterlab/apputils": ^4.5.6
"@jupyterlab/builder": ^4.0.0
Expand Down
Loading