mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-05 23:42:03 +00:00
refactor: reorder feedback options and improve dialog feedback timestamp handling
This commit is contained in:
parent
6327e35a14
commit
4c8414488f
2 changed files with 20 additions and 20 deletions
|
|
@ -6,16 +6,16 @@ import { useUIState } from './contexts/UIStateContext.js';
|
|||
import { useKeypress } from './hooks/useKeypress.js';
|
||||
|
||||
export const FEEDBACK_OPTIONS = {
|
||||
BAD: 1,
|
||||
FINE: 2,
|
||||
GOOD: 3,
|
||||
GOOD: 1,
|
||||
BAD: 2,
|
||||
FINE: 3,
|
||||
DISMISS: 0,
|
||||
} as const;
|
||||
|
||||
const FEEDBACK_OPTION_KEYS = {
|
||||
[FEEDBACK_OPTIONS.BAD]: '1',
|
||||
[FEEDBACK_OPTIONS.FINE]: '2',
|
||||
[FEEDBACK_OPTIONS.GOOD]: '3',
|
||||
[FEEDBACK_OPTIONS.GOOD]: '1',
|
||||
[FEEDBACK_OPTIONS.BAD]: '2',
|
||||
[FEEDBACK_OPTIONS.FINE]: '3',
|
||||
[FEEDBACK_OPTIONS.DISMISS]: '0',
|
||||
} as const;
|
||||
|
||||
|
|
@ -51,6 +51,11 @@ export const FeedbackDialog: React.FC = () => {
|
|||
<Text bold>{t('How is Qwen doing this session? (optional)')}</Text>
|
||||
</Box>
|
||||
<Box marginTop={1}>
|
||||
<Text color="cyan">
|
||||
{FEEDBACK_OPTION_KEYS[FEEDBACK_OPTIONS.GOOD]}:{' '}
|
||||
</Text>
|
||||
<Text>{t('Good')}</Text>
|
||||
<Text> </Text>
|
||||
<Text color="cyan">{FEEDBACK_OPTION_KEYS[FEEDBACK_OPTIONS.BAD]}: </Text>
|
||||
<Text>{t('Bad')}</Text>
|
||||
<Text> </Text>
|
||||
|
|
@ -59,11 +64,6 @@ export const FeedbackDialog: React.FC = () => {
|
|||
</Text>
|
||||
<Text>{t('Fine')}</Text>
|
||||
<Text> </Text>
|
||||
<Text color="cyan">
|
||||
{FEEDBACK_OPTION_KEYS[FEEDBACK_OPTIONS.GOOD]}:{' '}
|
||||
</Text>
|
||||
<Text>{t('Good')}</Text>
|
||||
<Text> </Text>
|
||||
<Text color="cyan">
|
||||
{FEEDBACK_OPTION_KEYS[FEEDBACK_OPTIONS.DISMISS]}:{' '}
|
||||
</Text>
|
||||
|
|
|
|||
|
|
@ -116,9 +116,9 @@ export const useFeedbackDialog = ({
|
|||
|
||||
const submitFeedback = useCallback(
|
||||
(rating: number) => {
|
||||
// Only create and log feedback event for ratings 1-3 (BAD, FINE, GOOD)
|
||||
// Only create and log feedback event for ratings 1-3 (GOOD, BAD, FINE)
|
||||
// Rating 0 (DISMISS) should not trigger any telemetry
|
||||
if (rating >= FEEDBACK_OPTIONS.BAD && rating <= FEEDBACK_OPTIONS.GOOD) {
|
||||
if (rating >= FEEDBACK_OPTIONS.GOOD && rating <= FEEDBACK_OPTIONS.FINE) {
|
||||
const feedbackEvent = new UserFeedbackEvent(
|
||||
sessionStats.sessionId,
|
||||
rating as UserFeedbackRating,
|
||||
|
|
@ -127,15 +127,15 @@ export const useFeedbackDialog = ({
|
|||
);
|
||||
|
||||
logUserFeedback(config, feedbackEvent);
|
||||
|
||||
// Record the timestamp when feedback dialog is submitted
|
||||
settings.setValue(
|
||||
SettingScope.User,
|
||||
'ui.feedbackLastShownTimestamp',
|
||||
Date.now(),
|
||||
);
|
||||
}
|
||||
|
||||
// Record the timestamp when feedback dialog is submitted
|
||||
settings.setValue(
|
||||
SettingScope.User,
|
||||
'ui.feedbackLastShownTimestamp',
|
||||
Date.now(),
|
||||
);
|
||||
|
||||
closeFeedbackDialog();
|
||||
},
|
||||
[closeFeedbackDialog, sessionStats.sessionId, config, settings],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue