feat: Add localization support for visitSpecificWebsite label
This commit adds localization support for the "visitSpecificWebsite" label in the settings.json file for multiple languages. Now, the label can be translated into different languages, including Japanese, Chinese, English, Malayalam, Italian, Portuguese, Russian, French, and Spanish.
This commit is contained in:
parent
d23b70b979
commit
4363a4b0de
@ -37,6 +37,9 @@
|
||||
"totalSearchResults": {
|
||||
"label": "Total Search Results",
|
||||
"placeholder": "Enter Total Search Results"
|
||||
},
|
||||
"visitSpecificWebsite": {
|
||||
"label": "Visit the website mentioned in the message"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -37,6 +37,9 @@
|
||||
"totalSearchResults": {
|
||||
"label": "Resultados totales de la busqueda",
|
||||
"placeholder": "Ingresar el total de Resultados de la busqueda"
|
||||
},
|
||||
"visitSpecificWebsite": {
|
||||
"label": "Visita el sitio web mencionado en el mensaje"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -37,6 +37,9 @@
|
||||
"totalSearchResults": {
|
||||
"label": "Résultats de la recherche totaux",
|
||||
"placeholder": "Entrez les résultats de la recherche totaux"
|
||||
},
|
||||
"visitSpecificWebsite": {
|
||||
"label": "Visitez le site web mentionné dans le message"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -37,6 +37,9 @@
|
||||
"totalSearchResults": {
|
||||
"label": "Risultati della ricerca",
|
||||
"placeholder": "Inserisci il totale delle ricerche"
|
||||
},
|
||||
"visitSpecificWebsite": {
|
||||
"label": "Visita il sito web menzionato nel messaggio"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -40,6 +40,9 @@
|
||||
"totalSearchResults": {
|
||||
"label": "合計検索結果",
|
||||
"placeholder": "合計検索結果を入力する"
|
||||
},
|
||||
"visitSpecificWebsite": {
|
||||
"label": "メッセージに記載されたウェブサイトを訪問してください"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -40,6 +40,9 @@
|
||||
"totalSearchResults": {
|
||||
"label": "ആകെ തിരച്ചിൽ ഫലങ്ങൾ",
|
||||
"placeholder": "ആകെ തിരച്ചിൽ ഫലങ്ങളുടെ എണ്ണം നൽകുക"
|
||||
},
|
||||
"visitSpecificWebsite": {
|
||||
"label": "സന്ദേശത്തിൽ പറയുന്ന വെബ്സൈറ്റ് സന്ദർശിക്കുക."
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -37,6 +37,9 @@
|
||||
"totalSearchResults": {
|
||||
"label": "Resultados de Pesquisa Totais",
|
||||
"placeholder": "Insira Resultados de Pesquisa Totais"
|
||||
},
|
||||
"visitSpecificWebsite": {
|
||||
"label": "Visite o site mencionado na mensagem."
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -37,6 +37,9 @@
|
||||
"totalSearchResults": {
|
||||
"label": "Общее количество результатов поиска",
|
||||
"placeholder": "Введите общее количество результатов поиска"
|
||||
},
|
||||
"visitSpecificWebsite": {
|
||||
"label": "Посетите веб-сайт, указанный в сообщении."
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -40,6 +40,9 @@
|
||||
"totalSearchResults": {
|
||||
"label": "总搜索结果",
|
||||
"placeholder": "输入总搜索结果"
|
||||
},
|
||||
"visitSpecificWebsite": {
|
||||
"label": "访问消息中提到的网站。"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -13,7 +13,8 @@ export const SearchModeSettings = () => {
|
||||
initialValues: {
|
||||
isSimpleInternetSearch: false,
|
||||
searchProvider: "",
|
||||
totalSearchResults: 0
|
||||
totalSearchResults: 0,
|
||||
visitSpecificWebsite: false
|
||||
}
|
||||
})
|
||||
|
||||
@ -89,6 +90,20 @@ export const SearchModeSettings = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex sm:flex-row flex-col space-y-4 sm:space-y-0 sm:justify-between">
|
||||
<span className="text-gray-700 dark:text-neutral-50 ">
|
||||
{t("generalSettings.webSearch.visitSpecificWebsite.label")}
|
||||
</span>
|
||||
<div>
|
||||
<Switch
|
||||
className="mt-4 sm:mt-0"
|
||||
{...form.getInputProps("visitSpecificWebsite", {
|
||||
type: "checkbox"
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end">
|
||||
<SaveButton btnType="submit" />
|
||||
</div>
|
||||
|
@ -15,6 +15,21 @@ export const getIsSimpleInternetSearch = async () => {
|
||||
return isSimpleInternetSearch === "true"
|
||||
}
|
||||
|
||||
export const getIsVisitSpecificWebsite = async () => {
|
||||
const isVisitSpecificWebsite = await storage.get("isVisitSpecificWebsite")
|
||||
if (!isVisitSpecificWebsite || isVisitSpecificWebsite.length === 0) {
|
||||
return false
|
||||
}
|
||||
return isVisitSpecificWebsite === "true"
|
||||
}
|
||||
|
||||
|
||||
export const setIsVisitSpecificWebsite = async (
|
||||
isVisitSpecificWebsite: boolean
|
||||
) => {
|
||||
await storage.set("isVisitSpecificWebsite", isVisitSpecificWebsite.toString())
|
||||
}
|
||||
|
||||
export const setIsSimpleInternetSearch = async (
|
||||
isSimpleInternetSearch: boolean
|
||||
) => {
|
||||
@ -48,32 +63,37 @@ export const setTotalSearchResults = async (totalSearchResults: number) => {
|
||||
}
|
||||
|
||||
export const getSearchSettings = async () => {
|
||||
const [isSimpleInternetSearch, searchProvider, totalSearchResult] =
|
||||
const [isSimpleInternetSearch, searchProvider, totalSearchResult, visitSpecificWebsite] =
|
||||
await Promise.all([
|
||||
getIsSimpleInternetSearch(),
|
||||
getSearchProvider(),
|
||||
totalSearchResults()
|
||||
totalSearchResults(),
|
||||
getIsVisitSpecificWebsite()
|
||||
])
|
||||
|
||||
return {
|
||||
isSimpleInternetSearch,
|
||||
searchProvider,
|
||||
totalSearchResults: totalSearchResult
|
||||
totalSearchResults: totalSearchResult,
|
||||
visitSpecificWebsite
|
||||
}
|
||||
}
|
||||
|
||||
export const setSearchSettings = async ({
|
||||
isSimpleInternetSearch,
|
||||
searchProvider,
|
||||
totalSearchResults
|
||||
totalSearchResults,
|
||||
visitSpecificWebsite
|
||||
}: {
|
||||
isSimpleInternetSearch: boolean
|
||||
searchProvider: string
|
||||
totalSearchResults: number
|
||||
visitSpecificWebsite: boolean
|
||||
}) => {
|
||||
await Promise.all([
|
||||
setIsSimpleInternetSearch(isSimpleInternetSearch),
|
||||
setSearchProvider(searchProvider),
|
||||
setTotalSearchResults(totalSearchResults)
|
||||
setTotalSearchResults(totalSearchResults),
|
||||
setIsVisitSpecificWebsite(visitSpecificWebsite)
|
||||
])
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { getWebSearchPrompt } from "~/services/ollama"
|
||||
import { webGoogleSearch } from "./search-engines/google"
|
||||
import { webDuckDuckGoSearch } from "./search-engines/duckduckgo"
|
||||
import { getSearchProvider } from "@/services/search"
|
||||
import { getIsVisitSpecificWebsite, getSearchProvider } from "@/services/search"
|
||||
import { webSogouSearch } from "./search-engines/sogou"
|
||||
import { webBraveSearch } from "./search-engines/brave"
|
||||
import { getWebsiteFromQuery, processSingleWebsite } from "./website"
|
||||
@ -37,7 +37,9 @@ export const getSystemPromptForWeb = async (query: string) => {
|
||||
content: string;
|
||||
}[] = []
|
||||
|
||||
if (websiteVisit.hasUrl) {
|
||||
const isVisitSpecificWebsite = await getIsVisitSpecificWebsite()
|
||||
|
||||
if (isVisitSpecificWebsite && websiteVisit.hasUrl) {
|
||||
|
||||
const url = websiteVisit.url
|
||||
const queryWithoutUrl = websiteVisit.queryWithouUrls
|
||||
|
@ -10,16 +10,16 @@ import { MemoryVectorStore } from "langchain/vectorstores/memory"
|
||||
export const processSingleWebsite = async (url: string, query: string) => {
|
||||
let content = await extractReadabilityContent(url)
|
||||
|
||||
const isSimpleMode = await getIsSimpleInternetSearch()
|
||||
// const isSimpleMode = await getIsSimpleInternetSearch()
|
||||
|
||||
if (isSimpleMode) {
|
||||
return [
|
||||
{
|
||||
url,
|
||||
content: content.length > 5000 ? content.slice(0, 5000) : content
|
||||
}
|
||||
]
|
||||
}
|
||||
// if (isSimpleMode) {
|
||||
// return [
|
||||
// {
|
||||
// url,
|
||||
// content: content.length > 5000 ? content.slice(0, 5000) : content
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
|
||||
const docs: Document<Record<string, any>>[] = [
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user