diff --git a/src/App.vue b/src/App.vue index c00d8cb..aba26d4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,72 +1,73 @@ diff --git a/src/components/Chat/User/ChatUserMessage.vue b/src/components/Chat/User/ChatUserMessage.vue index e2d04fa..90360fa 100644 --- a/src/components/Chat/User/ChatUserMessage.vue +++ b/src/components/Chat/User/ChatUserMessage.vue @@ -1,14 +1,19 @@ diff --git a/src/components/Setting/PanelSettings.vue b/src/components/Setting/PanelSettings.vue new file mode 100644 index 0000000..847d3ed --- /dev/null +++ b/src/components/Setting/PanelSettings.vue @@ -0,0 +1,68 @@ + + + diff --git a/src/components/Setting/SettingMaxResults.vue b/src/components/Setting/SettingMaxResults.vue new file mode 100644 index 0000000..fe4af2a --- /dev/null +++ b/src/components/Setting/SettingMaxResults.vue @@ -0,0 +1,16 @@ + + + diff --git a/src/components/Setting/SettingScoreThreshold.vue b/src/components/Setting/SettingScoreThreshold.vue new file mode 100644 index 0000000..d2e801c --- /dev/null +++ b/src/components/Setting/SettingScoreThreshold.vue @@ -0,0 +1,17 @@ + + + diff --git a/src/directives/betweenNumbers.ts b/src/directives/betweenNumbers.ts new file mode 100644 index 0000000..aefa41e --- /dev/null +++ b/src/directives/betweenNumbers.ts @@ -0,0 +1,24 @@ +import { Directive } from 'vue' + +export const vBetweenNumbers: Directive = { + mounted: (el, binding, vnode) => { + const [min, max] = binding.value + + el.handler = () => { + const { value } = el + + if (value < min) { + el.value = min + vnode.el.dispatchEvent(new CustomEvent('input')) + } else if (value > max) { + el.value = max + vnode.el.dispatchEvent(new CustomEvent('input')) + } + } + + el.addEventListener('change', el.handler) + }, + unmounted: (el) => { + el.removeEventListener('change', el.handler) + } +} diff --git a/src/directives/index.ts b/src/directives/index.ts new file mode 100644 index 0000000..60f1438 --- /dev/null +++ b/src/directives/index.ts @@ -0,0 +1 @@ +export * from './betweenNumbers' diff --git a/src/store/index.ts b/src/store/index.ts new file mode 100644 index 0000000..eca32dd --- /dev/null +++ b/src/store/index.ts @@ -0,0 +1 @@ +export * from './settings' diff --git a/src/store/settings.ts b/src/store/settings.ts new file mode 100644 index 0000000..b100ab3 --- /dev/null +++ b/src/store/settings.ts @@ -0,0 +1,31 @@ +import { reactive, toRefs } from 'vue' + +type RequestParameters = { + maxResults: number + scoreThreshold: number +} + +type State = { + keepChat: boolean + referenceExpanded: boolean + openSettings: boolean + referencePreformattedText: boolean + parameters: RequestParameters +} + +const state = reactive({ + keepChat: false, + openSettings: true, + referenceExpanded: true, + referencePreformattedText: true, + parameters: { + scoreThreshold: 0.65, + maxResults: 5 + } +}) + +export function useSettings() { + return { + ...toRefs(state) + } +} diff --git a/src/types/BHLQuestMessage.ts b/src/types/BHLQuestMessage.ts index 370fd0a..25feee5 100644 --- a/src/types/BHLQuestMessage.ts +++ b/src/types/BHLQuestMessage.ts @@ -6,7 +6,12 @@ export type BHLQuestMessageReference = { title: string pageIndex: number pageId: number - pages: number[] + pages: Page[] +} + +type Page = { + id: number + pageNumber: number } export type BHLQuestMessage = ChatMessage & { diff --git a/src/types/BHLQuestResponse.ts b/src/types/BHLQuestResponse.ts index be5d864..c5dadec 100644 --- a/src/types/BHLQuestResponse.ts +++ b/src/types/BHLQuestResponse.ts @@ -12,12 +12,17 @@ type Metadata = { version: string } +type Page = { + id: number + pageSeq: number +} + type Result = { chunkId: number itemId: number pageId: number pageIndex: number - pages: number[] + pages: Page[] score: number crossScore: number outlink: string diff --git a/tailwind.config.js b/tailwind.config.js index dde2faf..7994138 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -16,11 +16,11 @@ export default { fontFamily: { main: [ 'Inter', - 'system - ui', + 'system-ui', 'Avenir', 'Helvetica', 'Arial', - 'sans - serif' + 'sans-serif' ] }, colors: { @@ -32,6 +32,11 @@ export default { primary: { color: withOpacity('--primary-color'), text: withOpacity('--primary-text-color') + }, + + secondary: { + color: withOpacity('--secondary-color'), + text: withOpacity('--secondary-text-color') } } } diff --git a/tsconfig.json b/tsconfig.json index 460b82b..1165868 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "target": "ES2020", "useDefineForClassFields": true, "module": "ESNext", - "lib": ["ES2020", "DOM", "DOM.Iterable"], + "lib": ["ES2023", "DOM", "DOM.Iterable"], "skipLibCheck": true, /* Bundler mode */