Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix(ensu): address web and desktop lint issues

Prateek Sunald870b10c4026
diff --git a/rust/apps/ensu/src-tauri/Cargo.lock b/rust/apps/ensu/src-tauri/Cargo.lock
index ab18c762a0..98db860cb5 100644
--- a/rust/apps/ensu/src-tauri/Cargo.lock
+++ b/rust/apps/ensu/src-tauri/Cargo.lock
@@ -1091,7 +1091,7 @@ dependencies = [
[[package]]
name = "ensu-tauri"
-version = "0.1.9"
+version = "0.1.10"
dependencies = [
"ensu-db",
"ensu-sync",
diff --git a/web/apps/ensu/next.config.mjs b/web/apps/ensu/next.config.mjs
index 95ebc272d9..604c951b2a 100644
--- a/web/apps/ensu/next.config.mjs
+++ b/web/apps/ensu/next.config.mjs
@@ -1,13 +1,12 @@
/* eslint-env node */
-import { createRequire } from "node:module";
import nextConfig from "ente-base/next.config.base.js";
+import packageJson from "./package.json" with { type: "json" };
/** @type {{ process?: { env?: Record<string, string> } }} */
const globalWithProcess = globalThis;
const env = globalWithProcess.process?.env;
-const require = createRequire(import.meta.url);
-const { version } = require("./package.json");
+const { version } = packageJson;
const isTauriBuild = env?.ENTE_TAURI === "1";
const rawBasePath = env?.ENTE_BASE_PATH ?? "";
const normalizedBasePath = rawBasePath
@@ -20,10 +19,7 @@ export default {
...nextConfig,
eslint: { ignoreDuringBuilds: true },
typescript: { ignoreBuildErrors: true },
- env: {
- ...(nextConfig.env ?? {}),
- NEXT_PUBLIC_ENSU_VERSION: version,
- },
+ env: { ...(nextConfig.env ?? {}), NEXT_PUBLIC_ENSU_VERSION: version },
...(isTauriBuild ? { output: "export" } : {}),
...(normalizedBasePath
? {
diff --git a/web/apps/ensu/src/components/chat/ChatDialogs.tsx b/web/apps/ensu/src/components/chat/ChatDialogs.tsx
index 180700edb4..331fe4c8cf 100644
--- a/web/apps/ensu/src/components/chat/ChatDialogs.tsx
+++ b/web/apps/ensu/src/components/chat/ChatDialogs.tsx
@@ -222,12 +222,7 @@ export const ChatDialogs = memo(
url: model.url,
mmproj: model.mmproj,
})),
- {
- id: "custom",
- name: "Custom",
- url: "",
- mmproj: "",
- },
+ { id: "custom", name: "Custom", url: "", mmproj: "" },
],
[allowMmproj, defaultModelName, defaultModelUrl, suggestedModels],
);
@@ -241,9 +236,7 @@ export const ChatDialogs = memo(
? modelOptions.find((model) => model.url === modelUrl)
: undefined;
setSelectedModelId(
- !useCustomModel
- ? "default"
- : (matchedOption?.id ?? "custom"),
+ !useCustomModel ? "default" : (matchedOption?.id ?? "custom"),
);
setShowAdvancedLimits(!!contextLength || !!maxTokens);
}, [
@@ -735,7 +728,10 @@ export const ChatDialogs = memo(
</Typography>
)}
{showAdvancedLimits && (
- <Stack direction="row" sx={{ gap: 1.5 }}>
+ <Stack
+ direction="row"
+ sx={{ gap: 1.5 }}
+ >
<TextField
fullWidth
label="Context length"
@@ -817,18 +813,16 @@ export const ChatDialogs = memo(
fullWidth
slotProps={{ paper: { sx: dialogPaperSx } }}
>
- <DialogTitle sx={dialogTitleSx}>
- System Prompt
- </DialogTitle>
+ <DialogTitle sx={dialogTitleSx}>System Prompt</DialogTitle>
<DialogContent>
<Stack sx={{ gap: 2.5 }}>
<Typography
variant="small"
sx={{ color: "text.muted" }}
>
- This prompt is used as-is. Use $date anywhere
- to insert the current date and time. Leave
- blank to use the default prompt.
+ This prompt is used as-is. Use $date anywhere to
+ insert the current date and time. Leave blank to
+ use the default prompt.
</Typography>
<TextField
fullWidth
@@ -895,7 +889,6 @@ export const ChatDialogs = memo(
},
}}
/>
-
</>
);
},
diff --git a/web/apps/ensu/src/pages/chat.tsx b/web/apps/ensu/src/pages/chat.tsx
index ef7fd3625b..dba835fca3 100644
--- a/web/apps/ensu/src/pages/chat.tsx
+++ b/web/apps/ensu/src/pages/chat.tsx
@@ -1886,15 +1886,13 @@ const Page: React.FC = () => {
const augmented: ChatMessage[] = [];
for (let i = 0; i < base.length; i++) {
const msg = base[i];
+ if (!msg) continue;
augmented.push(msg);
if (msg.sender === "self") {
const next = base[i + 1];
const isLastAndGenerating =
i === base.length - 1 && isGenerating;
- if (
- next?.sender !== "assistant" &&
- !isLastAndGenerating
- ) {
+ if (next?.sender !== "assistant" && !isLastAndGenerating) {
augmented.push({
messageUuid: `interrupted-placeholder-${msg.messageUuid}`,
sessionUuid: msg.sessionUuid,
@@ -1918,7 +1916,13 @@ const Page: React.FC = () => {
return [...augmented, streamingMessage];
}
return augmented;
- }, [messageState.path, streamingParentId, streamingText, currentSessionId, isGenerating]);
+ }, [
+ messageState.path,
+ streamingParentId,
+ streamingText,
+ currentSessionId,
+ isGenerating,
+ ]);
const branchSwitchers = messageState.switchers;
@@ -3639,7 +3643,9 @@ const Page: React.FC = () => {
}
}
setSystemPrompt(
- isDefaultPrompt ? DEFAULT_CHAT_SYSTEM_PROMPT_BODY : normalizedPrompt,
+ isDefaultPrompt
+ ? DEFAULT_CHAT_SYSTEM_PROMPT_BODY
+ : normalizedPrompt,
);
setShowSystemPromptSettings(false);
}, [systemPrompt]);
@@ -4454,9 +4460,7 @@ const Page: React.FC = () => {
systemPrompt={systemPrompt}
setSystemPrompt={setSystemPrompt}
handleSaveSystemPrompt={handleSaveSystemPrompt}
- handleUseDefaultSystemPrompt={
- handleUseDefaultSystemPrompt
- }
+ handleUseDefaultSystemPrompt={handleUseDefaultSystemPrompt}
syncNotificationOpen={syncNotificationOpen}
setSyncNotificationOpen={setSyncNotificationOpen}
syncNotification={syncNotification}
diff --git a/web/apps/ensu/src/services/llm/provider.ts b/web/apps/ensu/src/services/llm/provider.ts
index 48e5b52143..2902f67bce 100644
--- a/web/apps/ensu/src/services/llm/provider.ts
+++ b/web/apps/ensu/src/services/llm/provider.ts
@@ -355,9 +355,7 @@ export class LlmProvider {
private async resolveDefaultModelForDevice() {
this.defaultModel =
- this.backend.kind === "tauri"
- ? TAURI_DEFAULT_MODEL
- : DEFAULT_MODEL;
+ this.backend.kind === "tauri" ? TAURI_DEFAULT_MODEL : DEFAULT_MODEL;
if (this.backend.kind !== "tauri") {
return;