Skip to content

Commit 5a57762

Browse files
fix refresh button rendering
1 parent d86e61f commit 5a57762

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

CS/ReportingApp/wwwroot/js/aiIntegration.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,22 @@
8585
stylingMode: 'text',
8686
onClick: () => refreshAnswer(data.component)
8787
});
88-
buttonContainer.appendChild(refreshBtnElement);
88+
if(data.component.option('items').at(-1).author === assistant.name) {
89+
buttonContainer.appendChild(refreshBtnElement);
90+
lastRefreshButton = refreshBtnElement;
91+
}
8992
container.appendChild(buttonContainer);
9093
},
9194
onMessageEntered: async (e) => {
95+
lastRefreshButton?.remove();
9296
const instance = e.component;
9397
instance.renderMessage(e.message);
9498
instance.option({ typingUsers: [assistant] });
9599
const userInput = e.message.text;
96-
97-
var response = await getAIResponse(userInput, assistant.id);
100+
if(!assistant.id && model.chatId) {
101+
assistant.id = model.chatId;
102+
}
103+
const response = await getAIResponse(instance, userInput, assistant.id);
98104
RenderAssistantMessage(instance, response);
99105
}
100106
};

0 commit comments

Comments
 (0)