From f5f8ef84dd638d98990bb90bbc7ce40beb415b3c Mon Sep 17 00:00:00 2001 From: Nicolas Brichet Date: Thu, 29 Feb 2024 10:42:35 +0100 Subject: [PATCH] Cleaning code --- src/chat-handler.ts | 3 ++- src/components/chat-messages.tsx | 5 ++--- src/components/chat-settings.tsx | 10 +++++----- src/handler.ts | 1 - src/widgets/chat-error.tsx | 7 +++---- src/widgets/chat-sidebar.tsx | 7 +++---- 6 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/chat-handler.ts b/src/chat-handler.ts index 62b5433..04cfe98 100644 --- a/src/chat-handler.ts +++ b/src/chat-handler.ts @@ -1,6 +1,7 @@ +import { URLExt } from '@jupyterlab/coreutils'; import { IDisposable } from '@lumino/disposable'; import { ServerConnection } from '@jupyterlab/services'; -import { URLExt } from '@jupyterlab/coreutils'; + import { requestAPI } from './handler'; import { ChatService } from './services'; diff --git a/src/components/chat-messages.tsx b/src/components/chat-messages.tsx index 0082a76..02953dc 100644 --- a/src/components/chat-messages.tsx +++ b/src/components/chat-messages.tsx @@ -1,9 +1,8 @@ -import React, { useState, useEffect } from 'react'; - +import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; import { Avatar, Box, Typography } from '@mui/material'; import type { SxProps, Theme } from '@mui/material'; +import React, { useState, useEffect } from 'react'; -import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; import { RendermimeMarkdown } from './rendermime-markdown'; import { ChatService } from '../services'; diff --git a/src/components/chat-settings.tsx b/src/components/chat-settings.tsx index 2cd87a4..0949882 100644 --- a/src/components/chat-settings.tsx +++ b/src/components/chat-settings.tsx @@ -11,14 +11,14 @@ import { } from '@mui/material'; import React, { useEffect, useState } from 'react'; -import { ChatService } from '../services'; +import { useStackingAlert } from './mui-extras/stacking-alert'; import { ServerInfoState, useServerInfo } from './settings/use-server-info'; import { minifyUpdate } from './settings/minify'; -import { useStackingAlert } from './mui-extras/stacking-alert'; +import { ChatService } from '../services'; -// /** -// * Component that returns the settings view in the chat panel. -// */ +/** + * Component that returns the settings view in the chat panel. + */ export function ChatSettings(): JSX.Element { // state fetched on initial render const server = useServerInfo(); diff --git a/src/handler.ts b/src/handler.ts index d5a1f57..5ffb554 100644 --- a/src/handler.ts +++ b/src/handler.ts @@ -1,5 +1,4 @@ import { URLExt } from '@jupyterlab/coreutils'; - import { ServerConnection } from '@jupyterlab/services'; const API_NAMESPACE = 'api/chat'; diff --git a/src/widgets/chat-error.tsx b/src/widgets/chat-error.tsx index 8ae9cbb..362b2da 100644 --- a/src/widgets/chat-error.tsx +++ b/src/widgets/chat-error.tsx @@ -1,10 +1,9 @@ -import React from 'react'; -import { ReactWidget } from '@jupyterlab/apputils'; -import type { IThemeManager } from '@jupyterlab/apputils'; +import { IThemeManager, ReactWidget } from '@jupyterlab/apputils'; import { Alert, Box } from '@mui/material'; +import React from 'react'; -import { chatIcon } from '../icons'; import { JlThemeProvider } from '../components/jl-theme-provider'; +import { chatIcon } from '../icons'; export function buildErrorWidget( themeManager: IThemeManager | null diff --git a/src/widgets/chat-sidebar.tsx b/src/widgets/chat-sidebar.tsx index b209845..6e12259 100644 --- a/src/widgets/chat-sidebar.tsx +++ b/src/widgets/chat-sidebar.tsx @@ -1,11 +1,10 @@ +import { IThemeManager, ReactWidget } from '@jupyterlab/apputils'; +import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; import React from 'react'; -import { ReactWidget } from '@jupyterlab/apputils'; -import type { IThemeManager } from '@jupyterlab/apputils'; import { Chat } from '../components/chat'; -import { chatIcon } from '../icons'; import { ChatHandler } from '../chat-handler'; -import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; +import { chatIcon } from '../icons'; export function buildChatSidebar( chatHandler: ChatHandler,