Skip to content

Commit

Permalink
Starting another app instance restore the current instance from tray.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanff committed May 8, 2024
1 parent 303ecbf commit 0350e1f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ app.whenReady().then(async () => {
app.on("second-instance", () => {
// Someone tried to run a second instance, we should focus our window.
if (window) {
if (window.isMinimized()) window.restore();
if (window.isMinimized()) {
window.restore();
}
if (!window.isVisible()) {
window.show();
}
window.focus();
}
});
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/src/app/settings/settings_chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export default function SettingsChat() {
</Label>

{selectedProvider === ProviderE.OPENAI_COMPAT ? (
<Input className="h-10" {...register("model")}></Input>
<Input placeholder="llama3" className="h-10" {...register("model")}></Input>
) : (
<Controller
control={control}
Expand All @@ -162,7 +162,7 @@ export default function SettingsChat() {
{selectedProvider === ProviderE.OPENAI_COMPAT && (
<div className=" space-y-1">
<Label className="text-tx-primary">OpenAI API Compatible Endpoint URL</Label>
<Input className="h-10" {...register("url")}></Input>
<Input placeholder="https://api.groq.com/openai/v1" className="h-10" {...register("url")}></Input>
</div>
)}
</div>
Expand Down
5 changes: 4 additions & 1 deletion src/renderer/src/lib/provider/openai_compat.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Provider, ProviderConfig, ProviderE, ProviderMessage } from "@/lib/provider/provider";
import { Result } from "@shared/types";
import { joinPaths } from "@tanstack/router";
import { XFetchConfig } from "src/main/lib/xfetch";
import { v4 } from "uuid";

Expand Down Expand Up @@ -53,7 +54,9 @@ async function getChatCompletion(
key = config.apiKey;
}

const url = config.url;
const localhostReplacedURL = config.url.replace("localhost", "127.0.0.1");
const url = joinPaths([localhostReplacedURL, "/chat/completions"]);

const headers = {
Authorization: `Bearer ${key}`
};
Expand Down

0 comments on commit 0350e1f

Please sign in to comment.