Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

feat: add the hf endpoint end var in cli gen component for chinese user better UX, add cmd/powershell tab for windows user better choice

Louis Beaumont233a74064135
diff --git a/screenpipe-app-tauri/components/cli-command-dialog.tsx b/screenpipe-app-tauri/components/cli-command-dialog.tsx
index a185b2c3f..46bde4845 100644
--- a/screenpipe-app-tauri/components/cli-command-dialog.tsx
+++ b/screenpipe-app-tauri/components/cli-command-dialog.tsx
@@ -1,4 +1,4 @@
-import React, { useState } from "react";
+import React, { useState, useEffect } from "react";
import { Button } from "@/components/ui/button";
import {
Dialog,
@@ -14,6 +14,8 @@ import { useToast } from "@/components/ui/use-toast";
import { IconCode } from "./ui/icons";
import { Settings } from "@/lib/hooks/use-settings";
import { getCliPath } from "@/lib/utils";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "./ui/tabs";
+import { platform } from "@tauri-apps/plugin-os";
interface CliCommandDialogProps {
settings: Settings;
@@ -23,11 +25,22 @@ export function CliCommandDialog({ settings }: CliCommandDialogProps) {
const [isOpen, setIsOpen] = useState(false);
const { copyToClipboard } = useCopyToClipboard({ timeout: 2000 });
const { toast } = useToast();
+ const [isWindows, setIsWindows] = useState(false);
+
+ useEffect(() => {
+ const p = platform();
+ setIsWindows(p === "windows");
+ }, []);
const generateCliCommand = () => {
const cliPath = getCliPath();
+ let envVars = [];
let args = [];
+ if (settings.useChineseMirror) {
+ envVars.push('HF_ENDPOINT="https://hf-mirror.com"');
+ }
+
if (settings.audioTranscriptionEngine !== "default") {
// TBD hard coded for now
// if someone wants to use deepgram / screenpipe cloud in CLI mode they'll ask us
@@ -101,7 +114,8 @@ export function CliCommandDialog({ settings }: CliCommandDialogProps) {
args.push("--enable-realtime-audio-transcription");
}
- return `${cliPath} ${args.join(" ")}`;
+ const envVarsStr = envVars.length > 0 ? `${envVars.join(" ")} ` : "";
+ return `${envVarsStr}${cliPath} ${args.join(" ")}`;
};
const handleCopyCliCommand = () => {
@@ -128,7 +142,25 @@ export function CliCommandDialog({ settings }: CliCommandDialogProps) {
</DialogDescription>
</DialogHeader>
<div className="overflow-x-auto">
- <CodeBlock language="bash" value={generateCliCommand()} />
+ {isWindows ? (
+ <Tabs defaultValue="cmd">
+ <TabsList>
+ <TabsTrigger value="cmd">cmd</TabsTrigger>
+ <TabsTrigger value="powershell">powershell</TabsTrigger>
+ </TabsList>
+ <TabsContent value="cmd">
+ <CodeBlock language="bash" value={generateCliCommand()} />
+ </TabsContent>
+ <TabsContent value="powershell">
+ <CodeBlock
+ language="powershell"
+ value={generateCliCommand()}
+ />
+ </TabsContent>
+ </Tabs>
+ ) : (
+ <CodeBlock language="bash" value={generateCliCommand()} />
+ )}
</div>
<DialogFooter>
<Button onClick={handleCopyCliCommand}>Copy to Clipboard</Button>