-
-
- {
- setOllamaURL(e.target.value)
- }}
- placeholder="Your Ollama URL"
- className="w-full p-2 border border-gray-300 rounded-md dark:bg-[#262626] dark:text-gray-100"
- />
-
-
- {
- saveOllamaURL(ollamaURL)
- }}
- className="mt-2"
- />
-
+
+ {status === "pending" &&
}
+ {status === "success" && (
+ <>
+
+
+ {
+ setOllamaURL(e.target.value)
+ }}
+ placeholder="Your Ollama URL"
+ className="w-full p-2 border border-gray-300 rounded-md dark:bg-[#262626] dark:text-gray-100"
+ />
+
+
+ {
+ saveOllamaURL(ollamaURL)
+ }}
+ className="mt-2"
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ )}
)
}
diff --git a/src/components/Option/Settings/other.tsx b/src/components/Option/Settings/other.tsx
index 344b6d0..be10071 100644
--- a/src/components/Option/Settings/other.tsx
+++ b/src/components/Option/Settings/other.tsx
@@ -28,9 +28,9 @@ export const SettingOther = () => {
options={SUPPORTED_LANGUAGES}
value={speechToTextLanguage}
filterOption={(input, option) =>
- option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 ||
- option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
- }
+ option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 ||
+ option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
+ }
onChange={(value) => {
setSpeechToTextLanguage(value)
}}
diff --git a/src/components/Option/Settings/prompt.tsx b/src/components/Option/Settings/prompt.tsx
index 71294e2..09117bd 100644
--- a/src/components/Option/Settings/prompt.tsx
+++ b/src/components/Option/Settings/prompt.tsx
@@ -1,56 +1,146 @@
-import { useQuery } from "@tanstack/react-query"
-import { useEffect, useState } from "react"
+import { useQuery, useQueryClient } from "@tanstack/react-query"
+import { Skeleton, Radio, Form } from "antd"
+import React from "react"
import { SaveButton } from "~components/Common/SaveButton"
import {
+ getWebSearchPrompt,
setSystemPromptForNonRagOption,
- systemPromptForNonRagOption
+ systemPromptForNonRagOption,
+ geWebSearchFollowUpPrompt,
+ setWebPrompts
} from "~services/ollama"
export const SettingPrompt = () => {
- const [ollamaPrompt, setOllamaPrompt] = useState
("")
- const { data: ollamaInfo } = useQuery({
+ const [selectedValue, setSelectedValue] = React.useState<"normal" | "web">(
+ "normal"
+ )
+
+ const queryClient = useQueryClient()
+
+ const { status, data } = useQuery({
queryKey: ["fetchOllaPrompt"],
queryFn: async () => {
- const prompt = await systemPromptForNonRagOption()
+ const [prompt, webSearchPrompt, webSearchFollowUpPrompt] =
+ await Promise.all([
+ systemPromptForNonRagOption(),
+ getWebSearchPrompt(),
+ geWebSearchFollowUpPrompt()
+ ])
return {
- prompt
+ prompt,
+ webSearchPrompt,
+ webSearchFollowUpPrompt
}
}
})
- useEffect(() => {
- if (ollamaInfo?.prompt) {
- setOllamaPrompt(ollamaInfo.prompt)
- }
- }, [ollamaInfo])
-
return (
-
-
-
-
+
+ {status === "pending" &&
}
-
- {
- setSystemPromptForNonRagOption(ollamaPrompt)
- }}
- className="mt-2"
- />
-
+ {status === "success" && (
+
+
Prompt
+
+ setSelectedValue(e.target.value)}>
+ Normal
+ Web
+
+
+
+ {selectedValue === "normal" && (
+
+
+
+
+
+
+
{" "}
+
+
+ )}
+
+ {selectedValue === "web" && (
+
+
+
+
+
+
+
+
+
+
{" "}
+
+
+ )}
+
+ )}
)
}
diff --git a/src/components/Sidepanel/Chat/form.tsx b/src/components/Sidepanel/Chat/form.tsx
index f8d287d..1c733f9 100644
--- a/src/components/Sidepanel/Chat/form.tsx
+++ b/src/components/Sidepanel/Chat/form.tsx
@@ -212,7 +212,7 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
{
key: 1,
label: (
setSendWhenEnter(e.target.checked)
}>
diff --git a/src/services/ollama.ts b/src/services/ollama.ts
index 88f8a4d..b5b3eb2 100644
--- a/src/services/ollama.ts
+++ b/src/services/ollama.ts
@@ -279,4 +279,10 @@ export const geWebSearchFollowUpPrompt = async () => {
export const setWebSearchFollowUpPrompt = async (prompt: string) => {
await storage.set("webSearchFollowUpPrompt", prompt)
+}
+
+
+export const setWebPrompts = async (prompt: string, followUpPrompt: string) => {
+ await setWebSearchPrompt(prompt)
+ await setWebSearchFollowUpPrompt(followUpPrompt)
}
\ No newline at end of file