Skip to content

Conversation

@kejsibushi20
Copy link
Collaborator

JSON structure + apply filters button

@danieleguido danieleguido force-pushed the feature/barista-on-stage branch from a6a3fd2 to b2b9c4f Compare October 29, 2025 12:48
Refactored filter extraction logic in barista.ts by introducing getSearchFilters and updating getSearchFiltersAsBase64 to use it. Improved BaristaModal to allow editing and applying filters interactively, added SearchPills, and enhanced the results display. Simplified FilterMonitor entity suggester button layout for better UI consistency.
@danieleguido danieleguido requested a review from Copilot October 29, 2025 14:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the Barista chat interface to use a modal-based UI instead of a floating popup, extracts filter parsing logic into a reusable function, and modernizes styling with Bootstrap utilities.

Key changes:

  • Introduced getSearchFilters() function to extract and return raw filter arrays from Barista responses
  • Created new BaristaModal.vue component using Composition API for displaying chat and filter results side-by-side
  • Refactored styling to use Bootstrap utilities and CSS custom properties instead of custom CSS

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/services/types/barista.ts Exported previously internal interfaces and added getSearchFilters() helper function for extracting raw filters
src/components/barista/BaristaModal.vue New modal component implementing chat interface with filter preview/application using Composition API
src/components/barista/BaristaChatPanel.vue Updated styling to use Bootstrap utilities and removed custom CSS for chat input
src/components/barista/BaristaChat.vue Refactored to emit stringified filters and display filter confirmation messages
src/components/barista/BaristaButton.vue Replaced floating popup with BaristaModal component
src/components/modules/FilterMonitor.vue Simplified button layout and added missing translation key

Comment on lines +68 to +83
// const filtersToolCalls =
// kwargs.tool_calls?.filter?.(
// tool_call => tool_call.type === 'function' && tool_call.function.name === 'Filters'
// ) ?? []

// if (filtersToolCalls.length > 0) {
// try {
// const searchFilters = getSearchFilters(JSON.parse(filtersToolCalls[0].function.arguments))const serializedFilters = toSerializedFilters
// const serializedFilters = toSerializedFilters(searchFilters['filters'])
// return serializedFilters
// } catch (error) {
// console.error('Error parsing search filters:', error)
// return undefined
// }
// }
// return undefined
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented-out code from lines 68-83. This appears to be old implementation that was replaced by the new logic.

Suggested change
// const filtersToolCalls =
// kwargs.tool_calls?.filter?.(
// tool_call => tool_call.type === 'function' && tool_call.function.name === 'Filters'
// ) ?? []
// if (filtersToolCalls.length > 0) {
// try {
// const searchFilters = getSearchFilters(JSON.parse(filtersToolCalls[0].function.arguments))const serializedFilters = toSerializedFilters
// const serializedFilters = toSerializedFilters(searchFilters['filters'])
// return serializedFilters
// } catch (error) {
// console.error('Error parsing search filters:', error)
// return undefined
// }
// }
// return undefined

Copilot uses AI. Check for mistakes.

// if (filtersToolCalls.length > 0) {
// try {
// const searchFilters = getSearchFilters(JSON.parse(filtersToolCalls[0].function.arguments))const serializedFilters = toSerializedFilters
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 75 contains malformed commented code with two statements concatenated on the same line without proper separation. If this code were uncommented, it would cause a syntax error.

Suggested change
// const searchFilters = getSearchFilters(JSON.parse(filtersToolCalls[0].function.arguments))const serializedFilters = toSerializedFilters
// const searchFilters = getSearchFilters(JSON.parse(filtersToolCalls[0].function.arguments))

Copilot uses AI. Check for mistakes.
>

export const getSearchFiltersAsBase64 = (kwargs: AdditionalKwargs): string | undefined => {
export const getSearchFilters = (kwargs: AdditionalKwargs): any[] => {
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return type any[] is too generic. Consider defining a specific interface for filter objects to improve type safety and make the API contract clearer.

Copilot uses AI. Check for mistakes.

<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { getSearchFilters, getSearchFiltersAsBase64 } from '@/services/types/barista'
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getSearchFiltersAsBase64 is imported but never used in this component. Remove the unused import.

Suggested change
import { getSearchFilters, getSearchFiltersAsBase64 } from '@/services/types/barista'
import { getSearchFilters } from '@/services/types/barista'

Copilot uses AI. Check for mistakes.
}
})
const searchFilters = ref([])
const handleFiltersChanged = (newFilters: any) => {
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameter type any should be replaced with a more specific type. Consider defining an interface for filter objects or using the return type from getSearchFilters().

Suggested change
const handleFiltersChanged = (newFilters: any) => {
const handleFiltersChanged = (newFilters: ReturnType<typeof getSearchFilters>) => {

Copilot uses AI. Check for mistakes.
const isChatOpen = ref(false)
const chatPopup = ref<HTMLElement | null>(null)
const showModal = ref(true)
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable showModal is defined but never used in the component. Consider removing it.

Suggested change
const showModal = ref(true)

Copilot uses AI. Check for mistakes.
Comment on lines +65 to +68
// const handleSearch = (searchFilters: string) => {
// // Emit the search event so parent components can listen
// emit('search', searchFilters)
// }
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented-out handleSearch function. It has been replaced by handleApplyFilters.

Suggested change
// const handleSearch = (searchFilters: string) => {
// // Emit the search event so parent components can listen
// emit('search', searchFilters)
// }

Copilot uses AI. Check for mistakes.
}
// Handler for sending messages
// Handles user input + Barista response
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment has inconsistent spacing. Should be // Handles user input + Barista response with a space after //.

Suggested change
// Handles user input + Barista response
// Handles user input + Barista response

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants