Update dependencies and fix import paths
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
|
||||
import { processKnowledge } from "@/libs/process-knowledge"
|
||||
import { getOllamaURL, isOllamaRunning } from "../services/ollama"
|
||||
const progressHuman = (completed: number, total: number) => {
|
||||
return ((completed / total) * 100).toFixed(0) + "%"
|
||||
@@ -78,13 +78,16 @@ export default defineBackground({
|
||||
main() {
|
||||
chrome.runtime.onMessage.addListener(async (message) => {
|
||||
if (message.type === "sidepanel") {
|
||||
chrome.tabs.query({ active: true, currentWindow: true }, async (tabs) => {
|
||||
const tab = tabs[0]
|
||||
chrome.sidePanel.open({
|
||||
// tabId: tab.id!,
|
||||
windowId: tab.windowId!,
|
||||
})
|
||||
})
|
||||
chrome.tabs.query(
|
||||
{ active: true, currentWindow: true },
|
||||
async (tabs) => {
|
||||
const tab = tabs[0]
|
||||
chrome.sidePanel.open({
|
||||
// tabId: tab.id!,
|
||||
windowId: tab.windowId!
|
||||
})
|
||||
}
|
||||
)
|
||||
} else if (message.type === "pull_model") {
|
||||
const ollamaURL = await getOllamaURL()
|
||||
|
||||
@@ -93,8 +96,7 @@ export default defineBackground({
|
||||
if (!isRunning) {
|
||||
chrome.action.setBadgeText({ text: "E" })
|
||||
chrome.action.setBadgeBackgroundColor({ color: "#FF0000" })
|
||||
chrome.action.setTitle({ title: "Ollama is not running"
|
||||
})
|
||||
chrome.action.setTitle({ title: "Ollama is not running" })
|
||||
setTimeout(() => {
|
||||
clearBadge()
|
||||
}, 5000)
|
||||
@@ -111,12 +113,15 @@ export default defineBackground({
|
||||
chrome.commands.onCommand.addListener((command) => {
|
||||
switch (command) {
|
||||
case "execute_side_panel":
|
||||
chrome.tabs.query({ active: true, currentWindow: true }, async (tabs) => {
|
||||
const tab = tabs[0]
|
||||
chrome.sidePanel.open({
|
||||
windowId: tab.windowId!
|
||||
})
|
||||
})
|
||||
chrome.tabs.query(
|
||||
{ active: true, currentWindow: true },
|
||||
async (tabs) => {
|
||||
const tab = tabs[0]
|
||||
chrome.sidePanel.open({
|
||||
windowId: tab.windowId!
|
||||
})
|
||||
}
|
||||
)
|
||||
break
|
||||
default:
|
||||
break
|
||||
@@ -131,14 +136,17 @@ export default defineBackground({
|
||||
|
||||
chrome.contextMenus.onClicked.addListener((info, tab) => {
|
||||
if (info.menuItemId === "open-side-panel-pa") {
|
||||
chrome.tabs.query({ active: true, currentWindow: true }, async (tabs) => {
|
||||
const tab = tabs[0]
|
||||
await chrome.sidePanel.open({
|
||||
windowId: tab.windowId!,
|
||||
})
|
||||
})
|
||||
chrome.tabs.query(
|
||||
{ active: true, currentWindow: true },
|
||||
async (tabs) => {
|
||||
const tab = tabs[0]
|
||||
await chrome.sidePanel.open({
|
||||
windowId: tab.windowId!
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
})
|
||||
},
|
||||
persistent: true
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user