feat: Enhance embedding model validation by incorporating simple internet search check

This commit is contained in:
n4ze3m 2025-01-26 18:36:28 +05:30
parent 94af788365
commit 0c48bfa1c0
2 changed files with 6 additions and 2 deletions

View File

@ -15,6 +15,7 @@ import { KnowledgeSelect } from "../Knowledge/KnowledgeSelect"
import { useSpeechRecognition } from "@/hooks/useSpeechRecognition"
import { PiGlobe } from "react-icons/pi"
import { handleChatInputKeyDown } from "@/utils/key-down"
import { getIsSimpleInternetSearch } from "@/services/search"
type Props = {
dropedFile: File | undefined
@ -181,7 +182,8 @@ export const PlaygroundForm = ({ dropedFile }: Props) => {
}
if (webSearch) {
const defaultEM = await defaultEmbeddingModelForRag()
if (!defaultEM) {
const simpleSearch = await getIsSimpleInternetSearch()
if (!defaultEM && !simpleSearch) {
form.setFieldError("message", t("formError.noEmbeddingModel"))
return
}

View File

@ -20,6 +20,7 @@ import { ModelSelect } from "@/components/Common/ModelSelect"
import { useSpeechRecognition } from "@/hooks/useSpeechRecognition"
import { PiGlobeX, PiGlobe } from "react-icons/pi"
import { handleChatInputKeyDown } from "@/utils/key-down"
import { getIsSimpleInternetSearch } from "@/services/search"
type Props = {
dropedFile: File | undefined
@ -99,7 +100,8 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
}
if (webSearch) {
const defaultEM = await defaultEmbeddingModelForRag()
if (!defaultEM) {
const simpleSearch = await getIsSimpleInternetSearch()
if (!defaultEM && !simpleSearch) {
form.setFieldError("message", t("formError.noEmbeddingModel"))
return
}