Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix: linter

Louis53495a024b2f
diff --git a/web-app/src/containers/dialogs/ImportMlxModelDialog.tsx b/web-app/src/containers/dialogs/ImportMlxModelDialog.tsx
index f9c36bc8b..49f44a486 100644
--- a/web-app/src/containers/dialogs/ImportMlxModelDialog.tsx
+++ b/web-app/src/containers/dialogs/ImportMlxModelDialog.tsx
@@ -57,6 +57,7 @@ export const ImportMlxModelDialog = ({
const nameFromPath = pathParts[pathParts.length - 1] || 'mlx-model'
const sanitizedName = nameFromPath
.replace(/\s/g, '-')
+ //eslint-disable-next-line
.replace(/[^a-zA-Z0-9/_.\-]/g, '')
setModelName(sanitizedName)
}
@@ -74,6 +75,7 @@ export const ImportMlxModelDialog = ({
}
// Validate model name - only allow alphanumeric, underscore, hyphen, and dot
+ //eslint-disable-next-line
if (!/^[a-zA-Z0-9/_.\-]+$/.test(modelName)) {
toast.error('Invalid model name. Only alphanumeric and _ - . characters are allowed.')
return
@@ -261,4 +263,4 @@ export const ImportMlxModelDialog = ({
</DialogContent>
</Dialog>
)
-}
\ No newline at end of file
+}
diff --git a/web-app/src/lib/custom-chat-transport.ts b/web-app/src/lib/custom-chat-transport.ts
index 9bbdde32b..51384d23a 100644
--- a/web-app/src/lib/custom-chat-transport.ts
+++ b/web-app/src/lib/custom-chat-transport.ts
@@ -227,7 +227,6 @@ export class CustomChatTransport implements ChatTransport<UIMessage> {
// Track stream timing and token count for token speed calculation
let streamStartTime: number | undefined
- let textDeltaCount = 0
const result = streamText({
model: this.model,
@@ -238,7 +237,7 @@ export class CustomChatTransport implements ChatTransport<UIMessage> {
system: this.systemMessage,
})
- var tokensPerSecond = 0
+ let tokensPerSecond = 0
return result.toUIMessageStream({
messageMetadata: ({ part }) => {
@@ -265,7 +264,7 @@ export class CustomChatTransport implements ChatTransport<UIMessage> {
const durationSec = durationMs / 1000
// Use provider's outputTokens, or llama.cpp completionTokens, or fall back to text delta count
- const outputTokens = usage?.outputTokens ?? textDeltaCount
+ const outputTokens = usage?.outputTokens ?? 0
const inputTokens = usage?.inputTokens
// Use llama.cpp's tokens per second if available, otherwise calculate from duration
diff --git a/web-app/src/routes/settings/providers/$providerName.tsx b/web-app/src/routes/settings/providers/$providerName.tsx
index 19196d1d6..439908b12 100644
--- a/web-app/src/routes/settings/providers/$providerName.tsx
+++ b/web-app/src/routes/settings/providers/$providerName.tsx
@@ -451,7 +451,7 @@ function ProviderDetail() {
)
if (deviceSettingIndex !== -1) {
- ;(
+ (
newSettings[deviceSettingIndex]
.controller_props as {
value: string