Skip to content

Commit c5b6371

Browse files
committed
feat: enhance settings page and browser extension functionality
- Replaced the text input for AI model selection with a dropdown for better user experience, allowing users to select from available models or enter a custom value. - Added a tip for users in the settings page to guide model selection based on their needs. - Updated the browser extension manifest to include audio capture permissions. - Improved the Vite configuration comments for clarity regarding sidepanel entry handling. - Implemented functionality to open the sidepanel on demand and collect screenshots for download from the sidepanel. - Introduced validation and download helpers for chat image export in the background script. - Initialized QuickJS and ZenFS on sidepanel startup to optimize performance.
1 parent c3e39da commit c5b6371

File tree

7 files changed

+527
-18
lines changed

7 files changed

+527
-18
lines changed

packages/aipex-react/src/components/settings/index.tsx

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,18 +1564,60 @@ export function SettingsPage({
15641564
{t("settings.aiModel")}
15651565
<span className="text-destructive ml-1">*</span>
15661566
</Label>
1567-
<Input
1568-
id="aiModel"
1569-
type="text"
1570-
value={selectedModel.aiModel || ""}
1571-
onChange={(e) =>
1572-
handleModelFieldChange(
1573-
"aiModel",
1574-
e.target.value,
1575-
)
1576-
}
1577-
placeholder={t("settings.modelPlaceholder")}
1578-
/>
1567+
{selectedProviderMeta.models.length > 0 ? (
1568+
<Select
1569+
value={selectedModel.aiModel || ""}
1570+
onValueChange={(value: string) =>
1571+
handleModelFieldChange("aiModel", value)
1572+
}
1573+
>
1574+
<SelectTrigger>
1575+
<SelectValue
1576+
placeholder={t(
1577+
"settings.modelPlaceholder",
1578+
)}
1579+
/>
1580+
</SelectTrigger>
1581+
<SelectContent>
1582+
{selectedProviderMeta.models.map(
1583+
(model: string) => (
1584+
<SelectItem key={model} value={model}>
1585+
{model}
1586+
</SelectItem>
1587+
),
1588+
)}
1589+
{/* Allow keeping a custom value that is not in the preset list */}
1590+
{selectedModel.aiModel &&
1591+
!selectedProviderMeta.models.includes(
1592+
selectedModel.aiModel as never,
1593+
) && (
1594+
<SelectItem
1595+
value={selectedModel.aiModel}
1596+
>
1597+
{selectedModel.aiModel}
1598+
</SelectItem>
1599+
)}
1600+
</SelectContent>
1601+
</Select>
1602+
) : (
1603+
<Input
1604+
id="aiModel"
1605+
type="text"
1606+
value={selectedModel.aiModel || ""}
1607+
onChange={(e) =>
1608+
handleModelFieldChange(
1609+
"aiModel",
1610+
e.target.value,
1611+
)
1612+
}
1613+
placeholder={t("settings.modelPlaceholder")}
1614+
/>
1615+
)}
1616+
<p className="text-xs text-muted-foreground">
1617+
{language === "zh"
1618+
? "提示: 选择适合你需求的模型。"
1619+
: "Tip: Choose a model that fits your needs."}
1620+
</p>
15791621
</div>
15801622
</>
15811623
) : (

packages/browser-ext/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"downloads",
8181
"debugger",
8282
"cookies",
83-
"webNavigation"
83+
"webNavigation",
84+
"audioCapture"
8485
]
8586
}

0 commit comments

Comments
 (0)