@@ -7,6 +7,7 @@ import {detectAvailableComputeLayers} from "../../../../bindings/utils/detectAva
7
7
import { getPlatform } from "../../../../bindings/utils/getPlatform.js" ;
8
8
import { BuildGpu , LlamaLogLevel } from "../../../../bindings/types.js" ;
9
9
import { getPrettyBuildGpuName } from "../../../../bindings/consts.js" ;
10
+ import { getModuleVersion } from "../../../../utils/getModuleVersion.js" ;
10
11
11
12
type InspectGpuCommand = {
12
13
// no options for now
@@ -21,6 +22,29 @@ export const InspectGpuCommand: CommandModule<object, InspectGpuCommand> = {
21
22
const availableComputeLayers = await detectAvailableComputeLayers ( { platform} ) ;
22
23
const gpusToLogVramUsageOf : BuildGpu [ ] = [ ] ;
23
24
25
+ console . info ( `${ chalk . yellow ( "OS:" ) } ${ os . type ( ) } ${ os . release ( ) } ${ chalk . dim ( "(" + os . arch ( ) + ")" ) } ` ) ;
26
+
27
+ if ( process . versions . node != null )
28
+ console . info ( `${ chalk . yellow ( "Node:" ) } ${ process . versions . node } ${ chalk . dim ( "(" + arch + ")" ) } ` ) ;
29
+
30
+ if ( process . versions . bun != null )
31
+ console . info ( `${ chalk . yellow ( "Bun:" ) } ${ process . versions . bun } ` ) ;
32
+
33
+ const typeScriptVersion = await getInstalledTypescriptVersion ( ) ;
34
+ if ( typeScriptVersion != null )
35
+ console . info ( `${ chalk . yellow ( "TypeScript:" ) } ${ typeScriptVersion } ` ) ;
36
+
37
+ try {
38
+ const moduleVersion = await getModuleVersion ( ) ;
39
+
40
+ if ( moduleVersion != null )
41
+ console . info ( `${ chalk . yellow ( "node-llama-cpp:" ) } ${ moduleVersion } ` ) ;
42
+ } catch ( err ) {
43
+ // do nothing
44
+ }
45
+
46
+ console . info ( ) ;
47
+
24
48
if ( platform === "mac" && arch === "arm64" ) {
25
49
console . info ( `${ chalk . yellow ( "Metal:" ) } ${ chalk . green ( "available" ) } ` ) ;
26
50
gpusToLogVramUsageOf . push ( "metal" ) ;
@@ -101,6 +125,20 @@ function getPercentageString(amount: number, total: number) {
101
125
return String ( Math . floor ( ( amount / total ) * 100 * 100 ) / 100 ) ;
102
126
}
103
127
128
+ async function getInstalledTypescriptVersion ( ) {
129
+ try {
130
+ const ts = await import ( "typescript" ) ;
131
+ const version = ts ?. version ?? ts ?. default ?. version ;
132
+
133
+ if ( version != null && typeof version === "string" && version . length > 0 )
134
+ return version ;
135
+
136
+ return null ;
137
+ } catch ( err ) {
138
+ return null ;
139
+ }
140
+ }
141
+
104
142
// // simple script to copy console logs as ansi to clipboard. Used to update the documentation
105
143
// import {spawn} from "child_process";
106
144
// const pendingLog: string[] = [];
0 commit comments