Compare commits
No commits in common. "19288853e50e1376254fa5b54b5830f620291248" and "19e03cf3608343ef55a47531ea8c1fb41dbd129e" have entirely different histories.
19288853e5
...
19e03cf360
@ -39,7 +39,7 @@ pnpm run build
|
||||
```
|
||||
|
||||
```sh
|
||||
pm2 start --name "Sigit-DVM" npm -- start
|
||||
pm2 start --name "Sigit-DVM" -- start
|
||||
```
|
||||
|
||||
## Make PM2 auto start on reboot
|
||||
|
@ -18,8 +18,7 @@ export async function blockChainBlockNumberJob(
|
||||
return closestObject.block_index.toString()
|
||||
})
|
||||
.catch((err) => {
|
||||
log('err in blockChain request :>> ', err)
|
||||
|
||||
console.log('err in blockChain request :>> ', err)
|
||||
return Promise.reject(err)
|
||||
})
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { NDKEvent, type NostrEvent } from '@nostr-dev-kit/ndk'
|
||||
import axios from 'axios'
|
||||
import FormData from 'form-data'
|
||||
import { log } from '../main.js'
|
||||
import { fetchFileFromInput } from '../utils/fetch-file-from-input.js'
|
||||
import { ndk, log } from '../main.js'
|
||||
import { ndk } from '../main.js'
|
||||
// import { fileTypeFromFile, type FileTypeResult } from 'file-type';
|
||||
import { exec } from 'child_process'
|
||||
import fs from 'fs'
|
||||
@ -42,8 +43,7 @@ export async function speechToTextJob(event: NDKEvent): Promise<string> {
|
||||
}
|
||||
const formData = new FormData()
|
||||
const a = fs.createReadStream(file)
|
||||
|
||||
log({ a })
|
||||
console.log({ a })
|
||||
|
||||
formData.append('file', a)
|
||||
formData.append('model', 'whisper-1')
|
||||
@ -57,14 +57,12 @@ export async function speechToTextJob(event: NDKEvent): Promise<string> {
|
||||
})
|
||||
.then((response) => {
|
||||
const { text } = response.data
|
||||
|
||||
log({ text })
|
||||
|
||||
console.log({ text })
|
||||
resolve(text)
|
||||
// Handle response
|
||||
})
|
||||
.catch((error) => {
|
||||
log({ error })
|
||||
console.log({ error })
|
||||
// Handle error
|
||||
})
|
||||
}, 1000)
|
||||
@ -80,11 +78,9 @@ export async function speechToTextJob(event: NDKEvent): Promise<string> {
|
||||
const endTime = range[3]
|
||||
const randomName = Math.random().toString(36).substring(7) + '.mp3'
|
||||
const command = `ffmpeg -ss ${startTime} -to ${endTime} -i ${file} -vn -acodec copy ${randomName}`
|
||||
|
||||
log({ startTime, endTime, randomName, command })
|
||||
|
||||
console.log({ startTime, endTime, randomName, command })
|
||||
exec(command, (error, stderr, stdout) => {
|
||||
log('ffmpeg', { error, stderr, stdout })
|
||||
console.log('ffmpeg', { error, stderr, stdout })
|
||||
|
||||
whisperCommand(resolve, randomName)
|
||||
})
|
||||
|
@ -4,7 +4,7 @@ import { inProgress } from '../jobs/reactions/in-progress.js'
|
||||
import { log } from '../main.js'
|
||||
|
||||
export async function onNewSummarizationJob(event: NDKEvent): Promise<void> {
|
||||
log('New summarization job')
|
||||
console.log('New summarization job')
|
||||
|
||||
await validateJobRequest(event).catch((err) =>
|
||||
log(`Job validation error: `, err)
|
||||
|
@ -14,7 +14,7 @@ export async function publishStatus(
|
||||
tags: [['status', status], ...extraTags]
|
||||
})
|
||||
|
||||
log({ extraTags })
|
||||
console.log({ extraTags })
|
||||
|
||||
reactEvent.tag(event, 'job')
|
||||
await reactEvent.sign()
|
||||
|
@ -257,7 +257,9 @@ async function processJobEvent(event: NDKEvent, type: JobType): Promise<void> {
|
||||
|
||||
await startProcessing()
|
||||
|
||||
await publishStatus(event, 'finished').catch((err) => log('err :>> ', err))
|
||||
await publishStatus(event, 'finished').catch((err) =>
|
||||
console.log('err :>> ', err)
|
||||
)
|
||||
|
||||
if (jobAmount > paidAmount && waitForPaymentBeforePublishingResult()) {
|
||||
await reqPayment()
|
||||
|
@ -2,7 +2,7 @@ import { NDKEvent, type NostrEvent } from '@nostr-dev-kit/ndk'
|
||||
import validateExpiration from './expiration.js'
|
||||
import validateRequester from './requester.js'
|
||||
import validateNoRecentResults from './no-recent-results.js'
|
||||
import { ndk, log } from '../main.js'
|
||||
import { ndk } from '../main.js'
|
||||
import { addAmount } from '../job-types/speech-to-text.js'
|
||||
|
||||
export async function validateJobRequest(event: NDKEvent): Promise<void> {
|
||||
@ -40,8 +40,7 @@ export async function requirePayment(
|
||||
payReq.tag(event, 'job')
|
||||
|
||||
await payReq.sign()
|
||||
|
||||
log(payReq.rawEvent())
|
||||
console.log(payReq.rawEvent())
|
||||
|
||||
if (publish !== false) await payReq.publish()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user