From 623830e8bf83aacf3653d08079916967d8f74d91 Mon Sep 17 00:00:00 2001 From: n4ze3m Date: Tue, 28 Nov 2023 20:54:48 +0530 Subject: [PATCH 1/8] Fix chat history length bug --- server/src/integration/handlers/discord.handler.ts | 4 ++++ server/src/integration/handlers/telegram.handler.ts | 8 ++++---- server/src/integration/handlers/whatsapp.handler.ts | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/server/src/integration/handlers/discord.handler.ts b/server/src/integration/handlers/discord.handler.ts index cacb2635..add24406 100644 --- a/server/src/integration/handlers/discord.handler.ts +++ b/server/src/integration/handlers/discord.handler.ts @@ -44,6 +44,10 @@ export const discordBotHandler = async ( ai: message.bot, })); + if (history.length > 20) { + history.splice(0, history.length - 20); + } + const temperature = bot.temperature; const sanitizedQuestion = message.trim().replaceAll("\n", " "); diff --git a/server/src/integration/handlers/telegram.handler.ts b/server/src/integration/handlers/telegram.handler.ts index ddb26f24..68c65ded 100644 --- a/server/src/integration/handlers/telegram.handler.ts +++ b/server/src/integration/handlers/telegram.handler.ts @@ -34,14 +34,14 @@ export const telegramBotHandler = async ( }, }); - // if (chat_history.length > 10) { - // chat_history.splice(0, chat_history.length - 10); - // } - let history = chat_history.map((message) => ({ human: message.human, ai: message.bot, })); + + if (history.length > 20) { + history.splice(0, history.length - 20); + } const temperature = bot.temperature; diff --git a/server/src/integration/handlers/whatsapp.handler.ts b/server/src/integration/handlers/whatsapp.handler.ts index 4d18c1c9..bedd1ea9 100644 --- a/server/src/integration/handlers/whatsapp.handler.ts +++ b/server/src/integration/handlers/whatsapp.handler.ts @@ -43,8 +43,8 @@ export const whatsappBotHandler = async ( }, }); - if (chat_history.length > 10) { - chat_history.splice(0, chat_history.length - 10); + if (chat_history.length > 20) { + chat_history.splice(0, chat_history.length - 20); } let history = chat_history.map((message) => ({ From 39abce59db732d5572719a0743519a8ab1a4ae68 Mon Sep 17 00:00:00 2001 From: n4ze3m Date: Tue, 28 Nov 2023 22:53:48 +0530 Subject: [PATCH 2/8] Update package versions and fix loading skeleton styles --- app/ui/package.json | 2 +- app/ui/src/components/Common/SkeletonLoading.tsx | 6 +++--- package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/ui/package.json b/app/ui/package.json index daabe64e..96004471 100644 --- a/app/ui/package.json +++ b/app/ui/package.json @@ -1,7 +1,7 @@ { "name": "app", "private": true, - "version": "1.4.3", + "version": "1.4.4", "type": "module", "scripts": { "dev": "vite", diff --git a/app/ui/src/components/Common/SkeletonLoading.tsx b/app/ui/src/components/Common/SkeletonLoading.tsx index df2ee714..3ee985d8 100644 --- a/app/ui/src/components/Common/SkeletonLoading.tsx +++ b/app/ui/src/components/Common/SkeletonLoading.tsx @@ -1,10 +1,10 @@ import { Skeleton } from "antd"; -export const SkeletonLoading = () => { +export const SkeletonLoading = ({ className = "mt-6" }: { className?: string }) => { return ( - <> +
- +
); }; diff --git a/package.json b/package.json index 90e58ef0..863f5f8e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dialoqbase", - "version": "1.4.3", + "version": "1.4.4", "description": "Create chatbots with ease", "scripts": { "ui:dev": "pnpm run --filter ui dev", From 58483706291f80c73aed682851149db5cbf8df23 Mon Sep 17 00:00:00 2001 From: n4ze3m Date: Tue, 28 Nov 2023 22:54:10 +0530 Subject: [PATCH 3/8] new telegram logs added --- .../Bot/Conversation/ConversationSidebar.tsx | 16 +- .../src/components/Bot/Conversation/index.tsx | 15 +- app/ui/src/routes/bot/conversations.tsx | 17 +-- app/ui/src/routes/bot/integrations.tsx | 4 +- app/ui/src/routes/bot/playground.tsx | 2 +- .../bot/conversations/handlers/get.handler.ts | 140 +++++++++++++----- 6 files changed, 141 insertions(+), 53 deletions(-) diff --git a/app/ui/src/components/Bot/Conversation/ConversationSidebar.tsx b/app/ui/src/components/Bot/Conversation/ConversationSidebar.tsx index 6225d28b..0720dccb 100644 --- a/app/ui/src/components/Bot/Conversation/ConversationSidebar.tsx +++ b/app/ui/src/components/Bot/Conversation/ConversationSidebar.tsx @@ -11,10 +11,14 @@ export const ConversationSidebar = ({ data, defaultIndex, setDefaultIndex, + onChannelChange, + defaultChannel, }: { data: ConversationsByType[]; defaultIndex: number | null; setDefaultIndex: React.Dispatch>; + onChannelChange: (value: string) => void; + defaultChannel: string; }) => { const [hideMenu] = React.useState(false); return ( @@ -31,8 +35,14 @@ export const ConversationSidebar = ({

Conversations