Skip to content

Commit

Permalink
🐛 fix: fix import
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Oct 22, 2023
1 parent f89f1a9 commit 0311e5f
Show file tree
Hide file tree
Showing 23 changed files with 30 additions and 74 deletions.
4 changes: 2 additions & 2 deletions src/ChatList/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { FC, ReactNode, memo, useCallback, useMemo, useState } from 'react';

import { ActionEvent } from '@/ActionIconGroup';
import ChatItem, { type ChatItemProps } from '@/ChatItem';
import { ChatMessage } from '@/types/chatMessage';
import { LLMRoleType } from '@/types/llm';
import { ChatMessage } from '@/types/message';

import ActionsBar, { type ActionsBarProps } from './ActionsBar';

Expand Down Expand Up @@ -192,7 +192,7 @@ const Item = memo<ChatListItemProps>((props) => {
return (
<ChatItem
actions={<Actions data={item} />}
avatar={item.meta}
avatar={(item as any).meta}
avatarAddon={groupNav}
editing={editing}
error={error}
Expand Down
2 changes: 1 addition & 1 deletion src/EditableMessageList/messageReducer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { produce } from 'immer';

import { ChatMessageError } from '@/types/chatMessage';
import { LLMMessage, LLMRoleType } from '@/types/llm';
import { ChatMessageError } from '@/types/message';

export type MessageDispatch =
| { message: LLMMessage; type: 'addMessage' }
Expand Down
3 changes: 2 additions & 1 deletion src/ProChat/components/ChatList/Actions/Fallback.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import ActionIconGroup from '@/ActionIconGroup';
import { RenderAction } from '@/ChatList';
import { useChatListActionsBar } from '@/hooks/useChatListActionsBar';
import { ActionIconGroup, RenderAction } from '@lobehub/ui';
import { memo } from 'react';

export const DefaultActionsBar: RenderAction = memo(({ text, onActionClick }) => {
Expand Down
3 changes: 2 additions & 1 deletion src/ProChat/components/ChatList/Actions/Function.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import ActionIconGroup from '@/ActionIconGroup';
import { RenderAction } from '@/ChatList';
import { useChatListActionsBar } from '@/hooks/useChatListActionsBar';
import { ActionIconGroup, RenderAction } from '@lobehub/ui';
import { memo } from 'react';

export const FunctionActionsBar: RenderAction = memo(({ text, onActionClick }) => {
Expand Down
3 changes: 2 additions & 1 deletion src/ProChat/components/ChatList/Actions/User.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import ActionIconGroup from '@/ActionIconGroup';
import { RenderAction } from '@/ChatList';
import { useChatListActionsBar } from '@/hooks/useChatListActionsBar';
import { ActionIconGroup, RenderAction } from '@lobehub/ui';
import { memo } from 'react';

export const UserActionsBar: RenderAction = memo(({ text, onActionClick }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/ProChat/components/ChatList/Actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChatListProps } from '@lobehub/ui';
import { ChatListProps } from '@/ChatList';

import { AssistantActionsBar } from './Assistant';
import { DefaultActionsBar } from './Fallback';
Expand Down
2 changes: 1 addition & 1 deletion src/ProChat/components/ChatList/Extras/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChatListProps } from '@lobehub/ui';
import { ChatListProps } from '@/ChatList';

import { AssistantMessageExtra } from './Assistant';
import { UserMessageExtra } from './User';
Expand Down
2 changes: 1 addition & 1 deletion src/ProChat/components/ChatList/Messages/Assistant.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RenderMessage } from '@lobehub/ui';
import { RenderMessage } from '@/ChatList';
import { memo } from 'react';

import { DefaultMessage } from './Default';
Expand Down
2 changes: 1 addition & 1 deletion src/ProChat/components/ChatList/Messages/Default.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RenderMessage } from '@lobehub/ui';
import { RenderMessage } from '@/ChatList';
import { memo } from 'react';

import { LOADING_FLAT } from '@/ProChat/const/message';
Expand Down
2 changes: 1 addition & 1 deletion src/ProChat/components/ChatList/Messages/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChatListProps } from '@lobehub/ui';
import { ChatListProps } from '@/ChatList';

import { AssistantMessage } from './Assistant';
import { DefaultMessage } from './Default';
Expand Down
2 changes: 1 addition & 1 deletion src/ProChat/components/ChatList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChatList } from '@lobehub/ui';
import ChatList from '@/ChatList';
import isEqual from 'fast-deep-equal';
import { memo } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion src/ProChat/index.tsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from '../types/message';
export { ProChat } from './container';
export * from './types/message';
2 changes: 1 addition & 1 deletion src/ProChat/store/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { StateCreator } from 'zustand/vanilla';

import { LOADING_FLAT } from '@/ProChat/const/message';
import { ChatStore } from '@/ProChat/store/index';
import { ChatMessage } from '@/ProChat/types/message';
import { fetchSSE } from '@/ProChat/utils/fetch';
import { isFunctionMessage } from '@/ProChat/utils/message';
import { setNamespace } from '@/ProChat/utils/storeDebug';
import { nanoid } from '@/ProChat/utils/uuid';
import { ChatMessage } from '@/types/message';

import { initialModelConfig } from '@/ProChat/store/initialState';
import { ChatStreamPayload } from '@/ProChat/types/chat';
Expand Down
2 changes: 1 addition & 1 deletion src/ProChat/store/initialState.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DEFAULT_AVATAR, DEFAULT_USER_AVATAR } from '@/ProChat/const/meta';
import { ModelConfig } from '@/ProChat/types/config';
import { ChatMessage, ChatMessageMap } from '@/ProChat/types/message';
import { MetaData } from '@/ProChat/types/meta';
import { ChatMessage, ChatMessageMap } from '@/types/message';

export type ChatRequest = (messages: ChatMessage[], config: ModelConfig) => Promise<Response>;

Expand Down
2 changes: 1 addition & 1 deletion src/ProChat/store/reducers/message.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChatMessageMap } from '@/ProChat/types/message';
import { ChatMessageMap } from '@/types/message';

import { MessageDispatch, messagesReducer } from './message';

Expand Down
2 changes: 1 addition & 1 deletion src/ProChat/store/reducers/message.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { produce } from 'immer';

import { ChatMessage, ChatMessageMap } from '@/ProChat/types/message';
import { nanoid } from '@/ProChat/utils/uuid';
import { LLMRoleType } from '@/types/llm';
import { ChatMessage, ChatMessageMap } from '@/types/message';
import { MetaData } from '@/types/meta';

interface AddMessage {
Expand Down
2 changes: 1 addition & 1 deletion src/ProChat/store/selectors/chat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChatMessage } from '@/ProChat/types/message';
import { ChatMessage } from '@/types/message';

import { MetaData } from '@/ProChat/types/meta';
import { getSlicedMessagesWithConfig } from '../../utils/message';
Expand Down
2 changes: 1 addition & 1 deletion src/ProChat/types/chat.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { OpenAIFunctionCall } from '@/types/chatMessage';
import { LLMRoleType } from '@/types/llm';
import { OpenAIFunctionCall } from '@/types/message';

export interface OpenAIChatMessage {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/ProChat/utils/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChatMessageError } from '@/types/chatMessage';
import { ChatMessageError } from '../../types/message';

export const getMessageError = async (response: Response) => {
let chatMessageError: ChatMessageError;
Expand Down
2 changes: 1 addition & 1 deletion src/ProChat/utils/message.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FUNCTION_MESSAGE_FLAG } from '@/ProChat/const/message';
import { ModelConfig } from '@/ProChat/types/config';
import { ChatMessage } from '@/ProChat/types/message';
import { ChatMessage } from '@/types/message';

export const isFunctionMessage = (content: string) => {
return content.startsWith(FUNCTION_MESSAGE_FLAG);
Expand Down
52 changes: 0 additions & 52 deletions src/types/chatMessage.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { type HTMLAttributes } from 'react';

export * from './chatMessage';
export * from './customStylish';
export * from './customToken';
export * from './llm';
export * from './message';
export * from './meta';

export type DivProps = HTMLAttributes<HTMLDivElement>;
Expand Down
5 changes: 5 additions & 0 deletions src/ProChat/types/message.ts → src/types/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ export interface ChatMessage {
}

export type ChatMessageMap = Record<string, ChatMessage>;

export interface OpenAIFunctionCall {
arguments?: string;
name: string;
}

0 comments on commit 0311e5f

Please sign in to comment.