mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 18:01:22 +00:00
Revert: Fix extension context detection - original logic was correct
The negated approach broke browser_script which runs in page context. browser_script injects into web pages (http://, https://) where chrome.runtime.sendMessage doesn't work. The original whitelist approach correctly identifies extension contexts only. The real issue with artifacts in sandbox iframes needs a different fix.
This commit is contained in:
parent
372be18657
commit
8a96741441
2 changed files with 60 additions and 28 deletions
|
|
@ -1651,6 +1651,57 @@ export const MODELS = {
|
|||
} satisfies Model<"anthropic-messages">,
|
||||
},
|
||||
openrouter: {
|
||||
"nvidia/llama-3.3-nemotron-super-49b-v1.5": {
|
||||
id: "nvidia/llama-3.3-nemotron-super-49b-v1.5",
|
||||
name: "NVIDIA: Llama 3.3 Nemotron Super 49B V1.5",
|
||||
api: "openai-completions",
|
||||
provider: "openrouter",
|
||||
baseUrl: "https://openrouter.ai/api/v1",
|
||||
reasoning: true,
|
||||
input: ["text"],
|
||||
cost: {
|
||||
input: 0.09999999999999999,
|
||||
output: 0.39999999999999997,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 131072,
|
||||
maxTokens: 4096,
|
||||
} satisfies Model<"openai-completions">,
|
||||
"qwen/qwen3-vl-30b-a3b-thinking": {
|
||||
id: "qwen/qwen3-vl-30b-a3b-thinking",
|
||||
name: "Qwen: Qwen3 VL 30B A3B Thinking",
|
||||
api: "openai-completions",
|
||||
provider: "openrouter",
|
||||
baseUrl: "https://openrouter.ai/api/v1",
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 0.3,
|
||||
output: 1,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 262144,
|
||||
maxTokens: 262144,
|
||||
} satisfies Model<"openai-completions">,
|
||||
"qwen/qwen3-vl-30b-a3b-instruct": {
|
||||
id: "qwen/qwen3-vl-30b-a3b-instruct",
|
||||
name: "Qwen: Qwen3 VL 30B A3B Instruct",
|
||||
api: "openai-completions",
|
||||
provider: "openrouter",
|
||||
baseUrl: "https://openrouter.ai/api/v1",
|
||||
reasoning: false,
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 0.3,
|
||||
output: 1,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 262144,
|
||||
maxTokens: 262144,
|
||||
} satisfies Model<"openai-completions">,
|
||||
"z-ai/glm-4.6": {
|
||||
id: "z-ai/glm-4.6",
|
||||
name: "Z.AI: GLM 4.6",
|
||||
|
|
@ -2960,23 +3011,6 @@ export const MODELS = {
|
|||
contextWindow: 32768,
|
||||
maxTokens: 16384,
|
||||
} satisfies Model<"openai-completions">,
|
||||
"deepseek/deepseek-r1-distill-llama-70b": {
|
||||
id: "deepseek/deepseek-r1-distill-llama-70b",
|
||||
name: "DeepSeek: R1 Distill Llama 70B",
|
||||
api: "openai-completions",
|
||||
provider: "openrouter",
|
||||
baseUrl: "https://openrouter.ai/api/v1",
|
||||
reasoning: true,
|
||||
input: ["text"],
|
||||
cost: {
|
||||
input: 0.03,
|
||||
output: 0.13,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 131072,
|
||||
maxTokens: 131072,
|
||||
} satisfies Model<"openai-completions">,
|
||||
"deepseek/deepseek-r1": {
|
||||
id: "deepseek/deepseek-r1",
|
||||
name: "DeepSeek: R1",
|
||||
|
|
@ -3054,13 +3088,13 @@ export const MODELS = {
|
|||
reasoning: false,
|
||||
input: ["text"],
|
||||
cost: {
|
||||
input: 0.04,
|
||||
output: 0.12,
|
||||
input: 0.13,
|
||||
output: 0.39,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 131072,
|
||||
maxTokens: 131072,
|
||||
maxTokens: 120000,
|
||||
} satisfies Model<"openai-completions">,
|
||||
"amazon/nova-lite-v1": {
|
||||
id: "amazon/nova-lite-v1",
|
||||
|
|
|
|||
|
|
@ -29,12 +29,11 @@ export class RuntimeMessageBridge {
|
|||
return `
|
||||
window.__completionCallbacks = [];
|
||||
// Check if we're in an extension context by examining the URL
|
||||
// We check for web/file protocols and negate - anything else is extension context
|
||||
window.__isExtensionContext = () => {
|
||||
const url = window.location.href;
|
||||
return !(url.startsWith('http://') ||
|
||||
url.startsWith('https://') ||
|
||||
url.startsWith('file://'));
|
||||
return url.startsWith('chrome-extension://') ||
|
||||
url.startsWith('moz-extension://') ||
|
||||
url === 'about:srcdoc';
|
||||
};
|
||||
window.sendRuntimeMessage = async (message) => {
|
||||
const messageId = 'msg_' + Date.now() + '_' + Math.random().toString(36).substring(2, 9);
|
||||
|
|
@ -77,12 +76,11 @@ window.onCompleted = (callback) => {
|
|||
return `
|
||||
window.__completionCallbacks = [];
|
||||
// Check if we're in an extension context by examining the URL
|
||||
// We check for web/file protocols and negate - anything else is extension context
|
||||
window.__isExtensionContext = () => {
|
||||
const url = window.location.href;
|
||||
return !(url.startsWith('http://') ||
|
||||
url.startsWith('https://') ||
|
||||
url.startsWith('file://'));
|
||||
return url.startsWith('chrome-extension://') ||
|
||||
url.startsWith('moz-extension://') ||
|
||||
url === 'about:srcdoc';
|
||||
};
|
||||
window.sendRuntimeMessage = async (message) => {
|
||||
return await chrome.runtime.sendMessage({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue