feat: Update feedback dialog text to reference Qwen instead of Claude

This commit is contained in:
DragonnZhang 2026-01-12 16:21:26 +08:00
parent d095a8b3f1
commit e748532e6d
6 changed files with 38 additions and 31 deletions

View file

@ -290,8 +290,8 @@ export default {
'Custom Witty Phrases': 'Benutzerdefinierte Witzige Sprüche',
'Enable Welcome Back': 'Willkommen-zurück aktivieren',
'Enable User Feedback': 'Benutzerfeedback aktivieren',
'How is Claude doing this session? (optional)':
'Wie macht sich Claude in dieser Sitzung? (optional)',
'How is Qwen doing this session? (optional)':
'Wie macht sich Qwen in dieser Sitzung? (optional)',
Bad: 'Schlecht',
Fine: 'In Ordnung',
Good: 'Gut',

View file

@ -287,8 +287,8 @@ export default {
'Custom Witty Phrases': 'Custom Witty Phrases',
'Enable Welcome Back': 'Enable Welcome Back',
'Enable User Feedback': 'Enable User Feedback',
'How is Claude doing this session? (optional)':
'How is Claude doing this session? (optional)',
'How is Qwen doing this session? (optional)':
'How is Qwen doing this session? (optional)',
Bad: 'Bad',
Fine: 'Fine',
Good: 'Good',

View file

@ -290,8 +290,8 @@ export default {
'Custom Witty Phrases': 'Пользовательские остроумные фразы',
'Enable Welcome Back': 'Включить приветствие при возврате',
'Enable User Feedback': 'Включить отзывы пользователей',
'How is Claude doing this session? (optional)':
'Как дела у Claude в этой сессии? (необязательно)',
'How is Qwen doing this session? (optional)':
'Как дела у Qwen в этой сессии? (необязательно)',
Bad: 'Плохо',
Fine: 'Нормально',
Good: 'Хорошо',

View file

@ -278,8 +278,7 @@ export default {
'Custom Witty Phrases': '自定义诙谐短语',
'Enable Welcome Back': '启用欢迎回来',
'Enable User Feedback': '启用用户反馈',
'How is Claude doing this session? (optional)':
'Claude 这次表现如何?(可选)',
'How is Qwen doing this session? (optional)': 'Qwen 这次表现如何?(可选)',
Bad: '差',
Fine: '一般',
Good: '好',

View file

@ -34,7 +34,7 @@ export const FeedbackDialog: React.FC = () => {
<Box flexDirection="column" marginY={1}>
<Box>
<Text color="cyan"> </Text>
<Text bold>{t('How is Claude doing this session? (optional)')}</Text>
<Text bold>{t('How is Qwen doing this session? (optional)')}</Text>
</Box>
<Box marginTop={1}>
<Text color="cyan">1: </Text>

View file

@ -9,6 +9,33 @@ import { StreamingState, MessageType, type HistoryItem } from '../types.js';
import type { LoadedSettings } from '../../config/settings.js';
import type { SessionStatsState } from '../contexts/SessionContext.js';
const FEEDBACK_SHOW_PROBABILITY = 0.25; // 25% probability of showing feedback dialog
/**
* Check if there's an AI response after the last user message in the conversation history
*/
const hasAIResponseAfterLastUserMessage = (history: HistoryItem[]): boolean => {
// Find the last user message
let lastUserMessageIndex = -1;
for (let i = history.length - 1; i >= 0; i--) {
if (history[i].type === MessageType.USER) {
lastUserMessageIndex = i;
break;
}
}
// Check if there's any AI response (GEMINI message) after the last user message
if (lastUserMessageIndex !== -1) {
for (let i = lastUserMessageIndex + 1; i < history.length; i++) {
if (history[i].type === MessageType.GEMINI) {
return true;
}
}
}
return false;
};
export interface UseFeedbackDialogProps {
config: Config;
settings: LoadedSettings;
@ -74,26 +101,8 @@ export const useFeedbackDialog = ({
let timeoutId: NodeJS.Timeout;
if (streamingState === StreamingState.Idle && history.length > 0) {
// Find the last user message and check if there's AI response after it
let lastUserMessageIndex = -1;
let hasAIResponseAfterLastUser = false;
for (let i = history.length - 1; i >= 0; i--) {
if (history[i].type === MessageType.USER) {
lastUserMessageIndex = i;
break;
}
}
// Check if there's any AI response (GEMINI message) after the last user message
if (lastUserMessageIndex !== -1) {
for (let i = lastUserMessageIndex + 1; i < history.length; i++) {
if (history[i].type === MessageType.GEMINI) {
hasAIResponseAfterLastUser = true;
break;
}
}
}
const hasAIResponseAfterLastUser =
hasAIResponseAfterLastUserMessage(history);
const sessionDurationMs =
Date.now() - sessionStats.sessionStartTime.getTime();
@ -105,14 +114,13 @@ export const useFeedbackDialog = ({
// 4. Session duration > 10 seconds (meaningful interaction)
// 5. Not already shown for this session
// 6. Random chance (25% probability)
// Note: We check !isFeedbackDialogOpen to ensure it's not already open
if (
config.getUsageStatisticsEnabled() && // Only show if telemetry is enabled
settings.merged.ui?.enableUserFeedback !== false && // Default to true if not set
hasAIResponseAfterLastUser &&
sessionDurationMs > 10000 && // 10 seconds minimum for meaningful interaction
!feedbackShownForSession &&
Math.random() < 0.25 // 25% probability
Math.random() < FEEDBACK_SHOW_PROBABILITY
) {
timeoutId = setTimeout(() => {
openFeedbackDialog();