james-d-taboola commited on
Commit
91b111a
·
1 Parent(s): 141b9ea

fix: turn of autoComplete and fix rtey failed

Browse files
src/app/coach-chat/page.tsx CHANGED
@@ -390,9 +390,12 @@ function DirectCoachChatInner() {
390
  onClick={() => {
391
  // Retry last message
392
  const lastUserMsg = messages.findLast(m => m.role === 'user');
393
- if (lastUserMsg && 'text' in lastUserMsg && typeof lastUserMsg.text === 'string') {
394
- clearError();
395
- sendMessage({ text: lastUserMsg.text });
 
 
 
396
  }
397
  }}
398
  className="px-3 py-1.5 bg-red-600 text-white rounded-lg text-sm font-medium hover:bg-red-700 transition-colors"
@@ -424,6 +427,7 @@ function DirectCoachChatInner() {
424
  placeholder={`向 ${coach.name} 提問...`}
425
  className="flex-1 bg-transparent outline-none text-base text-gray-800 placeholder-gray-500"
426
  disabled={isLoading}
 
427
  />
428
  </div>
429
  <button
 
390
  onClick={() => {
391
  // Retry last message
392
  const lastUserMsg = messages.findLast(m => m.role === 'user');
393
+ if (lastUserMsg && lastUserMsg.parts) {
394
+ const textPart = lastUserMsg.parts.find(p => p.type === 'text');
395
+ if (textPart && 'text' in textPart) {
396
+ clearError();
397
+ sendMessage({ text: textPart.text });
398
+ }
399
  }
400
  }}
401
  className="px-3 py-1.5 bg-red-600 text-white rounded-lg text-sm font-medium hover:bg-red-700 transition-colors"
 
427
  placeholder={`向 ${coach.name} 提問...`}
428
  className="flex-1 bg-transparent outline-none text-base text-gray-800 placeholder-gray-500"
429
  disabled={isLoading}
430
+ autoComplete="off"
431
  />
432
  </div>
433
  <button
src/app/conversation/[id]/page.tsx CHANGED
@@ -748,12 +748,15 @@ export default function ConversationPage() {
748
  onClick={() => {
749
  // Retry last message
750
  const lastUserMsg = messages.findLast(m => m.role === 'user');
751
- if (lastUserMsg && 'text' in lastUserMsg && typeof lastUserMsg.text === 'string') {
752
- clearError();
753
- sendMessage({
754
- text: lastUserMsg.text,
755
- metadata: lastUserMsg.metadata as Record<string, unknown> | undefined,
756
- });
 
 
 
757
  }
758
  }}
759
  className="px-3 py-1.5 bg-red-600 text-white rounded-lg text-sm font-medium hover:bg-red-700 transition-colors"
@@ -829,6 +832,7 @@ export default function ConversationPage() {
829
  placeholder={speaker === 'student' ? `與 ${conversation.studentName} 對話...` : `詢問 ${conversation.coachName} 建議...`}
830
  className="flex-1 bg-transparent outline-none text-base text-gray-800 placeholder-gray-500"
831
  disabled={isLoading}
 
832
  />
833
  </div>
834
  <button
 
748
  onClick={() => {
749
  // Retry last message
750
  const lastUserMsg = messages.findLast(m => m.role === 'user');
751
+ if (lastUserMsg && lastUserMsg.parts) {
752
+ const textPart = lastUserMsg.parts.find(p => p.type === 'text');
753
+ if (textPart && 'text' in textPart) {
754
+ clearError();
755
+ sendMessage({
756
+ text: textPart.text,
757
+ metadata: lastUserMsg.metadata as Record<string, unknown> | undefined,
758
+ });
759
+ }
760
  }
761
  }}
762
  className="px-3 py-1.5 bg-red-600 text-white rounded-lg text-sm font-medium hover:bg-red-700 transition-colors"
 
832
  placeholder={speaker === 'student' ? `與 ${conversation.studentName} 對話...` : `詢問 ${conversation.coachName} 建議...`}
833
  className="flex-1 bg-transparent outline-none text-base text-gray-800 placeholder-gray-500"
834
  disabled={isLoading}
835
+ autoComplete="off"
836
  />
837
  </div>
838
  <button