Comments (3)
Hi @MOHD-KAIF-hub.
I am not fully sure why you are attempting to manually toggle the displayLoadingBubble
value. The Deep Chat component property values can't be dynamically changed (without the component being completely re-rendered), so when you assign a new value to displayLoadingBubble
- the chat will only use the one given at the start. Hence the toggle does not do anything.
If the problem that you are referring to is the fact that the loading bubble is only displaying for a few milliseconds, the reason for that is upon changing the React State via setinitialMessages
and setIsLoading
- the component will be completely re-rendered. This is a basic React component convention.
To see for yourself you can comment out the code that uses these setters and you will be able to observe the loading bubble working correctly.
To store messages without having the component being re-renderd, I would instead suggest storing it by other means, such as an external variable. E.g. using the following syntax:
const initialMessages: MessageContent[] = [
{text: 'How are you doing?', role: 'loading'},
{
html: `
<div class="deep-chat-temporary-message">
<button class="deep-chat-button deep-chat-suggestion-button" style="margin-top: 5px">give some bullet points?</button>
<button class="deep-chat-button deep-chat-suggestion-button" style="margin-top: 6px">summarize it?</button>
<button class="deep-chat-button deep-chat-suggestion-button" style="margin-top: 6px">What is this?</button>
</div>`,
role: 'user',
},
];
export const App = () => {
...
And instead of setinitialMessages
you can use initialMessages.push()
.
I would also suggest using the onNewMessage
event to track message history, e.g:
onNewMessage={(newMessage) => {
initialMessages.push(newMessage.message);
}}
Hopefully this helps you. Let me know if you have any questions.
Thanks!
from deep-chat.
First of all thanks for your response. I got what the mistake I was doing now I will handle thanks a lot.
from deep-chat.
Hey, I will be closing this issue since the problem has been resolved. Thanks!
from deep-chat.
Related Issues (20)
- Qestion: [fade-in effect] HOT 1
- streaming in WebSocket mode HOT 2
- Assistants V2 File Annotations Replacement HOT 6
- Function Calling doesn't seem to be working with Direct Connection HOT 2
- Chat Rerenders and React Hooks HOT 1
- OpenAI Assistants V2 Stream Error After Function Call HOT 7
- A server template for Nuxt - would be amazing. HOT 1
- Programmatically trigger microphone HOT 1
- Example HTML Active Table options not working HOT 1
- Are there any events to capture when we drop files in deep-chat view HOT 2
- Scroll to the desired position HOT 2
- Streaming support for assistants in OpenAI HOT 4
- Formatting in input message is lost on send HOT 2
- Display issues when code is inserted in the user's prompt HOT 4
- OpenAI model says that it is GTP-3 HOT 1
- Forcibly Cancel Recording Status HOT 1
- Is there any way to get to enable GPT to access to the internet? Can't do that even I'm on GTP-4o HOT 1
- Audio Function Usage and RequestInterceptor Issues Across Different OS Environments: HOT 5
- Module not found: Error: Can't resolve 'deep-chat/dist/types/interceptors' HOT 1
- Logging messages and attachments HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deep-chat.