Skip to content

Commit

Permalink
Check whether there are agents and show warning when sending message
Browse files Browse the repository at this point in the history
  • Loading branch information
joelhulen committed Aug 1, 2024
1 parent 5ebfe58 commit 2591ca1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/ui/UserPortal/components/ChatThread.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,20 @@ export default {
this.isMessagePending = true;
this.userSentMessage = true;
const agent = this.$appStore.getSessionAgent(this.currentSession).resource;
const agent = this.$appStore.getSessionAgent(this.currentSession)?.resource;
// Display an error toast message if agent is null or undefined.
if (!agent) {
this.$toast.add({
severity: 'info',
summary: 'Could not send message',
detail: 'Please select an agent and try again. If no agents are available, refresh the page.',
life: 8000,
});
this.isMessagePending = false;
return;
}
if (agent.long_running) {
// Handle long-running operations
const operationId = await this.$appStore.startLongRunningProcess('/completions', {
Expand Down

0 comments on commit 2591ca1

Please sign in to comment.