deep-chat icon indicating copy to clipboard operation
deep-chat copied to clipboard

Issue with Extra Demo Response in Multi-Model Setup

Open nikitaa-gargg opened this issue 7 months ago • 2 comments

Hi @OvidijusParsiunas,

I hope you're doing well.

I am working with the deep-chat library and am trying to support multiple models in my setup. Specifically, I want to handle multiple models inside the onMessage event by making manual fetch requests to dynamically selected models.

Currently, when I select two models, I receive responses from both, but there’s also an extra message that says: "Hi there! This is a demo response!" along with the actual model responses.

I’d like to either hide this demo message or ensure that only the model-related responses are shown, without any extra messages.

I’ve attached a screenshot and included the relevant code I’m using to handle the multiple models:

` public getPlaygroundUrl(parameters: any) { this.chatRequest = {}; // ✅ Do not let DeepChat auto-send request

setTimeout(() => { if (this.chatElementRef) { const chatEl = this.chatElementRef.nativeElement;

chatEl.onMessage = async (data) => { if (data?.message?.role === 'user') { const userMessage = data.message.text; this.playgroundService.setUserMessage(userMessage);

const modelsToCall = [...this.selectedModelList];

await Promise.all(modelsToCall.map(async (model) => { try { const requestBody = { model, messages: [ { role: 'user', content: userMessage } ] };

const response = await fetch( this.appService.basePath + "api/providers/cloudlyte/v1/chat/completions", { method: 'POST', headers: { "Authorization": Bearer ${this.keyId}, "Content-Type": "application/json" }, body: JSON.stringify(requestBody) } );

const result = await response.json();

if (response.status === 401) { chatEl.addMessage({ text: ${model}: ❌ Unauthorized – check API key., role: 'ai' }); } else { const reply = result?.choices?.[0]?.message?.content || 'No reply received'; chatEl.addMessage({ text: ${model}: ${reply}, role: 'ai' }); } } catch (error) { chatEl.addMessage({ text: Error fetching from ${model}: ${error}, role: 'ai' }); } })); } }; } }); } `

<deep-chat #elementRef [introMessage]="introMessage" [textInput]="textInput" [responseInterceptor]="responseInterceptor" [demo]="false" [demoMessage]="null" [submitButtonStyles]="submitButtonStyles" [messageStyles]="messageStyles" [avatars]="avatars" [connect]="chatRequest" stream='{"simulation": 6}' style=" border-radius: 10px; width: 100%; height: calc(100vh - 100px); max-height: 55%; padding-top: 10px; font-family: 'Plus Jakarta Sans'; font-size: 0.9rem; background: #faf8f8; box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1); "> </deep-chat>

Image

nikitaa-gargg avatar Apr 28 '25 12:04 nikitaa-gargg