mirror of
https://git.zavage.net/Zavage-Software/search-with-chatgpt-powered-by-openai-extension.git
synced 2026-08-31 22:20:47 -06:00
fix: prefer the focused frame, bound model length, drop dead flag
This commit is contained in:
@@ -4,6 +4,13 @@
|
||||
|
||||
export const OPEN_IN_VALUES = ["new-tab", "background-tab", "new-window"];
|
||||
|
||||
// An unbounded model string can, on its own, exceed MAX_URL_CHARS in
|
||||
// lib/build-url.js — fitToBudget() only ever trims `q`, so a long enough
|
||||
// model silently pushes the whole URL over budget and drops the query
|
||||
// entirely with no signal to the user. 200 is generous for any real model
|
||||
// slug while keeping the URL budget meaningful.
|
||||
export const MAX_MODEL_CHARS = 200;
|
||||
|
||||
export const DEFAULT_SETTINGS = {
|
||||
model: "",
|
||||
temporaryChat: false,
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
import { DEFAULT_SETTINGS, OPEN_IN_VALUES } from "./defaults.js";
|
||||
import { DEFAULT_SETTINGS, OPEN_IN_VALUES, MAX_MODEL_CHARS } from "./defaults.js";
|
||||
|
||||
// Pure. Layers stored values over the defaults, dropping unknown keys and
|
||||
// falling back on wrong types or out-of-range values. A fresh or signed-out
|
||||
@@ -8,7 +8,7 @@ export function mergeSettings(stored) {
|
||||
if (stored === null || typeof stored !== "object") {
|
||||
return merged;
|
||||
}
|
||||
if (typeof stored.model === "string") {
|
||||
if (typeof stored.model === "string" && stored.model.length <= MAX_MODEL_CHARS) {
|
||||
merged.model = stored.model;
|
||||
}
|
||||
if (typeof stored.temporaryChat === "boolean") {
|
||||
|
||||
Reference in New Issue
Block a user