mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-13 04:45:19 +00:00
chore(ask_sb): Allow for multiple user feedback (#395)
This commit is contained in:
parent
4e34406386
commit
efc9656b6e
5 changed files with 23 additions and 23 deletions
|
|
@ -7,12 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
- Fixed onboarding infinite loop when GCP IAP Auth is enabled. [#381](https://github.com/sourcebot-dev/sourcebot/pull/381)
|
||||
|
||||
### Added
|
||||
- Introducing Ask Sourcebot - ask natural langauge about your codebase. Get back comprehensive Markdown responses with inline citations back to the code. Bring your own LLM api key. [#392](https://github.com/sourcebot-dev/sourcebot/pull/392)
|
||||
|
||||
### Fixed
|
||||
- Fixed onboarding infinite loop when GCP IAP Auth is enabled. [#381](https://github.com/sourcebot-dev/sourcebot/pull/381)
|
||||
|
||||
## [4.5.3] - 2025-07-20
|
||||
|
||||
### Changed
|
||||
|
|
|
|||
|
|
@ -212,14 +212,14 @@ export const deleteChat = async ({ chatId }: { chatId: string }, domain: string)
|
|||
)
|
||||
);
|
||||
|
||||
export const submitFeedback = async ({
|
||||
chatId,
|
||||
messageId,
|
||||
feedbackType
|
||||
}: {
|
||||
chatId: string,
|
||||
messageId: string,
|
||||
feedbackType: 'like' | 'dislike'
|
||||
export const submitFeedback = async ({
|
||||
chatId,
|
||||
messageId,
|
||||
feedbackType
|
||||
}: {
|
||||
chatId: string,
|
||||
messageId: string,
|
||||
feedbackType: 'like' | 'dislike'
|
||||
}, domain: string) => sew(() =>
|
||||
withAuth((userId) =>
|
||||
withOrgMembership(userId, domain, async ({ org }) => {
|
||||
|
|
@ -246,13 +246,16 @@ export const submitFeedback = async ({
|
|||
...message,
|
||||
metadata: {
|
||||
...message.metadata,
|
||||
feedback: {
|
||||
type: feedbackType,
|
||||
timestamp: new Date().toISOString(),
|
||||
userId: userId,
|
||||
}
|
||||
feedback: [
|
||||
...(message.metadata?.feedback ?? []),
|
||||
{
|
||||
type: feedbackType,
|
||||
timestamp: new Date().toISOString(),
|
||||
userId: userId,
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
} satisfies SBChatMessage;
|
||||
}
|
||||
return message;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ interface AnswerCardProps {
|
|||
answerText: string;
|
||||
messageId: string;
|
||||
chatId: string;
|
||||
feedback?: 'like' | 'dislike' | undefined;
|
||||
traceId?: string;
|
||||
}
|
||||
|
||||
|
|
@ -36,7 +35,6 @@ export const AnswerCard = forwardRef<HTMLDivElement, AnswerCardProps>(({
|
|||
answerText,
|
||||
messageId,
|
||||
chatId,
|
||||
feedback: _feedback,
|
||||
traceId,
|
||||
}, forwardedRef) => {
|
||||
const markdownRendererRef = useRef<HTMLDivElement>(null);
|
||||
|
|
@ -45,7 +43,7 @@ export const AnswerCard = forwardRef<HTMLDivElement, AnswerCardProps>(({
|
|||
const { toast } = useToast();
|
||||
const domain = useDomain();
|
||||
const [isSubmittingFeedback, setIsSubmittingFeedback] = useState(false);
|
||||
const [feedback, setFeedback] = useState<'like' | 'dislike' | undefined>(_feedback);
|
||||
const [feedback, setFeedback] = useState<'like' | 'dislike' | undefined>(undefined);
|
||||
const captureEvent = useCaptureEvent();
|
||||
|
||||
useImperativeHandle(
|
||||
|
|
|
|||
|
|
@ -409,7 +409,6 @@ export const ChatThreadListItem = forwardRef<HTMLDivElement, ChatThreadListItemP
|
|||
answerText={answerPart.text.replace(ANSWER_TAG, '').trim()}
|
||||
chatId={chatId}
|
||||
messageId={assistantMessage.id}
|
||||
feedback={messageMetadata?.feedback?.type}
|
||||
traceId={messageMetadata?.traceId}
|
||||
/>
|
||||
) : !isStreaming && (
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ export const sbChatMessageMetadataSchema = z.object({
|
|||
totalOutputTokens: z.number().optional(),
|
||||
totalTokens: z.number().optional(),
|
||||
totalResponseTimeMs: z.number().optional(),
|
||||
feedback: z.object({
|
||||
feedback: z.array(z.object({
|
||||
type: z.enum(['like', 'dislike']),
|
||||
timestamp: z.string(), // ISO date string
|
||||
userId: z.string(),
|
||||
}).optional(),
|
||||
})).optional(),
|
||||
selectedRepos: z.array(z.string()).optional(),
|
||||
traceId: z.string().optional(),
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue