mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-16 02:37:06 +00:00
basic telemetry
This commit is contained in:
19
app/src/telemetry.ts
Normal file
19
app/src/telemetry.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Analytics } from '@segment/analytics-node'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
const Store = require('electron-store')
|
||||
const store = new Store()
|
||||
|
||||
export const analytics = new Analytics({ writeKey: process.env.TELEMETRY_WRITE_KEY })
|
||||
|
||||
export function id(): string {
|
||||
const id = store.get('id')
|
||||
|
||||
if (id) {
|
||||
return id
|
||||
}
|
||||
|
||||
const uuid = uuidv4()
|
||||
store.set('id', uuid)
|
||||
return uuid
|
||||
}
|
||||
Reference in New Issue
Block a user