Skip to content

Commit afe7714

Browse files
cleanup
1 parent 0a37ade commit afe7714

2 files changed

Lines changed: 465 additions & 340 deletions

File tree

EssentialCSharp.Web/src/components/ChatWidget.vue

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ const {
99
chatMessages,
1010
chatInput,
1111
isTyping,
12+
isSubmitting,
1213
chatMessagesEl,
1314
chatInputField,
1415
captchaContainerEl,
1516
openChatDialog,
1617
closeChatDialog,
1718
clearChatHistory,
1819
formatMessage,
20+
getErrorHeading,
1921
getErrorMessageClass,
2022
getErrorIconClass,
2123
sendChatMessage
@@ -122,11 +124,7 @@ const {
122124
<div v-if="message.role === 'error'" :class="getErrorMessageClass(message.errorType)">
123125
<i :class="getErrorIconClass(message.errorType)" />
124126
<div class="message-text">
125-
<h4 v-if="message.errorType === 'rate-limit'">Rate Limit Reached</h4>
126-
<h4 v-else-if="message.errorType === 'auth-error'">Authentication Required</h4>
127-
<h4 v-else-if="message.errorType === 'captcha-error'">Verification Required</h4>
128-
<h4 v-else-if="message.errorType === 'validation-error'">Invalid Input</h4>
129-
<h4 v-else>Error</h4>
127+
<h4>{{ getErrorHeading(message.errorType) }}</h4>
130128
<p v-html="formatMessage(message.content)" />
131129
<div v-if="message.errorType === 'rate-limit'" class="retry-info">
132130
Please wait before sending another message
@@ -171,15 +169,15 @@ const {
171169
v-model="chatInput"
172170
class="chat-input"
173171
placeholder="Ask me about C#..."
174-
:disabled="isTyping || !isAuthenticated"
172+
:disabled="isSubmitting || isTyping || !isAuthenticated"
175173
autocomplete="off"
176174
aria-describedby="chat-input-help"
177175
maxlength="500"
178176
/>
179177
<button
180178
type="submit"
181179
class="send-button"
182-
:disabled="isTyping || !chatInput.trim() || !isAuthenticated"
180+
:disabled="isSubmitting || isTyping || !chatInput.trim() || !isAuthenticated"
183181
aria-label="Send message"
184182
title="Send message"
185183
>

0 commit comments

Comments
 (0)