feat: remove search rerank
This commit is contained in:
@@ -46,8 +46,6 @@ const props = defineProps<{
|
||||
|
||||
const searchConfig = ref({
|
||||
enabled: props.agent?.config?.search?.enabled ?? false,
|
||||
maxResults: props.agent?.config?.search?.maxResults ?? 10,
|
||||
rerank: props.agent?.config?.search?.rerank ?? false,
|
||||
});
|
||||
|
||||
const toolsConfig = ref({
|
||||
@@ -57,8 +55,6 @@ const toolsConfig = ref({
|
||||
watch(() => props.agent?.config?.search, (val) => {
|
||||
searchConfig.value = {
|
||||
enabled: val?.enabled ?? false,
|
||||
maxResults: val?.maxResults ?? 10,
|
||||
rerank: val?.rerank ?? false,
|
||||
};
|
||||
}, { deep: true });
|
||||
|
||||
@@ -79,8 +75,6 @@ const saveAgentConfig = async (partial: {
|
||||
...(partial.search !== undefined ? {
|
||||
search: {
|
||||
enabled: partial.search.enabled,
|
||||
maxResults: partial.search.maxResults,
|
||||
rerank: partial.search.rerank,
|
||||
},
|
||||
} : {}),
|
||||
...(partial.tools !== undefined ? {
|
||||
@@ -414,10 +408,7 @@ onUnmounted(() => {
|
||||
<ModelSelector v-if="providers !== undefined" :add-hotkey="true" v-model="selectedModel"
|
||||
:providers="providers" />
|
||||
<SearchSelector v-if="selectedModel?.capabilities.includes('tools')" :enabled="searchConfig.enabled"
|
||||
:max-results="searchConfig.maxResults" :rerank="searchConfig.rerank"
|
||||
@update:enabled="(v: boolean) => { searchConfig.enabled = v; saveSearchConfig() }"
|
||||
@update:max-results="(v: number) => { searchConfig.maxResults = v; saveSearchConfig() }"
|
||||
@update:rerank="(v: boolean) => { searchConfig.rerank = v; saveSearchConfig() }" />
|
||||
@update:enabled="(v: boolean) => { searchConfig.enabled = v; saveSearchConfig() }" />
|
||||
<ToolSelector v-if="selectedModel?.capabilities.includes('tools')" :python="toolsConfig.python"
|
||||
@update:python="(v: boolean) => { toolsConfig.python = v; saveToolsConfig() }" />
|
||||
<FileSelector ref="fileSelectorRef" :selected-model="selectedModel" v-model="files" />
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
getFaviconUrl,
|
||||
parseToolValue,
|
||||
readSearchSources,
|
||||
readSearchWarnings,
|
||||
} from "~/utils/tool-rendering";
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -19,7 +20,10 @@ const emit = defineEmits<{
|
||||
retry: [];
|
||||
}>();
|
||||
|
||||
const sources = computed(() => readSearchSources(parseToolValue(props.toolCall.output)));
|
||||
const output = computed(() => parseToolValue(props.toolCall.output));
|
||||
const sources = computed(() => readSearchSources(output.value));
|
||||
const warnings = computed(() => readSearchWarnings(output.value));
|
||||
const warningSummary = computed(() => warnings.value.map(warning => `${warning.engine}: ${warning.reason}`).join("; "));
|
||||
|
||||
const query = computed(() => {
|
||||
const input = parseToolValue(props.toolCall.input);
|
||||
@@ -103,6 +107,17 @@ const customTab = computed(() => {
|
||||
@retry="emit('retry')"
|
||||
>
|
||||
<template #summary>
|
||||
<Tooltip
|
||||
v-if="warnings.length"
|
||||
class="flex items-center text-amber-500 mr-2"
|
||||
:text="`Some search engines failed: ${warningSummary}`"
|
||||
>
|
||||
<span
|
||||
class="i-mynaui-danger-triangle w-4 h-4"
|
||||
role="img"
|
||||
:aria-label="`Some search engines failed: ${warningSummary}`"
|
||||
></span>
|
||||
</Tooltip>
|
||||
<div v-if="topDomains.length && toolCall.status !== 'pending'" class="flex items-center mr-1" aria-hidden="true">
|
||||
<span
|
||||
v-for="(domain, idx) in topDomains"
|
||||
@@ -132,7 +147,11 @@ const customTab = computed(() => {
|
||||
</template>
|
||||
|
||||
<template #sources>
|
||||
<div v-if="sources?.length" class="flex flex-col gap-2 max-h-80 overflow-y-auto scrollbar-thin p-3">
|
||||
<div class="flex flex-col gap-2 max-h-80 overflow-y-auto scrollbar-thin p-3">
|
||||
<p v-if="warnings.length" class="flex items-start gap-2 text-xs text-amber-500 m-0">
|
||||
<span class="i-mynaui-danger-triangle w-4 h-4 shrink-0" aria-hidden="true"></span>
|
||||
<span>Some search engines failed: {{ warningSummary }}</span>
|
||||
</p>
|
||||
<a
|
||||
v-for="source in sources"
|
||||
:key="source.url"
|
||||
@@ -172,10 +191,10 @@ const customTab = computed(() => {
|
||||
{{ source.snippet }}
|
||||
</p>
|
||||
</a>
|
||||
<p v-if="!sources?.length" class="text-xs text-[var(--text-tertiary)] m-0">
|
||||
{{ toolCall.status === "pending" ? "Waiting for results…" : "No usable sources returned." }}
|
||||
</p>
|
||||
</div>
|
||||
<p v-else class="text-xs text-[var(--text-tertiary)] p-3 m-0">
|
||||
{{ toolCall.status === "pending" ? "Waiting for results…" : "No usable sources returned." }}
|
||||
</p>
|
||||
</template>
|
||||
</Disclosure>
|
||||
</template>
|
||||
|
||||
@@ -1,39 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { DialogType } from '~/composables/useDialog';
|
||||
|
||||
const { openDialog } = await useDialog();
|
||||
|
||||
const props = defineProps<{
|
||||
enabled: boolean;
|
||||
maxResults: number;
|
||||
rerank: boolean;
|
||||
}>();
|
||||
defineProps<{ enabled: boolean }>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:enabled': [value: boolean];
|
||||
'update:maxResults': [value: number];
|
||||
'update:rerank': [value: boolean];
|
||||
}>();
|
||||
|
||||
const adjustMaxResults = (delta: number) => {
|
||||
const next = Math.min(50, Math.max(1, props.maxResults + delta));
|
||||
emit('update:maxResults', next);
|
||||
};
|
||||
|
||||
const { settings } = await useUserSettings();
|
||||
|
||||
const systemAssistantsRerank = computed(() => {
|
||||
return settings.value.systemAssistants?.rerank ?? null;
|
||||
});
|
||||
|
||||
const isRerankConfigured = computed(() => {
|
||||
const sa = systemAssistantsRerank.value;
|
||||
return sa?.enabled === true && sa?.modelId != null && sa.modelId !== '';
|
||||
});
|
||||
|
||||
const openSettings = () => {
|
||||
openDialog(DialogType.Settings, undefined, { page: 'systemAssistants' });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -46,10 +16,8 @@ const openSettings = () => {
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<template #dropdown="{ close }">
|
||||
<div class="flex p-1 gap-4">
|
||||
<!-- Left: mode toggle group -->
|
||||
<div class="flex flex-col gap-1">
|
||||
<template #dropdown>
|
||||
<div class="flex flex-col gap-1 p-1">
|
||||
<button @click="emit('update:enabled', false)"
|
||||
class="flex items-start gap-3 rounded-xl px-3 py-2.5 text-left transition-colors duration-150"
|
||||
:class="!enabled
|
||||
@@ -87,53 +55,6 @@ const openSettings = () => {
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Right: settings (only when enabled) -->
|
||||
<div v-if="enabled" class="flex flex-col gap-3 border-l border-[var(--color-border)] pl-4">
|
||||
<!-- Max results stepper -->
|
||||
<div class="flex flex-col gap-1.5">
|
||||
<span class="text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider">
|
||||
Max results
|
||||
</span>
|
||||
<div class="flex items-center gap-2">
|
||||
<button @click="adjustMaxResults(-1)"
|
||||
class="h-7 w-7 flex items-center justify-center rounded-lg @hover:bg-[var(--color-hover)] text-[var(--text-secondary)] @hover:text-[var(--text-primary)] transition-colors duration-150">
|
||||
<span class="text-sm i-mynaui-minus"></span>
|
||||
</button>
|
||||
<span class="w-8 text-center text-sm font-medium tabular-nums text-[var(--text-primary)]">
|
||||
{{ maxResults }}
|
||||
</span>
|
||||
<button @click="adjustMaxResults(1)"
|
||||
class="h-7 w-7 flex items-center justify-center rounded-lg @hover:bg-[var(--color-hover)] text-[var(--text-secondary)] @hover:text-[var(--text-primary)] transition-colors duration-150">
|
||||
<span class="text-sm i-mynaui-plus-solid"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Rerank toggle -->
|
||||
<div class="flex flex-col gap-1.5">
|
||||
<span class="text-xs font-medium text-[var(--color-tertiary)] uppercase tracking-wider">
|
||||
Rerank
|
||||
</span>
|
||||
<div v-if="!isRerankConfigured"
|
||||
class="flex items-center gap-2 px-3 py-1.5 rounded-lg bg-[var(--bg-container)] border border-[var(--color-border)]">
|
||||
<button @click="() => { openSettings(); close() }"
|
||||
class="flex items-center gap-2 text-xs text-[var(--text-dim)] hover:text-[var(--text-primary)] transition-colors duration-150">
|
||||
<span class="i-mynaui-sparkles text-3.5"></span>
|
||||
<span>Setup reranking</span>
|
||||
<span class="i-mynaui-arrow-right text-3 ml-auto"></span>
|
||||
</button>
|
||||
</div>
|
||||
<label v-else
|
||||
class="flex items-center gap-2 px-3 py-1.5 rounded-lg bg-[var(--bg-container)] border border-[var(--color-border)] cursor-pointer @hover:border-[var(--color-hover)] transition-colors duration-150">
|
||||
<input type="checkbox" :checked="props.rerank"
|
||||
@change="emit('update:rerank', ($event.target as HTMLInputElement).checked)"
|
||||
class="w-4 h-4 rounded border-[var(--color-border)] bg-transparent text-[var(--color-accent)] focus:ring-[var(--color-accent)] focus:ring-offset-0 cursor-pointer" />
|
||||
<span class="text-xs text-[var(--text-secondary)]">Rerank results</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</Dropdown>
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import type { ModelWithProvider } from '~/composables/useModels';
|
||||
|
||||
const props = defineProps<{
|
||||
params?: string;
|
||||
}>();
|
||||
|
||||
const { providers, allModels } = await useModels();
|
||||
const { settings, updateSettings } = await useUserSettings();
|
||||
|
||||
const toggle = async (key: string) => {
|
||||
const current = (settings.value.systemAssistants as any)[key];
|
||||
const toggle = async () => {
|
||||
const current = settings.value.systemAssistants.rename;
|
||||
await updateSettings({
|
||||
systemAssistants: {
|
||||
[key]: {
|
||||
rename: {
|
||||
...current,
|
||||
enabled: !current.enabled
|
||||
}
|
||||
@@ -20,11 +16,11 @@ const toggle = async (key: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
const updateModel = async (key: string, model: ModelWithProvider | undefined | null) => {
|
||||
const current = (settings.value.systemAssistants as any)[key];
|
||||
const updateModel = async (model: ModelWithProvider | undefined | null) => {
|
||||
const current = settings.value.systemAssistants.rename;
|
||||
await updateSettings({
|
||||
systemAssistants: {
|
||||
[key]: {
|
||||
rename: {
|
||||
...current,
|
||||
modelId: model?.id ?? null
|
||||
}
|
||||
@@ -44,15 +40,15 @@ defineEmits(['navigate']);
|
||||
<template>
|
||||
<div
|
||||
class="flex flex-col gap-4 py-4 flex-grow overflow-auto [scrollbar-width:thin] [scrollbar-color:#888_transparent] [scrollbar-gutter:stable]">
|
||||
<div class="flex flex-col" v-for="(systemAssistant, key) in settings.systemAssistants" :key="key">
|
||||
<label :for="`slider-${key}`" class="flex justify-between gap-4 items-center">
|
||||
<h4 class="case-capital">{{ key }}</h4>
|
||||
<Slider :id="`slider-${key}`" :checked="systemAssistant?.enabled ?? false"
|
||||
@click="toggle(String(key))" />
|
||||
<div class="flex flex-col">
|
||||
<label for="slider-rename" class="flex justify-between gap-4 items-center">
|
||||
<h4 class="case-capital">Rename</h4>
|
||||
<Slider id="slider-rename" :checked="settings.systemAssistants.rename?.enabled ?? false"
|
||||
@click="toggle" />
|
||||
</label>
|
||||
<div class="flex-1 justify-between gap-4 items-center">
|
||||
<ModelSelector :providers="providers" :model-value="getModel(systemAssistant?.modelId)"
|
||||
@update:model-value="(model) => updateModel(String(key), model)" />
|
||||
<ModelSelector :providers="providers" :model-value="getModel(settings.systemAssistants.rename?.modelId)"
|
||||
@update:model-value="updateModel" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
const props = defineProps<{
|
||||
hotkey?: string[];
|
||||
text?: string;
|
||||
}>();
|
||||
|
||||
const { show, hide } = useTooltip();
|
||||
@@ -14,7 +15,7 @@ onMounted(() => {
|
||||
|
||||
const onMouseEnter = () => {
|
||||
if (triggerRef.value && hasCursor.value) {
|
||||
show(triggerRef.value, props.hotkey);
|
||||
show(triggerRef.value, props.hotkey, props.text);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { useFloating, offset, flip, shift, autoUpdate, hide } from '@floating-ui/vue';
|
||||
|
||||
const { activeElement, activeHotkey, isVisible } = useTooltip();
|
||||
const { activeElement, activeHotkey, activeText, isVisible } = useTooltip();
|
||||
|
||||
const tooltipRef = ref<HTMLElement | null>(null);
|
||||
|
||||
@@ -61,7 +61,8 @@ const transformOrigin = computed(() => placement.value.includes('top') ? 'transf
|
||||
}
|
||||
]" :class="transformOrigin"
|
||||
class="pointer-events-none fixed z-35 flex flex-col bg-[var(--bg-surface)] rounded-lg shadow-xl px-1.5 py-1 text-xs">
|
||||
<div class="flex gap-1 items-center">
|
||||
<span v-if="activeText" class="max-w-xs whitespace-normal">{{ activeText }}</span>
|
||||
<div v-if="displayHotkey?.length" class="flex gap-1 items-center">
|
||||
<span v-for="key in displayHotkey" :key="key"
|
||||
class="bg-[var(--bg-container)] px-1 rounded border border-[var(--color-border)]">
|
||||
<kbd class="font-mono text-[10px] case-capital">{{ key }}</kbd>
|
||||
|
||||
Reference in New Issue
Block a user