mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-10 11:39:50 +08:00
- Bedrock: a user's AWS keys no longer go to an endpoint the server sets in AWS_ENDPOINT_URL_BEDROCK_RUNTIME / AWS_ENDPOINT_URL (read by the upgraded SDK), and admin panel keys win over AWS_BEARER_TOKEN_BEDROCK, as the Test button checks them. Checked with Bedrock. - Ollama: a server key without a base URL (admin panel, OLLAMA_API_KEY) goes to Ollama Cloud, as env.example says, instead of 127.0.0.1. - Quota: EdgeOne counts whatever key header comes along, keyless Ollama at a private address counts, and their provider texts stay in the log. - An EdgeOne server model (admin panel, ai-models.json) works: the route checked the raw provider header, which holds the name's slug. - parse-url ends downloads it does not read (too large, PDF, errors). - Desktop app: the port follows where the chats are (IndexedDB per origin) instead of a remembered port, which could hide them for good; a same-port restart tells the page to refetch the server models; a failed preset switch no longer undoes a newer choice; a presets file removed after a failed read can be saved again; .env values quoted from start to end keep their inner quotes, as dotenv reads them.
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import { contextBridge, ipcRenderer } from "electron"
|
|
|
|
/**
|
|
* Expose safe APIs to the renderer process
|
|
*/
|
|
contextBridge.exposeInMainWorld("electronAPI", {
|
|
// Platform information
|
|
platform: process.platform,
|
|
|
|
// Check if running in Electron
|
|
isElectron: true,
|
|
|
|
// Application version
|
|
getVersion: () => ipcRenderer.invoke("get-version"),
|
|
|
|
// Window controls (optional, for custom title bar)
|
|
minimize: () => ipcRenderer.send("window-minimize"),
|
|
maximize: () => ipcRenderer.send("window-maximize"),
|
|
close: () => ipcRenderer.send("window-close"),
|
|
|
|
// Proxy settings
|
|
getProxy: () => ipcRenderer.invoke("get-proxy"),
|
|
setProxy: (config: { httpProxy?: string; httpsProxy?: string }) =>
|
|
ipcRenderer.invoke("set-proxy", config),
|
|
|
|
// User locale settings
|
|
getUserLocale: () => ipcRenderer.invoke("get-user-locale"),
|
|
setUserLocale: (locale: string) =>
|
|
ipcRenderer.invoke("set-user-locale", locale),
|
|
|
|
// The server restarted on the same port (another preset)
|
|
onServerRestarted: (callback: () => void) => {
|
|
const listener = () => callback()
|
|
ipcRenderer.on("server-restarted", listener)
|
|
return () => {
|
|
ipcRenderer.removeListener("server-restarted", listener)
|
|
}
|
|
},
|
|
})
|