generated from ubiquity/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from gentlementlegen/feat/conversation-rewards
feat: conversation rewards
- Loading branch information
Showing
7 changed files
with
54 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,8 +114,8 @@ node_modules | |
.yarn | ||
.pnp.cjs | ||
.pnp.loader.mjs | ||
.env | ||
static/dist | ||
keys | ||
coverage | ||
junit.xml | ||
|
||
*.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { exec } from "child_process"; | ||
|
||
const port = "8787"; | ||
|
||
const isWindows = process.platform === "win32"; | ||
|
||
const command = isWindows ? `netstat -ano | findstr LISTENING | findstr :${port}` : `lsof -i tcp:${port} | grep LISTEN | awk '{print $2}'`; | ||
|
||
exec(command, (error, stdout) => { | ||
if (error) { | ||
// The command will also fail on Windows if the process doesn't exist which is expected | ||
console.error(`Error executing command: ${error.message}`); | ||
return; | ||
} | ||
|
||
const pid = isWindows ? stdout.trim().split(/\s+/)[4] : stdout.trim(); | ||
|
||
if (pid) { | ||
const killCommand = isWindows ? `taskkill /F /PID ${pid}` : `kill -9 ${pid}`; | ||
exec(killCommand, (error) => { | ||
if (error) { | ||
console.error(`Error killing process: ${error.message}`); | ||
return; | ||
} | ||
console.log(`Process ${pid} killed successfully.`); | ||
}); | ||
} else { | ||
console.log("No process found listening on port 8787."); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters