diff --git a/app/chat/main.tsx b/app/chat/main.tsx index 8895f98..914c2df 100644 --- a/app/chat/main.tsx +++ b/app/chat/main.tsx @@ -9,11 +9,21 @@ import Form from '@/components/form' import XPowerBy, { XPowerByPrivacy } from '@/components/x-power-by' import I18N from '@/i18n' +enum Status { + INIT = 'init', + READY = 'ready', + TYPING = 'typing', + SENDING = 'sending', + ERROR = 'error', + SUCCESS = 'success' +} + interface ExtraPropss { user: string conversations: ConversationsProps[] } interface IState { + status: Status conversations: ConversationsProps[] inputs: any query: string @@ -28,6 +38,8 @@ interface IAction { function reducer(state: IState, action: IAction): IState { switch (action.type) { + case 'NEW_CONVERSATION': + return action.payload case 'SET_QUERY': return { ...state, @@ -40,6 +52,7 @@ function reducer(state: IState, action: IAction): IState { }) return { ...state, + status: Status.READY, inputs: h } case 'SET_CONVERSATION_ID': @@ -52,6 +65,9 @@ function reducer(state: IState, action: IAction): IState { } } } +const Chat: FC = ({}) => { + return <>Chat +} const Main: FC = ({ user, @@ -60,6 +76,7 @@ const Main: FC = ({ conversations }) => { const initialState: IState = { + status: Status.INIT, conversations, inputs: [], query: '', @@ -83,6 +100,7 @@ const Main: FC = ({ options: iv.options } }) + return ( <>
@@ -98,7 +116,9 @@ const Main: FC = ({
-
- -
-
-
{ - dispatch({ - type: 'SET_INPUT', - payload: items - }) - }} - /> -
+ {state.status == Status.INIT ? ( + <> +
+ +
+
+ { + dispatch({ + type: 'SET_INPUT', + payload: items + }) + }} + /> +
-
- - -
+
+ + +
+ + ) : ( + + )}
) diff --git a/components/welcome/index.tsx b/components/welcome/index.tsx index 95d9ae5..59374ff 100644 --- a/components/welcome/index.tsx +++ b/components/welcome/index.tsx @@ -9,7 +9,9 @@ interface WelcomeProps { const Welcome: FC = ({ name, description }) => { return (
-
👏 Welcome to use {name}
+
+ {name} +
{description}
) diff --git a/i18n/en/index.json b/i18n/en/index.json index ebf4fbf..cd0fff7 100644 --- a/i18n/en/index.json +++ b/i18n/en/index.json @@ -7,7 +7,7 @@ "start_chat": "Start Chat", "try_to_ask": "Try to ask", "opening_statement": "Opening statement", - "welcome_message": "Welcome to Dify.AI", + "welcome_message": "👏 Welcome to Dify.AI", "welcome_message_description": "Dify.AI is a platform that allows you to create your own chatbots. ", "initial_prompt": "Initial prompt", "opts": { diff --git a/i18n/zh-CN/index.json b/i18n/zh-CN/index.json index e113e56..a8f028a 100644 --- a/i18n/zh-CN/index.json +++ b/i18n/zh-CN/index.json @@ -7,7 +7,7 @@ "start_chat": "开始聊天", "try_to_ask": "试着问问", "opening_statement": "开场白", - "welcome_message": "欢迎使用 Dify.AI", + "welcome_message": "👏 欢迎使用 Dify.AI", "welcome_message_description": "Dify.AI 是一个基于人工智能的聊天机器人平台,它可以帮助您快速构建自己的聊天机器人。", "initial_prompt": "初始提示", "opts": {