Skip to content

Commit 7da66a5

Browse files
committed
feat: add smart-whisper package with updated build configuration
1 parent a24e068 commit 7da66a5

35 files changed

+7856
-3055
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
steps:
3434
- name: Checkout code
3535
uses: actions/checkout@v4
36+
with:
37+
submodules: recursive
3638

3739
- name: Verify architecture
3840
if: matrix.os == 'macos'

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "packages/smart-whisper/whisper.cpp"]
2+
path = packages/smart-whisper/whisper.cpp
3+
url = https://github.com/ggerganov/whisper.cpp.git

apps/desktop/forge.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ let nativeModuleDependenciesToPackage: string[] = [];
2929

3030
export const EXTERNAL_DEPENDENCIES = [
3131
"electron-squirrel-startup",
32-
"smart-whisper",
32+
"@amical/smart-whisper",
3333
"@libsql/client",
3434
"@libsql/darwin-arm64",
3535
"@libsql/darwin-x64",
@@ -268,7 +268,7 @@ const config: ForgeConfig = {
268268
packagerConfig: {
269269
asar: {
270270
unpack:
271-
"{*.node,*.dylib,*.so,*.dll,*.metal,**/whisper.cpp/**,**/.vite/build/whisper-worker-fork.js,**/node_modules/smart-whisper/**,**/node_modules/jest-worker/**,**/onnxruntime-node/bin/**}",
271+
"{*.node,*.dylib,*.so,*.dll,*.metal,**/whisper.cpp/**,**/.vite/build/whisper-worker-fork.js,**/node_modules/@amical/smart-whisper/**,**/node_modules/jest-worker/**,**/onnxruntime-node/bin/**}",
272272
},
273273
name: "Amical",
274274
executableName: "Amical",

apps/desktop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
"react-hook-form": "^7.56.3",
148148
"react-resizable-panels": "^3.0.2",
149149
"recharts": "^2.15.3",
150-
"smart-whisper": "0.8.1",
150+
"@amical/smart-whisper": "workspace:*",
151151
"sonner": "^2.0.3",
152152
"split2": "^4.2.0",
153153
"superjson": "^2.2.2",

apps/desktop/src/main/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ import { app } from "electron";
55
import * as path from "path";
66

77
// Set GGML_METAL_PATH_RESOURCES before any other imports
8-
// This ensures smart-whisper can find its resources when unpacked from asar
8+
// This ensures @amical/smart-whisper can find its resources when unpacked from asar
99
if (app.isPackaged) {
1010
// Point to the unpacked whisper.cpp directory
1111
process.env.GGML_METAL_PATH_RESOURCES = path.join(
1212
process.resourcesPath,
1313
"app.asar.unpacked",
1414
"node_modules",
15+
"@amical",
1516
"smart-whisper",
1617
"whisper.cpp",
1718
);

apps/desktop/src/pipeline/providers/transcription/whisper-worker-fork.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Worker process entry point for fork
2-
import { Whisper } from "smart-whisper";
2+
import { Whisper } from "@amical/smart-whisper";
33

44
// Simple console-based logging for worker process
55
const logger = {
@@ -29,7 +29,7 @@ const methods = {
2929
whisperInstance = null;
3030
}
3131

32-
const { Whisper } = await import("smart-whisper");
32+
const { Whisper } = await import("@amical/smart-whisper");
3333
whisperInstance = new Whisper(modelPath, { gpu: true });
3434
try {
3535
await whisperInstance.load();

apps/desktop/src/pipeline/providers/transcription/whisper-worker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// This file contains just the Whisper-specific operations that need to run in a separate process
2-
import { Whisper } from "smart-whisper";
2+
import { Whisper } from "@amical/smart-whisper";
33

44
// Simple console-based logging for worker process
55
const logger = {
@@ -27,7 +27,7 @@ export async function initializeModel(modelPath: string): Promise<void> {
2727
whisperInstance = null;
2828
}
2929

30-
const { Whisper } = await import("smart-whisper");
30+
const { Whisper } = await import("@amical/smart-whisper");
3131
whisperInstance = new Whisper(modelPath, { gpu: true });
3232
try {
3333
await whisperInstance.load();

apps/desktop/vite.main.config.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default defineConfig({
2020
entryFileNames: "[name].js",
2121
},
2222
external: [
23-
"smart-whisper",
23+
"@amical/smart-whisper",
2424
"@libsql/client",
2525
"@libsql/darwin-arm64",
2626
"@libsql/darwin-x64",

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
},
2121
"pnpm": {
2222
"overrides": {
23-
"@electron-forge/maker-dmg": "https://registry.npmjs.org/@fellow/maker-dmg/-/maker-dmg-7.4.0.tgz"
23+
"@electron-forge/maker-dmg": "https://registry.npmjs.org/@fellow/maker-dmg/-/maker-dmg-7.4.0.tgz",
24+
"minimatch": "10.0.3"
2425
},
2526
"ignoredBuiltDependencies": [
2627
"@tailwindcss/oxide",

packages/smart-whisper/.gitignore

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Build outputs
5+
build/
6+
*.node
7+
bin/
8+
9+
# TypeScript outputs
10+
dist/
11+
# Keep the build configuration file
12+
!dist/build.js
13+
*.tsbuildinfo
14+
15+
# Native compilation artifacts
16+
*.o
17+
*.a
18+
*.so
19+
*.dylib
20+
*.dll
21+
*.lib
22+
*.exp
23+
*.ilk
24+
*.pdb
25+
26+
# Logs
27+
*.log
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
lerna-debug.log*
32+
.pnpm-debug.log*
33+
34+
# OS files
35+
.DS_Store
36+
Thumbs.db
37+
desktop.ini
38+
39+
# IDE files
40+
.vscode/
41+
.idea/
42+
*.swp
43+
*.swo
44+
*~
45+
46+
# Environment variables
47+
.env
48+
.env.local
49+
.env.*.local
50+
51+
# Test coverage
52+
coverage/
53+
*.lcov
54+
.nyc_output/
55+
56+
# Temporary files
57+
tmp/
58+
temp/
59+
*.tmp
60+
61+
# whisper.cpp build artifacts (if any get generated)
62+
whisper.cpp/build/
63+
whisper.cpp/*.o
64+
whisper.cpp/**/*.o

0 commit comments

Comments
 (0)