Skip to content

Commit 8f252fa

Browse files
committed
bugfix: server health
1 parent b8a9d25 commit 8f252fa

File tree

3 files changed

+6
-39
lines changed

3 files changed

+6
-39
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,4 @@
171171
"@grafana/faro-core": "^1.3.5",
172172
"@grafana/faro-web-sdk": "^1.3.5"
173173
}
174-
}
174+
}

src/common/chat/localChat.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -71,48 +71,14 @@ export async function* sendChatRequest(
7171
}
7272
}
7373

74-
// if (!response.ok) {
75-
// Logger.error(response.statusText);
76-
77-
// vscode.window.showErrorMessage(
78-
// `Error: ${response.status} ${response.statusText}`
79-
// );
80-
// return null;
81-
// }
82-
83-
// const completion: {
84-
// content: string;
85-
// slot_id: number;
86-
// timings: {
87-
// predicted_ms: number;
88-
// predicted_n: number;
89-
// predicted_per_second: number;
90-
// predicted_per_token_ms: number;
91-
// prompt_ms: number;
92-
// prompt_n: number;
93-
// prompt_per_second: number;
94-
// prompt_per_token_ms: number;
95-
// };
96-
// } = (await response.json()) as any;
97-
98-
// if (completion.content === "") {
99-
// return null;
100-
// }
101-
10274
loggerCompletion.info(
103-
// `Slot Id: ${completion.slot_id}; ` +
10475
`Total time: ${(performance.now() - startTime).toFixed(2)}; ` +
10576
`PP: ${timings?.prompt_per_second?.toFixed(2)}; [t/s] ` +
10677
`TG: ${timings?.predicted_per_second?.toFixed(2)}; [t/s]`
10778
);
10879

109-
// const timing = completion?.timings?.prompt_ms
110-
// ? completion?.timings?.prompt_ms
111-
// : performance.now() - startTime;
112-
11380
loggerCompletion.info("Request: finished");
11481
return;
115-
// return { content: completion.content } as const;
11682
} catch (error) {
11783
const Error = error as Error;
11884
if (Error.name === "AbortError") {

src/common/server/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ class Server {
5959
const osplatform = os.platform();
6060
const osmachine = os.machine();
6161
const isMacArm64 = osplatform === "darwin" && osmachine === "arm64";
62-
const isBaseModel = Object.keys(modelsBase).includes(this.typeModel);
6362

6463
const serverIsStarted = await this.checkServerStatus();
6564
if (serverIsStarted) {
@@ -112,6 +111,7 @@ class Server {
112111
const port = models[this.typeModel].port;
113112

114113
const isChatModel = this.typeModel in modelsChat;
114+
const isBaseModel = this.typeModel in modelsBase;
115115

116116
this.serverProcess = spawn(
117117
serverPath,
@@ -189,7 +189,7 @@ class Server {
189189
});
190190

191191
const isServerStarted = await this.checkServerStatusIntervalWithTimeout(
192-
5000
192+
10000
193193
);
194194

195195
if (!isServerStarted) {
@@ -224,8 +224,9 @@ class Server {
224224

225225
public async checkServerStatus() {
226226
try {
227-
// const isMacArm64 = osplatform === "darwin" && osmachine === "arm64";
228-
const isMacArm64 = true;
227+
const osplatform = os.platform();
228+
const osmachine = os.machine();
229+
const isMacArm64 = osplatform === "darwin" && osmachine === "arm64";
229230
const res = await fetch(
230231
`${this.serverUrl}/${isMacArm64 ? "model.json" : "health"}`,
231232
{

0 commit comments

Comments
 (0)