summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md7
-rwxr-xr-xtabby-runner/index.js62
-rwxr-xr-xtabby-runner/package.json6
-rwxr-xr-xtabby-runner/run-client.sh1
-rwxr-xr-xtabby-runner/run.sh3
5 files changed, 79 insertions, 0 deletions
diff --git a/README.md b/README.md
index ecb98f2..7cd3bce 100644
--- a/README.md
+++ b/README.md
@@ -54,6 +54,13 @@ https://tabby.tabbyml.com/docs/quick-start/register-account/
3. copy your api key into ~/.tabby_client/agent/config.toml
4. enjoy
+## for tabby autorunner
+
+1. put contents of tabby-runner/ into the same folder as tabby
+2. edit run-client.sh to use models of your liking. consult https://tabby.tabbyml.com/docs/models
+3. install node modules
+4. run the script with ./run.sh. it will open tabby automatically when vim is opened.
+
## for local llm (avante)
1. install ollama
diff --git a/tabby-runner/index.js b/tabby-runner/index.js
new file mode 100755
index 0000000..93eb768
--- /dev/null
+++ b/tabby-runner/index.js
@@ -0,0 +1,62 @@
+const cp = require('child_process');
+const exec = cp.exec;
+let child;
+
+let killTabby = () => {
+ exec( "ps aux | grep -E 'tabby'", ( error, stdout, stderr ) => {
+ if( stdout ) {
+ console.log( stdout );
+ let lines = stdout.split( '\n' );
+ for( let line of lines ) {
+ let parts = line.split( /\s+/ );
+ if( ( parts[10] === './tabby' || parts[10] == 'tabby' ) && parts[11] == 'serve' ) {
+ cp.spawnSync( 'pkill', ['-P', parts[1]], { stdio: 'inherit' } );
+ cp.spawnSync( 'kill', [parts[1]], { stdio: 'inherit' } );
+ break;
+ }
+ }
+ }
+ } );
+}
+
+
+let loop = () => {
+ exec( "ps aux | grep -E 'vim|nvim'", ( error, stdout, stderr ) => {
+ if( stdout ) {
+ console.log( stdout );
+ let lines = stdout.split( '\n' );
+ let vimOpen = false;
+ for( let line of lines ) {
+ let parts = line.split( /\s+/ );
+ if( parts[10] === 'vim' || parts[10] === 'nvim' ) {
+ vimOpen = true;
+ break;
+ }
+ }
+ if( vimOpen ) {
+ if( child ) return setTimeout( loop, 120000 );
+ child = cp.exec( `./run-client.sh` );
+ return setTimeout( loop, 5000 );
+ }
+
+ if( child ) {
+ killTabby();
+ child.kill();
+ }
+
+ child = null;
+ setTimeout( loop, 5000 );
+ } else {
+ if( child ) {
+ killTabby();
+ child.kill();
+ child = null;
+ }
+
+ setTimeout( loop, 5000 );
+ }
+ });
+
+};
+
+loop();
diff --git a/tabby-runner/package.json b/tabby-runner/package.json
new file mode 100755
index 0000000..b75791d
--- /dev/null
+++ b/tabby-runner/package.json
@@ -0,0 +1,6 @@
+{
+ "dependencies": {
+ "child_process": "^1.0.2",
+ "terminate": "^2.8.0"
+ }
+}
diff --git a/tabby-runner/run-client.sh b/tabby-runner/run-client.sh
new file mode 100755
index 0000000..9a95b4c
--- /dev/null
+++ b/tabby-runner/run-client.sh
@@ -0,0 +1 @@
+TABBY_ROOT='/media/aurelia/dev/tabby/' ./tabby serve --model /media/aurelia/dev/tabby/models/deepseek-quant --chat-model /media/aurelia/dev/tabby/models/llama3.2-1b --device cuda
diff --git a/tabby-runner/run.sh b/tabby-runner/run.sh
new file mode 100755
index 0000000..c499cf0
--- /dev/null
+++ b/tabby-runner/run.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+node index.js