commit
b6814a9e19
@ -58,6 +58,7 @@
|
||||
"remark-math": "5.1.1",
|
||||
"tesseract.js": "^5.1.1",
|
||||
"turndown": "^7.1.3",
|
||||
"unist-util-visit": "^5.0.0",
|
||||
"yt-transcript": "^0.0.2",
|
||||
"zustand": "^4.5.0"
|
||||
},
|
||||
|
@ -125,5 +125,9 @@
|
||||
"pin": "تثبيت",
|
||||
"unpin": "إلغاء التثبيت",
|
||||
"generationInfo": "معلومات التوليد",
|
||||
"sidebarChat": "دردشة الشريط الجانبي"
|
||||
"sidebarChat": "دردشة الشريط الجانبي",
|
||||
"reasoning": {
|
||||
"thinking": "جاري التفكير....",
|
||||
"thought": "فكر لمدة {{time}}"
|
||||
}
|
||||
}
|
||||
|
@ -118,5 +118,9 @@
|
||||
"pin": "Fastgør",
|
||||
"unpin": "Frigør",
|
||||
"generationInfo": "Genererings Info",
|
||||
"sidebarChat": "Sidepanel Chat"
|
||||
"sidebarChat": "Sidepanel Chat",
|
||||
"reasoning": {
|
||||
"thinking": "Tænker....",
|
||||
"thought": "Tænkte i {{time}}"
|
||||
}
|
||||
}
|
@ -118,5 +118,9 @@
|
||||
"pin": "Anheften",
|
||||
"unpin": "Losheften",
|
||||
"generationInfo": "Generierungsinformationen",
|
||||
"sidebarChat": "Seitenleisten-Chat"
|
||||
"sidebarChat": "Seitenleisten-Chat",
|
||||
"reasoning": {
|
||||
"thinking": "Denke nach....",
|
||||
"thought": "Gedanke für {{time}}"
|
||||
}
|
||||
}
|
@ -152,5 +152,9 @@
|
||||
"pin": "Pin",
|
||||
"unpin": "Unpin",
|
||||
"generationInfo": "Generation Info",
|
||||
"sidebarChat": "Sidebar Chat"
|
||||
"sidebarChat": "Sidebar Chat",
|
||||
"reasoning": {
|
||||
"thinking": "Thinking....",
|
||||
"thought": "Thought for {{time}}"
|
||||
}
|
||||
}
|
@ -117,5 +117,9 @@
|
||||
"pin": "Fijar",
|
||||
"unpin": "Desfijar",
|
||||
"generationInfo": "Información de Generación",
|
||||
"sidebarChat": "Chat lateral"
|
||||
"sidebarChat": "Chat lateral",
|
||||
"reasoning": {
|
||||
"thinking": "Pensando....",
|
||||
"thought": "Pensamiento por {{time}}"
|
||||
}
|
||||
}
|
@ -111,5 +111,9 @@
|
||||
"pin": "پین کردن",
|
||||
"unpin": "حذف پین",
|
||||
"generationInfo": "اطلاعات تولید",
|
||||
"sidebarChat": "چت کناری"
|
||||
"sidebarChat": "چت کناری",
|
||||
"reasoning": {
|
||||
"thinking": "در حال فکر کردن....",
|
||||
"thought": "فکر کردن برای {{time}}"
|
||||
}
|
||||
}
|
@ -117,5 +117,9 @@
|
||||
"pin": "Épingler",
|
||||
"unpin": "Désépingler",
|
||||
"generationInfo": "Informations de génération",
|
||||
"sidebarChat": "Chat latéral"
|
||||
"sidebarChat": "Chat latéral",
|
||||
"reasoning": {
|
||||
"thinking": "Réflexion....",
|
||||
"thought": "Réflexion pendant {{time}}"
|
||||
}
|
||||
}
|
@ -117,5 +117,9 @@
|
||||
"pin": "Fissa",
|
||||
"unpin": "Rimuovi",
|
||||
"generationInfo": "Informazioni sulla Generazione",
|
||||
"sidebarChat": "Chat Laterale"
|
||||
"sidebarChat": "Chat Laterale",
|
||||
"reasoning": {
|
||||
"thinking": "Pensando....",
|
||||
"thought": "Pensato per {{time}}"
|
||||
}
|
||||
}
|
@ -117,5 +117,9 @@
|
||||
"pin": "固定",
|
||||
"unpin": "固定解除",
|
||||
"generationInfo": "生成情報",
|
||||
"sidebarChat": "サイドバーチャット"
|
||||
"sidebarChat": "サイドバーチャット",
|
||||
"reasoning": {
|
||||
"thinking": "考え中....",
|
||||
"thought": "{{time}}の思考"
|
||||
}
|
||||
}
|
@ -117,5 +117,9 @@
|
||||
"pin": "고정",
|
||||
"unpin": "고정 해제",
|
||||
"generationInfo": "생성 정보",
|
||||
"sidebarChat": "사이드바 채팅"
|
||||
"sidebarChat": "사이드바 채팅",
|
||||
"reasoning": {
|
||||
"thinking": "생각 중....",
|
||||
"thought": "{{time}} 동안 생각함"
|
||||
}
|
||||
}
|
@ -116,6 +116,9 @@
|
||||
"pin": "പിൻ ചെയ്യുക",
|
||||
"unpin": "അൺപിൻ ചെയ്യുക",
|
||||
"generationInfo": "ജനറേഷൻ വിവരങ്ങൾ",
|
||||
"sidebarChat": "സൈഡ്ബാർ ചാറ്റ്"
|
||||
|
||||
"sidebarChat": "സൈഡ്ബാർ ചാറ്റ്",
|
||||
"reasoning": {
|
||||
"thinking": "ചിന്തിക്കുന്നു....",
|
||||
"thought": "{{time}} നേരത്തെ ചിന്ത"
|
||||
}
|
||||
}
|
@ -118,5 +118,9 @@
|
||||
"pin": "Fest",
|
||||
"unpin": "Løsne",
|
||||
"generationInfo": "Generasjonsinformasjon",
|
||||
"sidebarChat": "Sidepanel-chat"
|
||||
"sidebarChat": "Sidepanel-chat",
|
||||
"reasoning": {
|
||||
"thinking": "Tenker....",
|
||||
"thought": "Tenkte i {{time}}"
|
||||
}
|
||||
}
|
@ -117,5 +117,9 @@
|
||||
"pin": "Fixar",
|
||||
"unpin": "Desafixar",
|
||||
"generationInfo": "Informações de Geração",
|
||||
"sidebarChat": "Chat Lateral"
|
||||
"sidebarChat": "Chat Lateral",
|
||||
"reasoning": {
|
||||
"thinking": "Pensando....",
|
||||
"thought": "Pensou por {{time}}"
|
||||
}
|
||||
}
|
@ -117,5 +117,9 @@
|
||||
"pin": "Закрепить",
|
||||
"unpin": "Открепить",
|
||||
"generationInfo": "Информация о генерации",
|
||||
"sidebarChat": "Боковой чат"
|
||||
"sidebarChat": "Боковой чат",
|
||||
"reasoning": {
|
||||
"thinking": "Размышляю...",
|
||||
"thought": "Размышлял {{time}}"
|
||||
}
|
||||
}
|
@ -122,5 +122,9 @@
|
||||
"pin": "Fäst",
|
||||
"unpin": "Ta bort fäst",
|
||||
"generationInfo": "Generationsinformation",
|
||||
"sidebarChat": "Sidofältschatt"
|
||||
"sidebarChat": "Sidofältschatt",
|
||||
"reasoning": {
|
||||
"thinking": "Tänker....",
|
||||
"thought": "Tänkte i {{time}}"
|
||||
}
|
||||
}
|
@ -122,5 +122,9 @@
|
||||
"pin": "Прикріпити",
|
||||
"unpin": "Відкріпити",
|
||||
"generationInfo": "Інформація про генерацію",
|
||||
"sidebarChat": "Бічний чат"
|
||||
"sidebarChat": "Бічний чат",
|
||||
"reasoning": {
|
||||
"thinking": "Думаю....",
|
||||
"thought": "Думав протягом {{time}}"
|
||||
}
|
||||
}
|
@ -117,5 +117,9 @@
|
||||
"pin": "置顶",
|
||||
"unpin": "取消置顶",
|
||||
"generationInfo": "生成信息",
|
||||
"sidebarChat": "侧边栏聊天"
|
||||
"sidebarChat": "侧边栏聊天",
|
||||
"reasoning": {
|
||||
"thinking": "思考中....",
|
||||
"thought": "思考了 {{time}}"
|
||||
}
|
||||
}
|
@ -18,7 +18,8 @@ import { useTTS } from "@/hooks/useTTS"
|
||||
import { tagColors } from "@/utils/color"
|
||||
import { removeModelSuffix } from "@/db/models"
|
||||
import { GenerationInfo } from "./GenerationInfo"
|
||||
|
||||
import { parseReasoning } from "@/libs/reasoning"
|
||||
import { humanizeMilliseconds } from "@/utils/humanize-miliseconds"
|
||||
type Props = {
|
||||
message: string
|
||||
message_type?: string
|
||||
@ -40,6 +41,8 @@ type Props = {
|
||||
onSourceClick?: (source: any) => void
|
||||
isTTSEnabled?: boolean
|
||||
generationInfo?: any
|
||||
isStreaming: boolean
|
||||
reasoningTimeTaken?: number
|
||||
}
|
||||
|
||||
export const PlaygroundMessage = (props: Props) => {
|
||||
@ -48,7 +51,6 @@ export const PlaygroundMessage = (props: Props) => {
|
||||
|
||||
const { t } = useTranslation("common")
|
||||
const { cancel, isSpeaking, speak } = useTTS()
|
||||
|
||||
return (
|
||||
<div className="group w-full text-gray-800 dark:text-gray-100">
|
||||
<div className="text-base md:max-w-2xl lg:max-w-xl xl:max-w-3xl flex lg:px-0 m-auto w-full">
|
||||
@ -94,7 +96,40 @@ export const PlaygroundMessage = (props: Props) => {
|
||||
<div className="flex flex-grow flex-col">
|
||||
{!editMode ? (
|
||||
props.isBot ? (
|
||||
<Markdown message={props.message} />
|
||||
<>
|
||||
{parseReasoning(props.message).map((e, i) => {
|
||||
if (e.type === "reasoning") {
|
||||
return (
|
||||
<Collapse
|
||||
key={i}
|
||||
className="border-none !mb-3"
|
||||
items={[
|
||||
{
|
||||
key: "reasoning",
|
||||
label:
|
||||
props.isStreaming && e?.reasoning_running ? (
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="italic">
|
||||
{t("reasoning.thinking")}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
t("reasoning.thought", {
|
||||
time: humanizeMilliseconds(
|
||||
props.reasoningTimeTaken
|
||||
)
|
||||
})
|
||||
),
|
||||
children: <Markdown message={e.content} />
|
||||
}
|
||||
]}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
return <Markdown key={i} message={e.content} />
|
||||
})}
|
||||
</>
|
||||
) : (
|
||||
<p
|
||||
className={`prose dark:prose-invert whitespace-pre-line prose-p:leading-relaxed prose-pre:p-0 dark:prose-dark ${
|
||||
@ -220,8 +255,8 @@ export const PlaygroundMessage = (props: Props) => {
|
||||
}
|
||||
title={t("generationInfo")}>
|
||||
<button
|
||||
aria-label={t("generationInfo")}
|
||||
className="flex items-center justify-center w-6 h-6 rounded-full bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500">
|
||||
aria-label={t("generationInfo")}
|
||||
className="flex items-center justify-center w-6 h-6 rounded-full bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500">
|
||||
<InfoIcon className="w-3 h-3 text-gray-400 group-hover:text-gray-500" />
|
||||
</button>
|
||||
</Popover>
|
||||
|
@ -16,21 +16,25 @@ import { SaveButton } from "../SaveButton"
|
||||
export const AdvanceOllamaSettings = () => {
|
||||
const [form] = Form.useForm()
|
||||
const watchUrlRewriteEnabled = Form.useWatch("urlRewriteEnabled", form)
|
||||
const { t } = useTranslation("settings")
|
||||
|
||||
const fetchAdvancedData = async () => {
|
||||
try {
|
||||
const [urlRewriteEnabled, rewriteUrl, headers] = await Promise.all([
|
||||
isUrlRewriteEnabled(),
|
||||
getRewriteUrl(),
|
||||
customOllamaHeaders()
|
||||
])
|
||||
form.setFieldsValue({ urlRewriteEnabled, rewriteUrl, headers })
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
fetchAdvancedData()
|
||||
}, [])
|
||||
|
||||
const { t } = useTranslation("settings")
|
||||
|
||||
return (
|
||||
<Form
|
||||
|
@ -120,20 +120,30 @@ export const Header: React.FC<Props> = ({
|
||||
{"/"}
|
||||
</span>
|
||||
<div className="hidden lg:block">
|
||||
<PageAssistSelect
|
||||
<Select
|
||||
className="w-80"
|
||||
placeholder={t("common:selectAModel")}
|
||||
loadingText={t("common:selectAModel")}
|
||||
// loadingText={t("common:selectAModel")}
|
||||
value={selectedModel}
|
||||
onChange={(e) => {
|
||||
setSelectedModel(e.value)
|
||||
localStorage.setItem("selectedModel", e.value)
|
||||
setSelectedModel(e)
|
||||
localStorage.setItem("selectedModel", e)
|
||||
}}
|
||||
isLoading={isModelsLoading}
|
||||
filterOption={(input, option) => {
|
||||
//@ts-ignore
|
||||
return (
|
||||
option?.label?.props["data-title"]
|
||||
?.toLowerCase()
|
||||
?.indexOf(input.toLowerCase()) >= 0
|
||||
)
|
||||
}}
|
||||
showSearch
|
||||
loading={isModelsLoading}
|
||||
options={models?.map((model) => ({
|
||||
label: (
|
||||
<span
|
||||
key={model.model}
|
||||
data-title={model.name}
|
||||
className="flex flex-row gap-3 items-center ">
|
||||
<ProviderIcons
|
||||
provider={model?.provider}
|
||||
@ -144,9 +154,10 @@ export const Header: React.FC<Props> = ({
|
||||
),
|
||||
value: model.model
|
||||
}))}
|
||||
onRefresh={() => {
|
||||
refetch()
|
||||
}}
|
||||
size="large"
|
||||
// onRefresh={() => {
|
||||
// refetch()
|
||||
// }}
|
||||
/>
|
||||
</div>
|
||||
<div className="lg:hidden">
|
||||
|
@ -122,7 +122,6 @@ const generateChatImage = async (messages: Message[]) => {
|
||||
})
|
||||
|
||||
canvas.height = totalHeight
|
||||
console.log(totalHeight)
|
||||
|
||||
ctx.fillStyle = "#ffffff"
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height)
|
||||
|
@ -18,7 +18,7 @@ export const KnowledgeSettings = () => {
|
||||
const { data, status } = useQuery({
|
||||
queryKey: ["fetchAllKnowledge"],
|
||||
queryFn: () => getAllKnowledge(),
|
||||
refetchInterval: 1000
|
||||
refetchInterval: 1000,
|
||||
})
|
||||
|
||||
const { mutate: deleteKnowledgeMutation, isPending: isDeleting } =
|
||||
|
@ -104,7 +104,6 @@ export const Playground = () => {
|
||||
const lastUsedPrompt = await getLastUsedChatSystemPrompt(
|
||||
recentChat.history.id
|
||||
)
|
||||
console.log("lastUsedPrompt", lastUsedPrompt)
|
||||
if (lastUsedPrompt) {
|
||||
if (lastUsedPrompt.prompt_id) {
|
||||
const prompt = await getPromptById(lastUsedPrompt.prompt_id)
|
||||
|
@ -55,6 +55,8 @@ export const PlaygroundChat = () => {
|
||||
}}
|
||||
isTTSEnabled={ttsEnabled}
|
||||
generationInfo={message?.generationInfo}
|
||||
isStreaming={streaming}
|
||||
reasoningTimeTaken={message?.reasoning_time_taken}
|
||||
/>
|
||||
))}
|
||||
{messages.length > 0 && (
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ export const GeneralSettings = () => {
|
||||
await browser.storage.local.clear()
|
||||
await browser.storage.session.clear()
|
||||
} catch (e) {
|
||||
console.log("Error clearing storage:", e)
|
||||
console.error("Error clearing storage:", e)
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
@ -15,9 +15,14 @@ export const SettingsOllama = () => {
|
||||
const { status } = useQuery({
|
||||
queryKey: ["fetchOllamURL"],
|
||||
queryFn: async () => {
|
||||
const [ollamaURL] = await Promise.all([getOllamaURL()])
|
||||
setOllamaURL(ollamaURL)
|
||||
return {}
|
||||
try {
|
||||
const [ollamaURL] = await Promise.all([getOllamaURL()])
|
||||
setOllamaURL(ollamaURL)
|
||||
return {}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return {}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -46,7 +46,7 @@ export const TTSModeSettings = ({ hideBorder }: { hideBorder?: boolean }) => {
|
||||
return { voices, models }
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
console.error(e)
|
||||
message.error("Error fetching ElevenLabs data")
|
||||
}
|
||||
return null
|
||||
|
@ -48,6 +48,8 @@ export const SidePanelBody = () => {
|
||||
}}
|
||||
isTTSEnabled={ttsEnabled}
|
||||
generationInfo={message?.generationInfo}
|
||||
isStreaming={streaming}
|
||||
reasoningTimeTaken={message?.reasoning_time_taken}
|
||||
/>
|
||||
))}
|
||||
<div className="w-full h-48 flex-shrink-0"></div>
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useMutation, useQuery } from "@tanstack/react-query"
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"
|
||||
import React from "react"
|
||||
import {
|
||||
getOllamaURL,
|
||||
@ -7,7 +7,6 @@ import {
|
||||
setOllamaURL as saveOllamaURL,
|
||||
setPromptForRag,
|
||||
setSystemPromptForNonRag,
|
||||
getAllModels,
|
||||
defaultEmbeddingChunkOverlap,
|
||||
defaultEmbeddingChunkSize,
|
||||
defaultEmbeddingModelForRag,
|
||||
@ -54,11 +53,12 @@ export const SettingsBody = () => {
|
||||
const [hideCurrentChatModelSettings, setHideCurrentChatModelSettings] =
|
||||
useStorage("hideCurrentChatModelSettings", false)
|
||||
|
||||
const [ speechToTextLanguage, setSpeechToTextLanguage ] = useStorage(
|
||||
const [speechToTextLanguage, setSpeechToTextLanguage] = useStorage(
|
||||
"speechToTextLanguage",
|
||||
"en-US"
|
||||
)
|
||||
const { mode, toggleDarkMode } = useDarkMode()
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
const { changeLocale, locale, supportLanguage } = useI18n()
|
||||
|
||||
@ -84,7 +84,6 @@ export const SettingsBody = () => {
|
||||
defaultEmbeddingModelForRag(),
|
||||
getTotalFilePerKB()
|
||||
])
|
||||
|
||||
return {
|
||||
url: ollamaURL,
|
||||
normalSystemPrompt: systemPrompt,
|
||||
@ -106,6 +105,7 @@ export const SettingsBody = () => {
|
||||
overlap: number
|
||||
}) => {
|
||||
await saveForRag(f.model, f.chunkSize, f.overlap, data.totalFilePerKB)
|
||||
await queryClient.invalidateQueries({ queryKey: ["sidebarSettings"] })
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -32,6 +32,7 @@ type Message = {
|
||||
sources?: string[]
|
||||
search?: WebSearch
|
||||
createdAt: number
|
||||
reasoning_time_taken?: number
|
||||
messageType?: string
|
||||
generationInfo?: any
|
||||
}
|
||||
@ -256,7 +257,8 @@ export const saveMessage = async (
|
||||
source?: any[],
|
||||
time?: number,
|
||||
message_type?: string,
|
||||
generationInfo?: any
|
||||
generationInfo?: any,
|
||||
reasoning_time_taken?: number
|
||||
) => {
|
||||
const id = generateID()
|
||||
let createdAt = Date.now()
|
||||
@ -273,7 +275,8 @@ export const saveMessage = async (
|
||||
createdAt,
|
||||
sources: source,
|
||||
messageType: message_type,
|
||||
generationInfo: generationInfo
|
||||
generationInfo: generationInfo,
|
||||
reasoning_time_taken
|
||||
}
|
||||
const db = new PageAssitDatabase()
|
||||
await db.addMessage(message)
|
||||
@ -303,6 +306,7 @@ export const formatToMessage = (messages: MessageHistory): MessageType[] => {
|
||||
sources: message?.sources || [],
|
||||
images: message.images || [],
|
||||
generationInfo: message?.generationInfo,
|
||||
reasoning_time_taken: message?.reasoning_time_taken
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -369,7 +373,6 @@ export const deleteChatForEdit = async (history_id: string, index: number) => {
|
||||
const db = new PageAssitDatabase()
|
||||
const chatHistory = (await db.getChatHistory(history_id)).reverse()
|
||||
const previousHistory = chatHistory.slice(0, index + 1)
|
||||
// console.log(previousHistory)
|
||||
await db.db.set({ [history_id]: previousHistory.reverse() })
|
||||
}
|
||||
|
||||
|
@ -163,8 +163,8 @@ export const getAllKnowledge = async (status?: string) => {
|
||||
|
||||
if (status) {
|
||||
return data
|
||||
.filter((d) => d.db_type === "knowledge")
|
||||
.filter((d) => d.status === status)
|
||||
.filter((d) => d?.db_type === "knowledge")
|
||||
.filter((d) => d?.status === status)
|
||||
.map((d) => {
|
||||
d.source.forEach((s) => {
|
||||
delete s.content
|
||||
@ -175,9 +175,9 @@ export const getAllKnowledge = async (status?: string) => {
|
||||
}
|
||||
|
||||
return data
|
||||
.filter((d) => d.db_type === "knowledge")
|
||||
.filter((d) => d?.db_type === "knowledge")
|
||||
.map((d) => {
|
||||
d.source.forEach((s) => {
|
||||
d?.source.forEach((s) => {
|
||||
delete s.content
|
||||
})
|
||||
return d
|
||||
|
139
src/db/models.ts
139
src/db/models.ts
@ -293,7 +293,7 @@ export const getModelInfo = async (id: string) => {
|
||||
export const getAllCustomModels = async () => {
|
||||
const db = new ModelDb()
|
||||
const models = (await db.getAll()).filter(
|
||||
(model) => model.db_type === "openai_model"
|
||||
(model) => model?.db_type === "openai_model"
|
||||
)
|
||||
const modelsWithProvider = await Promise.all(
|
||||
models.map(async (model) => {
|
||||
@ -324,7 +324,7 @@ export const deleteAllModelsByProviderId = async (provider_id: string) => {
|
||||
export const isLookupExist = async (lookup: string) => {
|
||||
const db = new ModelDb()
|
||||
const models = await db.getAll()
|
||||
const model = models.find((model) => model.lookup === lookup)
|
||||
const model = models.find((model) => model?.lookup === lookup)
|
||||
return model ? true : false
|
||||
}
|
||||
|
||||
@ -394,85 +394,90 @@ export const dynamicFetchLlamafile = async ({
|
||||
export const ollamaFormatAllCustomModels = async (
|
||||
modelType: "all" | "chat" | "embedding" = "all"
|
||||
) => {
|
||||
const [allModles, allProviders] = await Promise.all([
|
||||
getAllCustomModels(),
|
||||
getAllOpenAIConfig()
|
||||
])
|
||||
try {
|
||||
const [allModles, allProviders] = await Promise.all([
|
||||
getAllCustomModels(),
|
||||
getAllOpenAIConfig()
|
||||
])
|
||||
|
||||
const lmstudioProviders = allProviders.filter(
|
||||
(provider) => provider.provider === "lmstudio"
|
||||
)
|
||||
const lmstudioProviders = allProviders.filter(
|
||||
(provider) => provider.provider === "lmstudio"
|
||||
)
|
||||
|
||||
const llamafileProviders = allProviders.filter(
|
||||
(provider) => provider.provider === "llamafile"
|
||||
)
|
||||
const llamafileProviders = allProviders.filter(
|
||||
(provider) => provider.provider === "llamafile"
|
||||
)
|
||||
|
||||
const ollamaProviders = allProviders.filter(
|
||||
(provider) => provider.provider === "ollama2"
|
||||
)
|
||||
const ollamaProviders = allProviders.filter(
|
||||
(provider) => provider.provider === "ollama2"
|
||||
)
|
||||
|
||||
const lmModelsPromises = lmstudioProviders.map((provider) =>
|
||||
dynamicFetchLMStudio({
|
||||
baseUrl: provider.baseUrl,
|
||||
providerId: provider.id
|
||||
})
|
||||
)
|
||||
const lmModelsPromises = lmstudioProviders.map((provider) =>
|
||||
dynamicFetchLMStudio({
|
||||
baseUrl: provider.baseUrl,
|
||||
providerId: provider.id
|
||||
})
|
||||
)
|
||||
|
||||
const llamafileModelsPromises = llamafileProviders.map((provider) =>
|
||||
dynamicFetchLlamafile({
|
||||
baseUrl: provider.baseUrl,
|
||||
providerId: provider.id
|
||||
})
|
||||
)
|
||||
const llamafileModelsPromises = llamafileProviders.map((provider) =>
|
||||
dynamicFetchLlamafile({
|
||||
baseUrl: provider.baseUrl,
|
||||
providerId: provider.id
|
||||
})
|
||||
)
|
||||
|
||||
const ollamaModelsPromises = ollamaProviders.map((provider) =>
|
||||
dynamicFetchOllama2({
|
||||
baseUrl: provider.baseUrl,
|
||||
providerId: provider.id
|
||||
}))
|
||||
const ollamaModelsPromises = ollamaProviders.map((provider) =>
|
||||
dynamicFetchOllama2({
|
||||
baseUrl: provider.baseUrl,
|
||||
providerId: provider.id
|
||||
}))
|
||||
|
||||
const lmModelsFetch = await Promise.all(lmModelsPromises)
|
||||
const lmModelsFetch = await Promise.all(lmModelsPromises)
|
||||
|
||||
const llamafileModelsFetch = await Promise.all(llamafileModelsPromises)
|
||||
const llamafileModelsFetch = await Promise.all(llamafileModelsPromises)
|
||||
|
||||
const ollamaModelsFetch = await Promise.all(ollamaModelsPromises)
|
||||
const ollamaModelsFetch = await Promise.all(ollamaModelsPromises)
|
||||
|
||||
const lmModels = lmModelsFetch.flat()
|
||||
const lmModels = lmModelsFetch.flat()
|
||||
|
||||
const llamafileModels = llamafileModelsFetch.flat()
|
||||
const llamafileModels = llamafileModelsFetch.flat()
|
||||
|
||||
const ollama2Models = ollamaModelsFetch.flat()
|
||||
const ollama2Models = ollamaModelsFetch.flat()
|
||||
|
||||
// merge allModels and lmModels
|
||||
const allModlesWithLMStudio = [
|
||||
...(modelType !== "all"
|
||||
? allModles.filter((model) => model.model_type === modelType)
|
||||
: allModles),
|
||||
...lmModels,
|
||||
...llamafileModels,
|
||||
...ollama2Models
|
||||
]
|
||||
// merge allModels and lmModels
|
||||
const allModlesWithLMStudio = [
|
||||
...(modelType !== "all"
|
||||
? allModles.filter((model) => model.model_type === modelType)
|
||||
: allModles),
|
||||
...lmModels,
|
||||
...llamafileModels,
|
||||
...ollama2Models
|
||||
]
|
||||
|
||||
const ollamaModels = allModlesWithLMStudio.map((model) => {
|
||||
return {
|
||||
name: model.name,
|
||||
model: model.id,
|
||||
modified_at: "",
|
||||
provider:
|
||||
allProviders.find((provider) => provider.id === model.provider_id)
|
||||
?.provider || "custom",
|
||||
size: 0,
|
||||
digest: "",
|
||||
details: {
|
||||
parent_model: "",
|
||||
format: "",
|
||||
family: "",
|
||||
families: [],
|
||||
parameter_size: "",
|
||||
quantization_level: ""
|
||||
const ollamaModels = allModlesWithLMStudio.map((model) => {
|
||||
return {
|
||||
name: model.name,
|
||||
model: model.id,
|
||||
modified_at: "",
|
||||
provider:
|
||||
allProviders.find((provider) => provider.id === model.provider_id)
|
||||
?.provider || "custom",
|
||||
size: 0,
|
||||
digest: "",
|
||||
details: {
|
||||
parent_model: "",
|
||||
format: "",
|
||||
family: "",
|
||||
families: [],
|
||||
parameter_size: "",
|
||||
quantization_level: ""
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
return ollamaModels
|
||||
return ollamaModels
|
||||
} catch(e) {
|
||||
console.error(e)
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ export const addOpenAICofig = async ({ name, baseUrl, apiKey, provider }: { name
|
||||
export const getAllOpenAIConfig = async () => {
|
||||
const openaiDb = new OpenAIModelDb()
|
||||
const configs = await openaiDb.getAll()
|
||||
return configs.filter(config => config.db_type === "openai")
|
||||
return configs.filter(config => config?.db_type === "openai")
|
||||
}
|
||||
|
||||
export const updateOpenAIConfig = async ({ id, name, baseUrl, apiKey }: { id: string, name: string, baseUrl: string, apiKey: string }) => {
|
||||
|
@ -41,7 +41,6 @@ export default defineBackground({
|
||||
})
|
||||
} else {
|
||||
browser.browserAction.onClicked.addListener((tab) => {
|
||||
console.log("browser.browserAction.onClicked.addListener")
|
||||
browser.tabs.create({ url: browser.runtime.getURL("/options.html") })
|
||||
})
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ export default defineBackground({
|
||||
})
|
||||
} else {
|
||||
browser.browserAction.onClicked.addListener((tab) => {
|
||||
console.log("browser.browserAction.onClicked.addListener")
|
||||
browser.tabs.create({ url: browser.runtime.getURL("/options.html") })
|
||||
})
|
||||
}
|
||||
|
@ -130,7 +130,8 @@ export const saveMessageOnSuccess = async ({
|
||||
message_source = "web-ui",
|
||||
message_type, generationInfo,
|
||||
prompt_id,
|
||||
prompt_content
|
||||
prompt_content,
|
||||
reasoning_time_taken = 0
|
||||
}: {
|
||||
historyId: string | null
|
||||
setHistoryId: (historyId: string) => void
|
||||
@ -145,6 +146,7 @@ export const saveMessageOnSuccess = async ({
|
||||
generationInfo?: any
|
||||
prompt_id?: string
|
||||
prompt_content?: string
|
||||
reasoning_time_taken?: number
|
||||
}) => {
|
||||
if (historyId) {
|
||||
if (!isRegenerate) {
|
||||
@ -157,7 +159,8 @@ export const saveMessageOnSuccess = async ({
|
||||
[],
|
||||
1,
|
||||
message_type,
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken
|
||||
)
|
||||
}
|
||||
await saveMessage(
|
||||
@ -169,7 +172,8 @@ export const saveMessageOnSuccess = async ({
|
||||
source,
|
||||
2,
|
||||
message_type,
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken
|
||||
)
|
||||
await setLastUsedChatModel(historyId, selectedModel!)
|
||||
if (prompt_id || prompt_content) {
|
||||
@ -187,7 +191,8 @@ export const saveMessageOnSuccess = async ({
|
||||
[],
|
||||
1,
|
||||
message_type,
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken
|
||||
)
|
||||
await saveMessage(
|
||||
newHistoryId.id,
|
||||
@ -198,7 +203,8 @@ export const saveMessageOnSuccess = async ({
|
||||
source,
|
||||
2,
|
||||
message_type,
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken
|
||||
)
|
||||
setHistoryId(newHistoryId.id)
|
||||
await setLastUsedChatModel(newHistoryId.id, selectedModel!)
|
||||
|
@ -36,6 +36,7 @@ import { humanMessageFormatter } from "@/utils/human-message"
|
||||
import { pageAssistEmbeddingModel } from "@/models/embedding"
|
||||
import { PAMemoryVectorStore } from "@/libs/PAMemoryVectorStore"
|
||||
import { getScreenshotFromCurrentTab } from "@/libs/get-screenshot"
|
||||
import { isReasoningEnded, isReasoningStarted, removeReasoning } from "@/libs/reasoning"
|
||||
|
||||
export const useMessage = () => {
|
||||
const {
|
||||
@ -55,14 +56,9 @@ export const useMessage = () => {
|
||||
setWebSearch,
|
||||
isSearchingInternet
|
||||
} = useStoreMessageOption()
|
||||
const [defaultInternetSearchOn, ] = useStorage(
|
||||
"defaultInternetSearchOn",
|
||||
false
|
||||
)
|
||||
const [defaultInternetSearchOn] = useStorage("defaultInternetSearchOn", false)
|
||||
|
||||
const [
|
||||
defaultChatWithWebsite,
|
||||
] = useStorage("defaultChatWithWebsite", false)
|
||||
const [defaultChatWithWebsite] = useStorage("defaultChatWithWebsite", false)
|
||||
|
||||
const [chatWithWebsiteEmbedding] = useStorage(
|
||||
"chatWithWebsiteEmbedding",
|
||||
@ -115,10 +111,10 @@ export const useMessage = () => {
|
||||
setIsProcessing(false)
|
||||
setStreaming(false)
|
||||
currentChatModelSettings.reset()
|
||||
if(defaultInternetSearchOn) {
|
||||
if (defaultInternetSearchOn) {
|
||||
setWebSearch(true)
|
||||
}
|
||||
if(defaultChatWithWebsite) {
|
||||
if (defaultChatWithWebsite) {
|
||||
setChatMode("rag")
|
||||
}
|
||||
}
|
||||
@ -329,6 +325,7 @@ export const useMessage = () => {
|
||||
})
|
||||
const response = await questionOllama.invoke(promptForQuestion)
|
||||
query = response.content.toString()
|
||||
query = removeReasoning(query)
|
||||
}
|
||||
|
||||
let context: string = ""
|
||||
@ -405,7 +402,7 @@ export const useMessage = () => {
|
||||
try {
|
||||
generationInfo = output?.generations?.[0][0]?.generationInfo
|
||||
} catch (e) {
|
||||
console.log("handleLLMEnd error", e)
|
||||
console.error("handleLLMEnd error", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -413,18 +410,36 @@ export const useMessage = () => {
|
||||
}
|
||||
)
|
||||
let count = 0
|
||||
let reasoningStartTime: Date | null = null
|
||||
let reasoningEndTime: Date | null = null
|
||||
let timetaken = 0
|
||||
for await (const chunk of chunks) {
|
||||
contentToSave += chunk?.content
|
||||
fullText += chunk?.content
|
||||
if (count === 0) {
|
||||
setIsProcessing(true)
|
||||
}
|
||||
if (isReasoningStarted(fullText) && !reasoningStartTime) {
|
||||
reasoningStartTime = new Date()
|
||||
}
|
||||
|
||||
if (
|
||||
reasoningStartTime &&
|
||||
!reasoningEndTime &&
|
||||
isReasoningEnded(fullText)
|
||||
) {
|
||||
reasoningEndTime = new Date()
|
||||
const reasoningTime =
|
||||
reasoningEndTime.getTime() - reasoningStartTime.getTime()
|
||||
timetaken = reasoningTime
|
||||
}
|
||||
setMessages((prev) => {
|
||||
return prev.map((message) => {
|
||||
if (message.id === generateMessageId) {
|
||||
return {
|
||||
...message,
|
||||
message: fullText + "▋"
|
||||
message: fullText + "▋",
|
||||
reasoning_time_taken: timetaken
|
||||
}
|
||||
}
|
||||
return message
|
||||
@ -440,7 +455,8 @@ export const useMessage = () => {
|
||||
...message,
|
||||
message: fullText,
|
||||
sources: source,
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken: timetaken
|
||||
}
|
||||
}
|
||||
return message
|
||||
@ -470,7 +486,8 @@ export const useMessage = () => {
|
||||
fullText,
|
||||
source,
|
||||
message_source: "copilot",
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken: timetaken
|
||||
})
|
||||
|
||||
setIsProcessing(false)
|
||||
@ -601,11 +618,7 @@ export const useMessage = () => {
|
||||
const applicationChatHistory = []
|
||||
|
||||
const data = await getScreenshotFromCurrentTab()
|
||||
console.log(
|
||||
data?.success
|
||||
? `[PageAssist] Screenshot is taken`
|
||||
: `[PageAssist] Screenshot is not taken`
|
||||
)
|
||||
|
||||
const visionImage = data?.screenshot || ""
|
||||
|
||||
if (visionImage === "") {
|
||||
@ -656,7 +669,7 @@ export const useMessage = () => {
|
||||
try {
|
||||
generationInfo = output?.generations?.[0][0]?.generationInfo
|
||||
} catch (e) {
|
||||
console.log("handleLLMEnd error", e)
|
||||
console.error("handleLLMEnd error", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -664,18 +677,36 @@ export const useMessage = () => {
|
||||
}
|
||||
)
|
||||
let count = 0
|
||||
let reasoningStartTime: Date | undefined = undefined
|
||||
let reasoningEndTime: Date | undefined = undefined
|
||||
let timetaken = 0
|
||||
for await (const chunk of chunks) {
|
||||
contentToSave += chunk?.content
|
||||
fullText += chunk?.content
|
||||
if (count === 0) {
|
||||
setIsProcessing(true)
|
||||
}
|
||||
if (isReasoningStarted(fullText) && !reasoningStartTime) {
|
||||
reasoningStartTime = new Date()
|
||||
}
|
||||
|
||||
if (
|
||||
reasoningStartTime &&
|
||||
!reasoningEndTime &&
|
||||
isReasoningEnded(fullText)
|
||||
) {
|
||||
reasoningEndTime = new Date()
|
||||
const reasoningTime =
|
||||
reasoningEndTime.getTime() - reasoningStartTime.getTime()
|
||||
timetaken = reasoningTime
|
||||
}
|
||||
setMessages((prev) => {
|
||||
return prev.map((message) => {
|
||||
if (message.id === generateMessageId) {
|
||||
return {
|
||||
...message,
|
||||
message: fullText + "▋"
|
||||
message: fullText + "▋",
|
||||
reasoning_time_taken: timetaken
|
||||
}
|
||||
}
|
||||
return message
|
||||
@ -689,7 +720,8 @@ export const useMessage = () => {
|
||||
return {
|
||||
...message,
|
||||
message: fullText,
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken: timetaken
|
||||
}
|
||||
}
|
||||
return message
|
||||
@ -718,7 +750,8 @@ export const useMessage = () => {
|
||||
fullText,
|
||||
source: [],
|
||||
message_source: "copilot",
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken: timetaken
|
||||
})
|
||||
|
||||
setIsProcessing(false)
|
||||
@ -906,7 +939,7 @@ export const useMessage = () => {
|
||||
try {
|
||||
generationInfo = output?.generations?.[0][0]?.generationInfo
|
||||
} catch (e) {
|
||||
console.log("handleLLMEnd error", e)
|
||||
console.error("handleLLMEnd error", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -914,18 +947,37 @@ export const useMessage = () => {
|
||||
}
|
||||
)
|
||||
let count = 0
|
||||
let reasoningStartTime: Date | null = null
|
||||
let reasoningEndTime: Date | null = null
|
||||
let timetaken = 0
|
||||
|
||||
for await (const chunk of chunks) {
|
||||
contentToSave += chunk?.content
|
||||
fullText += chunk?.content
|
||||
if (count === 0) {
|
||||
setIsProcessing(true)
|
||||
}
|
||||
if (isReasoningStarted(fullText) && !reasoningStartTime) {
|
||||
reasoningStartTime = new Date()
|
||||
}
|
||||
|
||||
if (
|
||||
reasoningStartTime &&
|
||||
!reasoningEndTime &&
|
||||
isReasoningEnded(fullText)
|
||||
) {
|
||||
reasoningEndTime = new Date()
|
||||
const reasoningTime =
|
||||
reasoningEndTime.getTime() - reasoningStartTime.getTime()
|
||||
timetaken = reasoningTime
|
||||
}
|
||||
setMessages((prev) => {
|
||||
return prev.map((message) => {
|
||||
if (message.id === generateMessageId) {
|
||||
return {
|
||||
...message,
|
||||
message: fullText + "▋"
|
||||
message: fullText + "▋",
|
||||
reasoning_time_taken: timetaken
|
||||
}
|
||||
}
|
||||
return message
|
||||
@ -940,7 +992,8 @@ export const useMessage = () => {
|
||||
return {
|
||||
...message,
|
||||
message: fullText,
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken: timetaken
|
||||
}
|
||||
}
|
||||
return message
|
||||
@ -970,7 +1023,8 @@ export const useMessage = () => {
|
||||
fullText,
|
||||
source: [],
|
||||
message_source: "copilot",
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken: timetaken
|
||||
})
|
||||
|
||||
setIsProcessing(false)
|
||||
@ -1158,6 +1212,7 @@ export const useMessage = () => {
|
||||
})
|
||||
const response = await questionOllama.invoke(promptForQuestion)
|
||||
query = response.content.toString()
|
||||
query = removeReasoning(query)
|
||||
}
|
||||
|
||||
const { prompt, source } = await getSystemPromptForWeb(query)
|
||||
@ -1213,7 +1268,7 @@ export const useMessage = () => {
|
||||
try {
|
||||
generationInfo = output?.generations?.[0][0]?.generationInfo
|
||||
} catch (e) {
|
||||
console.log("handleLLMEnd error", e)
|
||||
console.error("handleLLMEnd error", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1221,18 +1276,37 @@ export const useMessage = () => {
|
||||
}
|
||||
)
|
||||
let count = 0
|
||||
let timetaken = 0
|
||||
let reasoningStartTime: Date | undefined = undefined
|
||||
let reasoningEndTime: Date | undefined = undefined
|
||||
for await (const chunk of chunks) {
|
||||
contentToSave += chunk?.content
|
||||
fullText += chunk?.content
|
||||
if (count === 0) {
|
||||
setIsProcessing(true)
|
||||
}
|
||||
|
||||
if (isReasoningStarted(fullText) && !reasoningStartTime) {
|
||||
reasoningStartTime = new Date()
|
||||
}
|
||||
|
||||
if (
|
||||
reasoningStartTime &&
|
||||
!reasoningEndTime &&
|
||||
isReasoningEnded(fullText)
|
||||
) {
|
||||
reasoningEndTime = new Date()
|
||||
const reasoningTime =
|
||||
reasoningEndTime.getTime() - reasoningStartTime.getTime()
|
||||
timetaken = reasoningTime
|
||||
}
|
||||
setMessages((prev) => {
|
||||
return prev.map((message) => {
|
||||
if (message.id === generateMessageId) {
|
||||
return {
|
||||
...message,
|
||||
message: fullText + "▋"
|
||||
message: fullText + "▋",
|
||||
reasoning_time_taken: timetaken
|
||||
}
|
||||
}
|
||||
return message
|
||||
@ -1248,7 +1322,8 @@ export const useMessage = () => {
|
||||
...message,
|
||||
message: fullText,
|
||||
sources: source,
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken: timetaken
|
||||
}
|
||||
}
|
||||
return message
|
||||
@ -1277,7 +1352,8 @@ export const useMessage = () => {
|
||||
image,
|
||||
fullText,
|
||||
source,
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken: timetaken
|
||||
})
|
||||
|
||||
setIsProcessing(false)
|
||||
@ -1441,25 +1517,43 @@ export const useMessage = () => {
|
||||
try {
|
||||
generationInfo = output?.generations?.[0][0]?.generationInfo
|
||||
} catch (e) {
|
||||
console.log("handleLLMEnd error", e)
|
||||
console.error("handleLLMEnd error", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
let count = 0
|
||||
let reasoningStartTime: Date | null = null
|
||||
let reasoningEndTime: Date | null = null
|
||||
let timetaken = 0
|
||||
for await (const chunk of chunks) {
|
||||
contentToSave += chunk?.content
|
||||
fullText += chunk?.content
|
||||
if (count === 0) {
|
||||
setIsProcessing(true)
|
||||
}
|
||||
if (isReasoningStarted(fullText) && !reasoningStartTime) {
|
||||
reasoningStartTime = new Date()
|
||||
}
|
||||
|
||||
if (
|
||||
reasoningStartTime &&
|
||||
!reasoningEndTime &&
|
||||
isReasoningEnded(fullText)
|
||||
) {
|
||||
reasoningEndTime = new Date()
|
||||
const reasoningTime =
|
||||
reasoningEndTime.getTime() - reasoningStartTime.getTime()
|
||||
timetaken = reasoningTime
|
||||
}
|
||||
setMessages((prev) => {
|
||||
return prev.map((message) => {
|
||||
if (message.id === generateMessageId) {
|
||||
return {
|
||||
...message,
|
||||
message: fullText + "▋"
|
||||
message: fullText + "▋",
|
||||
reasoning_time_taken: timetaken
|
||||
}
|
||||
}
|
||||
return message
|
||||
@ -1474,7 +1568,8 @@ export const useMessage = () => {
|
||||
return {
|
||||
...message,
|
||||
message: fullText,
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken: timetaken
|
||||
}
|
||||
}
|
||||
return message
|
||||
@ -1506,7 +1601,8 @@ export const useMessage = () => {
|
||||
source: [],
|
||||
message_source: "copilot",
|
||||
message_type: messageType,
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken: timetaken
|
||||
})
|
||||
|
||||
setIsProcessing(false)
|
||||
|
@ -37,6 +37,11 @@ import { pageAssistModel } from "@/models"
|
||||
import { getNoOfRetrievedDocs } from "@/services/app"
|
||||
import { humanMessageFormatter } from "@/utils/human-message"
|
||||
import { pageAssistEmbeddingModel } from "@/models/embedding"
|
||||
import {
|
||||
isReasoningEnded,
|
||||
isReasoningStarted,
|
||||
removeReasoning
|
||||
} from "@/libs/reasoning"
|
||||
|
||||
export const useMessageOption = () => {
|
||||
const {
|
||||
@ -76,10 +81,7 @@ export const useMessageOption = () => {
|
||||
} = useStoreMessageOption()
|
||||
const currentChatModelSettings = useStoreChatModelSettings()
|
||||
const [selectedModel, setSelectedModel] = useStorage("selectedModel")
|
||||
const [defaultInternetSearchOn, ] = useStorage(
|
||||
"defaultInternetSearchOn",
|
||||
false
|
||||
)
|
||||
const [defaultInternetSearchOn] = useStorage("defaultInternetSearchOn", false)
|
||||
const [speechToTextLanguage, setSpeechToTextLanguage] = useStorage(
|
||||
"speechToTextLanguage",
|
||||
"en-US"
|
||||
@ -102,7 +104,7 @@ export const useMessageOption = () => {
|
||||
setStreaming(false)
|
||||
currentChatModelSettings.reset()
|
||||
textareaRef?.current?.focus()
|
||||
if(defaultInternetSearchOn) {
|
||||
if (defaultInternetSearchOn) {
|
||||
setWebSearch(true)
|
||||
}
|
||||
}
|
||||
@ -195,6 +197,7 @@ export const useMessageOption = () => {
|
||||
setMessages(newMessage)
|
||||
let fullText = ""
|
||||
let contentToSave = ""
|
||||
let timetaken = 0
|
||||
|
||||
try {
|
||||
setIsSearchingInternet(true)
|
||||
@ -261,6 +264,7 @@ export const useMessageOption = () => {
|
||||
})
|
||||
const response = await questionOllama.invoke(promptForQuestion)
|
||||
query = response.content.toString()
|
||||
query = removeReasoning(query)
|
||||
}
|
||||
|
||||
const { prompt, source } = await getSystemPromptForWeb(query)
|
||||
@ -317,7 +321,7 @@ export const useMessageOption = () => {
|
||||
try {
|
||||
generationInfo = output?.generations?.[0][0]?.generationInfo
|
||||
} catch (e) {
|
||||
console.log("handleLLMEnd error", e)
|
||||
console.error("handleLLMEnd error", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -325,18 +329,35 @@ export const useMessageOption = () => {
|
||||
}
|
||||
)
|
||||
let count = 0
|
||||
let reasoningStartTime: Date | undefined = undefined
|
||||
let reasoningEndTime: Date | undefined = undefined
|
||||
for await (const chunk of chunks) {
|
||||
contentToSave += chunk?.content
|
||||
fullText += chunk?.content
|
||||
if (count === 0) {
|
||||
setIsProcessing(true)
|
||||
}
|
||||
if (isReasoningStarted(fullText) && !reasoningStartTime) {
|
||||
reasoningStartTime = new Date()
|
||||
}
|
||||
|
||||
if (
|
||||
reasoningStartTime &&
|
||||
!reasoningEndTime &&
|
||||
isReasoningEnded(fullText)
|
||||
) {
|
||||
reasoningEndTime = new Date()
|
||||
const reasoningTime =
|
||||
reasoningEndTime.getTime() - reasoningStartTime.getTime()
|
||||
timetaken = reasoningTime
|
||||
}
|
||||
setMessages((prev) => {
|
||||
return prev.map((message) => {
|
||||
if (message.id === generateMessageId) {
|
||||
return {
|
||||
...message,
|
||||
message: fullText + "▋"
|
||||
message: fullText + "▋",
|
||||
reasoning_time_taken: timetaken
|
||||
}
|
||||
}
|
||||
return message
|
||||
@ -352,7 +373,8 @@ export const useMessageOption = () => {
|
||||
...message,
|
||||
message: fullText,
|
||||
sources: source,
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken: timetaken
|
||||
}
|
||||
}
|
||||
return message
|
||||
@ -381,7 +403,8 @@ export const useMessageOption = () => {
|
||||
image,
|
||||
fullText,
|
||||
source,
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken: timetaken
|
||||
})
|
||||
|
||||
setIsProcessing(false)
|
||||
@ -537,6 +560,7 @@ export const useMessageOption = () => {
|
||||
setMessages(newMessage)
|
||||
let fullText = ""
|
||||
let contentToSave = ""
|
||||
let timetaken = 0
|
||||
|
||||
try {
|
||||
const prompt = await systemPromptForNonRagOption()
|
||||
@ -613,7 +637,7 @@ export const useMessageOption = () => {
|
||||
try {
|
||||
generationInfo = output?.generations?.[0][0]?.generationInfo
|
||||
} catch (e) {
|
||||
console.log("handleLLMEnd error", e)
|
||||
console.error("handleLLMEnd error", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -622,9 +646,28 @@ export const useMessageOption = () => {
|
||||
)
|
||||
|
||||
let count = 0
|
||||
let reasoningStartTime: Date | null = null
|
||||
let reasoningEndTime: Date | null = null
|
||||
|
||||
for await (const chunk of chunks) {
|
||||
contentToSave += chunk?.content
|
||||
fullText += chunk?.content
|
||||
|
||||
if (isReasoningStarted(fullText) && !reasoningStartTime) {
|
||||
reasoningStartTime = new Date()
|
||||
}
|
||||
|
||||
if (
|
||||
reasoningStartTime &&
|
||||
!reasoningEndTime &&
|
||||
isReasoningEnded(fullText)
|
||||
) {
|
||||
reasoningEndTime = new Date()
|
||||
const reasoningTime =
|
||||
reasoningEndTime.getTime() - reasoningStartTime.getTime()
|
||||
timetaken = reasoningTime
|
||||
}
|
||||
|
||||
if (count === 0) {
|
||||
setIsProcessing(true)
|
||||
}
|
||||
@ -633,7 +676,8 @@ export const useMessageOption = () => {
|
||||
if (message.id === generateMessageId) {
|
||||
return {
|
||||
...message,
|
||||
message: fullText + "▋"
|
||||
message: fullText + "▋",
|
||||
reasoning_time_taken: timetaken
|
||||
}
|
||||
}
|
||||
return message
|
||||
@ -648,7 +692,8 @@ export const useMessageOption = () => {
|
||||
return {
|
||||
...message,
|
||||
message: fullText,
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken: timetaken
|
||||
}
|
||||
}
|
||||
return message
|
||||
@ -679,7 +724,8 @@ export const useMessageOption = () => {
|
||||
source: [],
|
||||
generationInfo,
|
||||
prompt_content: promptContent,
|
||||
prompt_id: promptId
|
||||
prompt_id: promptId,
|
||||
reasoning_time_taken: timetaken
|
||||
})
|
||||
|
||||
setIsProcessing(false)
|
||||
@ -818,7 +864,7 @@ export const useMessageOption = () => {
|
||||
knownledge_id: selectedKnowledge.id
|
||||
}
|
||||
)
|
||||
|
||||
let timetaken = 0
|
||||
try {
|
||||
let query = message
|
||||
const { ragPrompt: systemPrompt, ragQuestionPrompt: questionPrompt } =
|
||||
@ -882,6 +928,7 @@ export const useMessageOption = () => {
|
||||
})
|
||||
const response = await questionOllama.invoke(promptForQuestion)
|
||||
query = response.content.toString()
|
||||
query = removeReasoning(query)
|
||||
}
|
||||
const docSize = await getNoOfRetrievedDocs()
|
||||
|
||||
@ -925,7 +972,7 @@ export const useMessageOption = () => {
|
||||
try {
|
||||
generationInfo = output?.generations?.[0][0]?.generationInfo
|
||||
} catch (e) {
|
||||
console.log("handleLLMEnd error", e)
|
||||
console.error("handleLLMEnd error", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -933,18 +980,36 @@ export const useMessageOption = () => {
|
||||
}
|
||||
)
|
||||
let count = 0
|
||||
let reasoningStartTime: Date | undefined = undefined
|
||||
let reasoningEndTime: Date | undefined = undefined
|
||||
|
||||
for await (const chunk of chunks) {
|
||||
contentToSave += chunk?.content
|
||||
fullText += chunk?.content
|
||||
if (count === 0) {
|
||||
setIsProcessing(true)
|
||||
}
|
||||
if (isReasoningStarted(fullText) && !reasoningStartTime) {
|
||||
reasoningStartTime = new Date()
|
||||
}
|
||||
|
||||
if (
|
||||
reasoningStartTime &&
|
||||
!reasoningEndTime &&
|
||||
isReasoningEnded(fullText)
|
||||
) {
|
||||
reasoningEndTime = new Date()
|
||||
const reasoningTime =
|
||||
reasoningEndTime.getTime() - reasoningStartTime.getTime()
|
||||
timetaken = reasoningTime
|
||||
}
|
||||
setMessages((prev) => {
|
||||
return prev.map((message) => {
|
||||
if (message.id === generateMessageId) {
|
||||
return {
|
||||
...message,
|
||||
message: fullText + "▋"
|
||||
message: fullText + "▋",
|
||||
reasoning_time_taken: timetaken
|
||||
}
|
||||
}
|
||||
return message
|
||||
@ -960,7 +1025,8 @@ export const useMessageOption = () => {
|
||||
...message,
|
||||
message: fullText,
|
||||
sources: source,
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken: timetaken
|
||||
}
|
||||
}
|
||||
return message
|
||||
@ -989,7 +1055,8 @@ export const useMessageOption = () => {
|
||||
image,
|
||||
fullText,
|
||||
source,
|
||||
generationInfo
|
||||
generationInfo,
|
||||
reasoning_time_taken: timetaken
|
||||
})
|
||||
|
||||
setIsProcessing(false)
|
||||
@ -1206,6 +1273,6 @@ export const useMessageOption = () => {
|
||||
setTemporaryChat,
|
||||
useOCR,
|
||||
setUseOCR,
|
||||
defaultInternetSearchOn,
|
||||
defaultInternetSearchOn
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,6 @@ export class PageAssistVectorStore extends VectorStore {
|
||||
metadata: documents[idx].metadata,
|
||||
file_id: this.file_id
|
||||
}))
|
||||
console.log(`vector:${this.knownledge_id}`)
|
||||
await insertVector(`vector:${this.knownledge_id}`, memoryVectors)
|
||||
}
|
||||
|
||||
@ -118,7 +117,6 @@ export class PageAssistVectorStore extends VectorStore {
|
||||
const data = await getVector(`vector:${this.knownledge_id}`)
|
||||
const pgVector = [...data.vectors]
|
||||
const filteredMemoryVectors = pgVector.filter(filterFunction)
|
||||
console.log(filteredMemoryVectors)
|
||||
const searches = filteredMemoryVectors
|
||||
.map((vector, index) => ({
|
||||
similarity: this.similarity(query, vector.embedding),
|
||||
@ -126,7 +124,6 @@ export class PageAssistVectorStore extends VectorStore {
|
||||
}))
|
||||
.sort((a, b) => (a.similarity > b.similarity ? -1 : 0))
|
||||
.slice(0, k)
|
||||
console.log(searches)
|
||||
const result: [Document, number][] = searches.map((search) => [
|
||||
new Document({
|
||||
metadata: filteredMemoryVectors[search.index].metadata,
|
||||
|
@ -52,7 +52,7 @@ export const getDataFromCurrentTab = async () => {
|
||||
resolve(data[0].result)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("error", e)
|
||||
console.error("error", e)
|
||||
// this is a weird method but it works
|
||||
if (import.meta.env.BROWSER === "firefox") {
|
||||
// all I need is to get the pdf url but somehow
|
||||
|
@ -41,9 +41,9 @@ export const getAllOpenAIModels = async (baseUrl: string, apiKey?: string) => {
|
||||
return data.data
|
||||
} catch (e) {
|
||||
if (e instanceof DOMException && e.name === 'AbortError') {
|
||||
console.log('Request timed out')
|
||||
console.error('Request timed out')
|
||||
} else {
|
||||
console.log(e)
|
||||
console.error(e)
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
73
src/libs/reasoning.ts
Normal file
73
src/libs/reasoning.ts
Normal file
@ -0,0 +1,73 @@
|
||||
const tags = ["think", "reason", "reasoning", "thought"];
|
||||
export function parseReasoning(text: string): { type: 'reasoning' | 'text', content: string, reasoning_running?: boolean }[] {
|
||||
try {
|
||||
const result: { type: 'reasoning' | 'text', content: string, reasoning_running?: boolean }[] = []
|
||||
const tagPattern = new RegExp(`<(${tags.join('|')})>`, 'i')
|
||||
const closeTagPattern = new RegExp(`</(${tags.join('|')})>`, 'i')
|
||||
|
||||
let currentIndex = 0
|
||||
let isReasoning = false
|
||||
|
||||
while (currentIndex < text.length) {
|
||||
const openTagMatch = text.slice(currentIndex).match(tagPattern)
|
||||
const closeTagMatch = text.slice(currentIndex).match(closeTagPattern)
|
||||
|
||||
if (!isReasoning && openTagMatch) {
|
||||
const beforeText = text.slice(currentIndex, currentIndex + openTagMatch.index)
|
||||
if (beforeText.trim()) {
|
||||
result.push({ type: 'text', content: beforeText.trim() })
|
||||
}
|
||||
|
||||
isReasoning = true
|
||||
currentIndex += openTagMatch.index! + openTagMatch[0].length
|
||||
continue
|
||||
}
|
||||
|
||||
if (isReasoning && closeTagMatch) {
|
||||
const reasoningContent = text.slice(currentIndex, currentIndex + closeTagMatch.index)
|
||||
if (reasoningContent.trim()) {
|
||||
result.push({ type: 'reasoning', content: reasoningContent.trim() })
|
||||
}
|
||||
|
||||
isReasoning = false
|
||||
currentIndex += closeTagMatch.index! + closeTagMatch[0].length
|
||||
continue
|
||||
}
|
||||
|
||||
if (currentIndex < text.length) {
|
||||
const remainingText = text.slice(currentIndex)
|
||||
result.push({
|
||||
type: isReasoning ? 'reasoning' : 'text',
|
||||
content: remainingText.trim(),
|
||||
reasoning_running: isReasoning
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
} catch (e) {
|
||||
console.error(`Error parsing reasoning: ${e}`)
|
||||
return [
|
||||
{
|
||||
type: 'text',
|
||||
content: text
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
export function isReasoningStarted(text: string): boolean {
|
||||
const tagPattern = new RegExp(`<(${tags.join('|')})>`, 'i')
|
||||
return tagPattern.test(text)
|
||||
}
|
||||
|
||||
export function isReasoningEnded(text: string): boolean {
|
||||
const closeTagPattern = new RegExp(`</(${tags.join('|')})>`, 'i')
|
||||
return closeTagPattern.test(text)
|
||||
}
|
||||
|
||||
export function removeReasoning(text: string): string {
|
||||
const tagPattern = new RegExp(`<(${tags.join('|')})>.*?</(${tags.join('|')})>`, 'gis')
|
||||
return text.replace(tagPattern, '').trim()
|
||||
}
|
@ -7,14 +7,12 @@ export const sendNotification = async (title: string, message: string) => {
|
||||
"sendNotificationAfterIndexing"
|
||||
)
|
||||
if (sendNotificationAfterIndexing) {
|
||||
console.log("Sending notification")
|
||||
browser.notifications.create({
|
||||
type: "basic",
|
||||
iconUrl: browser.runtime.getURL("/icon/128.png"),
|
||||
title,
|
||||
message
|
||||
})
|
||||
console.log("Notification sent")
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
|
@ -89,7 +89,6 @@ export class PageAssistHtmlLoader
|
||||
await urlRewriteRuntime(this.url, "web")
|
||||
let text = "";
|
||||
if (isWikipedia(this.url)) {
|
||||
console.log("Wikipedia URL detected")
|
||||
const fetchHTML = await fetch(this.url)
|
||||
text = parseWikipedia(await fetchHTML.text())
|
||||
} else {
|
||||
|
@ -108,7 +108,7 @@ export class ChatChromeAI extends SimpleChatModel<ChromeAICallOptions> {
|
||||
*/
|
||||
destroy() {
|
||||
if (!this.session) {
|
||||
return console.log("No session found. Returning.")
|
||||
return console.error("No session found. Returning.")
|
||||
}
|
||||
this.session.destroy()
|
||||
}
|
||||
|
@ -88,7 +88,6 @@ export const pageAssistModel = async ({
|
||||
}
|
||||
}) as any
|
||||
}
|
||||
console.log('useMlock', useMlock)
|
||||
return new ChatOllama({
|
||||
baseUrl,
|
||||
keepAlive,
|
||||
|
@ -184,7 +184,6 @@ export const fetchChatModels = async ({
|
||||
try {
|
||||
|
||||
const models = await getAllModels({ returnEmpty })
|
||||
|
||||
const chatModels = models
|
||||
?.filter((model) => {
|
||||
return (
|
||||
|
@ -6,7 +6,7 @@ const storage2 = new Storage({
|
||||
})
|
||||
|
||||
const TOTAL_SEARCH_RESULTS = 2
|
||||
const DEFAULT_PROVIDER = "google"
|
||||
const DEFAULT_PROVIDER = "duckduckgo"
|
||||
|
||||
const AVAILABLE_PROVIDERS = ["google", "duckduckgo"] as const
|
||||
|
||||
|
@ -3,6 +3,7 @@ import { Storage } from "@plasmohq/storage"
|
||||
import { getOllamaURL } from "./ollama"
|
||||
import { cleanUrl } from "@/libs/clean-url"
|
||||
import { HumanMessage } from "langchain/schema"
|
||||
import { removeReasoning } from "@/libs/reasoning"
|
||||
const storage = new Storage()
|
||||
|
||||
// this prompt is copied from the OpenWebUI codebase
|
||||
@ -64,9 +65,9 @@ export const generateTitle = async (model: string, query: string, fallBackTitle:
|
||||
})
|
||||
])
|
||||
|
||||
return title.content.toString()
|
||||
return removeReasoning(title.content.toString())
|
||||
} catch (error) {
|
||||
console.log(`Error generating title: ${error}`)
|
||||
console.error(`Error generating title: ${error}`)
|
||||
return fallBackTitle
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ export type Message = {
|
||||
sources: any[]
|
||||
images?: string[]
|
||||
search?: WebSearch
|
||||
reasoning_time_taken?: number
|
||||
id?: string
|
||||
messageType?: string
|
||||
}
|
||||
|
@ -17,4 +17,5 @@ export type Message = {
|
||||
messageType?: string
|
||||
id?: string
|
||||
generationInfo?: any
|
||||
reasoning_time_taken?: number
|
||||
}
|
30
src/utils/humanize-miliseconds.ts
Normal file
30
src/utils/humanize-miliseconds.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import dayjs from 'dayjs'
|
||||
import duration from 'dayjs/plugin/duration'
|
||||
|
||||
dayjs.extend(duration)
|
||||
|
||||
export const humanizeMilliseconds = (milliseconds: number): string => {
|
||||
try {
|
||||
const duration = dayjs.duration(milliseconds)
|
||||
|
||||
if (milliseconds < 1000) {
|
||||
return `${milliseconds}ms`
|
||||
}
|
||||
|
||||
if (milliseconds < 60000) {
|
||||
return `${Math.floor(duration.asSeconds())}s`
|
||||
}
|
||||
|
||||
if (milliseconds < 3600000) {
|
||||
return `${Math.floor(duration.asMinutes())}m`
|
||||
}
|
||||
|
||||
if (milliseconds < 86400000) {
|
||||
return `${Math.floor(duration.asHours())}h`
|
||||
}
|
||||
|
||||
return `${Math.floor(duration.asDays())}d`
|
||||
} catch (e) {
|
||||
return `${milliseconds}ms`
|
||||
}
|
||||
}
|
@ -34,7 +34,6 @@ export const rerankDocs = async ({
|
||||
}
|
||||
})
|
||||
|
||||
console.log("similarity", similarity)
|
||||
const sortedDocs = similarity
|
||||
.sort((a, b) => b.similarity - a.similarity)
|
||||
.filter((sim) => sim.similarity > 0.5)
|
||||
|
@ -17,7 +17,6 @@ export const getPageAssistTextSplitter = async () => {
|
||||
|
||||
switch (splittingStrategy) {
|
||||
case "CharacterTextSplitter":
|
||||
console.log("Using CharacterTextSplitter")
|
||||
const splittingSeparator = await defaultSsplttingSeparator()
|
||||
const processedSeparator = splittingSeparator
|
||||
.replace(/\\n/g, "\n")
|
||||
|
@ -42,7 +42,6 @@ export const localBraveSearch = async (query: string) => {
|
||||
return { title, link, content }
|
||||
}).filter((result) => result.link && result.title && result.content)
|
||||
|
||||
console.log(searchResults)
|
||||
|
||||
return searchResults
|
||||
}
|
||||
|
@ -28,12 +28,23 @@ export const localGoogleSearch = async (query: string) => {
|
||||
const htmlString = await fetch(
|
||||
`https://www.${baseGoogleDomain}/search?hl=en&q=` + query,
|
||||
{
|
||||
signal: abortController.signal
|
||||
signal: abortController.signal,
|
||||
headers: {
|
||||
"User-Agent": navigator.userAgent,
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
|
||||
"Accept-Language": "en-US,en;q=0.5",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"DNT": "1",
|
||||
"Connection": "keep-alive",
|
||||
"Upgrade-Insecure-Requests": "1",
|
||||
"Sec-Fetch-Dest": "document",
|
||||
"Sec-Fetch-Mode": "navigate",
|
||||
"Sec-Fetch-Site": "none",
|
||||
"Sec-Fetch-User": "?1"
|
||||
}
|
||||
}
|
||||
)
|
||||
.then((response) => response.text())
|
||||
).then((response) => response.text())
|
||||
.catch()
|
||||
|
||||
const parser = new DOMParser()
|
||||
|
||||
const doc = parser.parseFromString(htmlString, "text/html")
|
||||
|
@ -51,7 +51,7 @@ export default defineConfig({
|
||||
outDir: "build",
|
||||
|
||||
manifest: {
|
||||
version: "1.4.3",
|
||||
version: "1.4.4",
|
||||
name:
|
||||
process.env.TARGET === "firefox"
|
||||
? "Page Assist - A Web UI for Local AI Models"
|
||||
@ -91,7 +91,7 @@ export default defineConfig({
|
||||
{
|
||||
extension_pages:
|
||||
"script-src 'self' 'wasm-unsafe-eval'; object-src 'self';"
|
||||
} : undefined,
|
||||
} : "script-src 'self' 'wasm-unsafe-eval' blob:; object-src 'self'; worker-src 'self' blob:;",
|
||||
permissions:
|
||||
process.env.TARGET === "firefox"
|
||||
? firefoxMV2Permissions
|
||||
|
Loading…
x
Reference in New Issue
Block a user