feat: Add segmented control for custom and copilot prompts in PromptBody component

This commit is contained in:
n4ze3m 2024-08-06 23:32:31 +05:30
parent fa42f71821
commit 44da2db97e
3 changed files with 13 additions and 6 deletions

View File

@ -147,6 +147,10 @@
"type": "نوع پرامپت", "type": "نوع پرامپت",
"actions": "اقدامات" "actions": "اقدامات"
}, },
"segmented": {
"custom": "پرامپت‌های سفارشی",
"copilot": "پرامپت‌های کوپایلوت"
},
"systemPrompt": "پرامپت سیستم ", "systemPrompt": "پرامپت سیستم ",
"quickPrompt": "پرامپت سریع", "quickPrompt": "پرامپت سریع",
"tooltip": { "tooltip": {

View File

@ -1,6 +1,6 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query" import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
import { MemoryRouter } from "react-router-dom" import { MemoryRouter } from "react-router-dom"
import { useEffect } from "react" import { useEffect, useState } from "react"
const queryClient = new QueryClient() const queryClient = new QueryClient()
import { ConfigProvider, Empty, theme } from "antd" import { ConfigProvider, Empty, theme } from "antd"
import { StyleProvider } from "@ant-design/cssinjs" import { StyleProvider } from "@ant-design/cssinjs"
@ -13,13 +13,15 @@ import { PageAssistProvider } from "@/components/Common/PageAssistProvider"
function IndexOption() { function IndexOption() {
const { mode } = useDarkMode() const { mode } = useDarkMode()
const { t, i18n } = useTranslation() const { t, i18n } = useTranslation()
const [direction, setDirection] = useState<"ltr" | "rtl">("ltr")
useEffect(() => { useEffect(() => {
if (i18n.resolvedLanguage) { if (i18n.resolvedLanguage) {
document.documentElement.lang = i18n.resolvedLanguage; document.documentElement.lang = i18n.resolvedLanguage
document.documentElement.dir = i18n.dir(i18n.resolvedLanguage); document.documentElement.dir = i18n.dir(i18n.resolvedLanguage)
setDirection(i18n.dir(i18n.resolvedLanguage))
} }
}, [i18n, i18n.resolvedLanguage]); }, [i18n, i18n.resolvedLanguage])
return ( return (
<MemoryRouter> <MemoryRouter>
@ -38,7 +40,8 @@ function IndexOption() {
}} }}
description={t("common:noData")} description={t("common:noData")}
/> />
)}> )}
direction={direction}>
<StyleProvider hashPriority="high"> <StyleProvider hashPriority="high">
<QueryClientProvider client={queryClient}> <QueryClientProvider client={queryClient}>
<PageAssistProvider> <PageAssistProvider>

View File

@ -14,7 +14,7 @@ export const DEFAULT_TITLE_GEN_PROMPT = `Here is the query:
-------------- --------------
Create a concise, 3-5 word phrase as a title for the previous query. Suitable emojis for the summary can be used to enhance understanding. Avoid quotation marks or special formatting. RESPOND ONLY WITH THE TITLE TEXT. ANSWER USING THE SAME LANGUAGE AS THE QUERY. Create a concise, 3-5 word phrase as a title for the previous query. Avoid quotation marks or special formatting. RESPOND ONLY WITH THE TITLE TEXT. ANSWER USING THE SAME LANGUAGE AS THE QUERY.
Examples of titles: Examples of titles: