feat: Enhance embedding model validation by incorporating simple internet search check
This commit is contained in:
parent
94af788365
commit
0c48bfa1c0
@ -15,6 +15,7 @@ import { KnowledgeSelect } from "../Knowledge/KnowledgeSelect"
|
|||||||
import { useSpeechRecognition } from "@/hooks/useSpeechRecognition"
|
import { useSpeechRecognition } from "@/hooks/useSpeechRecognition"
|
||||||
import { PiGlobe } from "react-icons/pi"
|
import { PiGlobe } from "react-icons/pi"
|
||||||
import { handleChatInputKeyDown } from "@/utils/key-down"
|
import { handleChatInputKeyDown } from "@/utils/key-down"
|
||||||
|
import { getIsSimpleInternetSearch } from "@/services/search"
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
dropedFile: File | undefined
|
dropedFile: File | undefined
|
||||||
@ -181,7 +182,8 @@ export const PlaygroundForm = ({ dropedFile }: Props) => {
|
|||||||
}
|
}
|
||||||
if (webSearch) {
|
if (webSearch) {
|
||||||
const defaultEM = await defaultEmbeddingModelForRag()
|
const defaultEM = await defaultEmbeddingModelForRag()
|
||||||
if (!defaultEM) {
|
const simpleSearch = await getIsSimpleInternetSearch()
|
||||||
|
if (!defaultEM && !simpleSearch) {
|
||||||
form.setFieldError("message", t("formError.noEmbeddingModel"))
|
form.setFieldError("message", t("formError.noEmbeddingModel"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import { ModelSelect } from "@/components/Common/ModelSelect"
|
|||||||
import { useSpeechRecognition } from "@/hooks/useSpeechRecognition"
|
import { useSpeechRecognition } from "@/hooks/useSpeechRecognition"
|
||||||
import { PiGlobeX, PiGlobe } from "react-icons/pi"
|
import { PiGlobeX, PiGlobe } from "react-icons/pi"
|
||||||
import { handleChatInputKeyDown } from "@/utils/key-down"
|
import { handleChatInputKeyDown } from "@/utils/key-down"
|
||||||
|
import { getIsSimpleInternetSearch } from "@/services/search"
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
dropedFile: File | undefined
|
dropedFile: File | undefined
|
||||||
@ -99,7 +100,8 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
|
|||||||
}
|
}
|
||||||
if (webSearch) {
|
if (webSearch) {
|
||||||
const defaultEM = await defaultEmbeddingModelForRag()
|
const defaultEM = await defaultEmbeddingModelForRag()
|
||||||
if (!defaultEM) {
|
const simpleSearch = await getIsSimpleInternetSearch()
|
||||||
|
if (!defaultEM && !simpleSearch) {
|
||||||
form.setFieldError("message", t("formError.noEmbeddingModel"))
|
form.setFieldError("message", t("formError.noEmbeddingModel"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user