feat(editor): AI assistant UX improvements (no-changelog) (#10568)

This commit is contained in:
Milorad FIlipović
2024-09-03 10:43:24 +02:00
committed by GitHub
parent 5eba534319
commit d92374b5c6
20 changed files with 511 additions and 53 deletions

View File

@@ -16,6 +16,8 @@ const user = computed(() => ({
lastName: usersStore.currentUser?.lastName ?? '',
}));
const loadingMessage = computed(() => assistantStore.assistantThinkingMessage);
function onResize(data: { direction: string; x: number; width: number }) {
assistantStore.updateWindowWidth(data.width);
}
@@ -24,7 +26,7 @@ function onResizeDebounced(data: { direction: string; x: number; width: number }
void useDebounce().callDebounced(onResize, { debounceTime: 10, trailing: true }, data);
}
async function onUserMessage(content: string, quickReplyType?: string) {
async function onUserMessage(content: string, quickReplyType?: string, isFeedback = false) {
await assistantStore.sendMessage({ text: content, quickReplyType });
const task = 'error';
const solutionCount =
@@ -33,9 +35,10 @@ async function onUserMessage(content: string, quickReplyType?: string) {
(msg) => msg.role === 'assistant' && !['text', 'event'].includes(msg.type),
).length
: null;
if (quickReplyType === 'all-good' || quickReplyType === 'still-stuck') {
if (isFeedback) {
telemetry.track('User gave feedback', {
task,
chat_session_id: assistantStore.currentSessionId,
is_quick_reply: !!quickReplyType,
is_positive: quickReplyType === 'all-good',
solution_count: solutionCount,
@@ -83,6 +86,8 @@ function onClose() {
:user="user"
:messages="assistantStore.chatMessages"
:streaming="assistantStore.streaming"
:loading-message="loadingMessage"
:session-id="assistantStore.currentSessionId"
@close="onClose"
@message="onUserMessage"
@code-replace="onCodeReplace"