feat: implement knowledge search feature with enhanced configuration and UI
- Updated `config.yaml` to adjust conversation parameters for improved search performance. - Added a new `knowledgeSemanticSearch` API function for semantic search capabilities. - Introduced new SVG icons for search functionality. - Created `KnowledgeSearch.vue` component for the search interface, including query input and result display. - Enhanced menu and routing to support navigation to the new knowledge search page. - Updated internationalization files to include translations for the knowledge search feature. This update provides users with a powerful tool to perform semantic searches across knowledge bases, improving content discoverability.
This commit is contained in:
@@ -18,6 +18,7 @@ const createMenuChildren = () => reactive<MenuChild[]>([])
|
||||
export const useMenuStore = defineStore('menuStore', () => {
|
||||
const menuArr = reactive<MenuItem[]>([
|
||||
{ title: '', titleKey: 'menu.knowledgeBase', icon: 'zhishiku', path: 'knowledge-bases' },
|
||||
{ title: '', titleKey: 'menu.knowledgeSearch', icon: 'search', path: 'knowledge-search' },
|
||||
{ title: '', titleKey: 'menu.agents', icon: 'agent', path: 'agents' },
|
||||
{ title: '', titleKey: 'menu.organizations', icon: 'organization', path: 'organizations' },
|
||||
{
|
||||
@@ -36,6 +37,7 @@ export const useMenuStore = defineStore('menuStore', () => {
|
||||
const firstQuery = ref('')
|
||||
const firstMentionedItems = ref<any[]>([])
|
||||
const firstModelId = ref('')
|
||||
const prefillQuery = ref('')
|
||||
|
||||
const applyMenuTranslations = () => {
|
||||
menuArr.forEach(item => {
|
||||
@@ -54,15 +56,17 @@ export const useMenuStore = defineStore('menuStore', () => {
|
||||
}
|
||||
)
|
||||
|
||||
const chatMenuIndex = menuArr.findIndex(item => item.path === 'creatChat')
|
||||
|
||||
const clearMenuArr = () => {
|
||||
const chatMenu = menuArr[3]
|
||||
const chatMenu = menuArr[chatMenuIndex]
|
||||
if (chatMenu && chatMenu.children) {
|
||||
chatMenu.children = createMenuChildren()
|
||||
}
|
||||
}
|
||||
|
||||
const updatemenuArr = (obj: any) => {
|
||||
const chatMenu = menuArr[3]
|
||||
const chatMenu = menuArr[chatMenuIndex]
|
||||
if (!chatMenu.children) {
|
||||
chatMenu.children = createMenuChildren()
|
||||
}
|
||||
@@ -73,7 +77,7 @@ export const useMenuStore = defineStore('menuStore', () => {
|
||||
}
|
||||
|
||||
const updataMenuChildren = (item: MenuChild) => {
|
||||
const chatMenu = menuArr[3]
|
||||
const chatMenu = menuArr[chatMenuIndex]
|
||||
if (!chatMenu.children) {
|
||||
chatMenu.children = createMenuChildren()
|
||||
}
|
||||
@@ -81,7 +85,7 @@ export const useMenuStore = defineStore('menuStore', () => {
|
||||
}
|
||||
|
||||
const updatasessionTitle = (sessionId: string, title: string) => {
|
||||
const chatMenu = menuArr[3]
|
||||
const chatMenu = menuArr[chatMenuIndex]
|
||||
chatMenu.children?.forEach((item: MenuChild) => {
|
||||
if (item.id === sessionId) {
|
||||
item.title = title
|
||||
@@ -100,17 +104,30 @@ export const useMenuStore = defineStore('menuStore', () => {
|
||||
firstModelId.value = modelId
|
||||
}
|
||||
|
||||
const setPrefillQuery = (q: string) => {
|
||||
prefillQuery.value = q
|
||||
}
|
||||
|
||||
const consumePrefillQuery = () => {
|
||||
const q = prefillQuery.value
|
||||
prefillQuery.value = ''
|
||||
return q
|
||||
}
|
||||
|
||||
return {
|
||||
menuArr,
|
||||
isFirstSession,
|
||||
firstQuery,
|
||||
firstMentionedItems,
|
||||
firstModelId,
|
||||
prefillQuery,
|
||||
clearMenuArr,
|
||||
updatemenuArr,
|
||||
updataMenuChildren,
|
||||
updatasessionTitle,
|
||||
changeIsFirstSession,
|
||||
changeFirstQuery
|
||||
changeFirstQuery,
|
||||
setPrefillQuery,
|
||||
consumePrefillQuery
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user