T1ckbase commited on
Commit
31f5b2b
·
1 Parent(s): 13894da
Files changed (2) hide show
  1. deno.json +0 -1
  2. main.ts +17 -13
deno.json CHANGED
@@ -7,7 +7,6 @@
7
  "@ai-sdk/google": "npm:@ai-sdk/google@^1",
8
  "@std/async": "jsr:@std/async@^1",
9
  "ai": "npm:ai@^4",
10
- "dedent": "npm:dedent@^1",
11
  "zod": "npm:zod@^3"
12
  },
13
  "fmt": {
 
7
  "@ai-sdk/google": "npm:@ai-sdk/google@^1",
8
  "@std/async": "jsr:@std/async@^1",
9
  "ai": "npm:ai@^4",
 
10
  "zod": "npm:zod@^3"
11
  },
12
  "fmt": {
main.ts CHANGED
@@ -3,7 +3,6 @@ import { delay } from '@std/async';
3
  import { CoreMessage, generateText } from 'ai';
4
  import { google } from '@ai-sdk/google';
5
  import { executeBash } from './bash.ts';
6
- import dedent from 'dedent';
7
  import SYSTEM_PROMPT from './system_prompt.md' with { type: 'text' };
8
 
9
  const messages: CoreMessage[] = [
@@ -15,7 +14,7 @@ const messages: CoreMessage[] = [
15
  // { role: 'user', content: 'Welcome to Ubuntu 24.04.1 LTS' },
16
  ];
17
 
18
- // Deno.serve({ port: 7860, hostname: '0.0.0.0' }, (_req) => new Response(JSON.stringify(messages, null, 2)));
19
 
20
  const model = google('gemma-3-27b-it');
21
 
@@ -29,6 +28,15 @@ while (true) {
29
  });
30
 
31
  const command = result.text.trim();
 
 
 
 
 
 
 
 
 
32
  const output = await executeBash(command);
33
 
34
  messages.push(
@@ -36,17 +44,13 @@ while (true) {
36
  { role: 'user', content: output },
37
  );
38
 
39
- console.log(dedent`
40
- ---
41
- Assistant
42
- ---
43
- ${command}
44
-
45
- ---
46
- Bash Output
47
- ---
48
- ${output}
49
- `);
50
 
51
  await delay(1000);
52
  } catch (error) {
 
3
  import { CoreMessage, generateText } from 'ai';
4
  import { google } from '@ai-sdk/google';
5
  import { executeBash } from './bash.ts';
 
6
  import SYSTEM_PROMPT from './system_prompt.md' with { type: 'text' };
7
 
8
  const messages: CoreMessage[] = [
 
14
  // { role: 'user', content: 'Welcome to Ubuntu 24.04.1 LTS' },
15
  ];
16
 
17
+ Deno.serve({ port: 7860, hostname: '0.0.0.0' }, (_req) => new Response(JSON.stringify(messages, null, 2)));
18
 
19
  const model = google('gemma-3-27b-it');
20
 
 
28
  });
29
 
30
  const command = result.text.trim();
31
+
32
+ console.log([
33
+ '---',
34
+ 'Assistant',
35
+ '---',
36
+ command,
37
+ '',
38
+ ].join('\n'));
39
+
40
  const output = await executeBash(command);
41
 
42
  messages.push(
 
44
  { role: 'user', content: output },
45
  );
46
 
47
+ console.log([
48
+ '---',
49
+ 'Bash Output',
50
+ '---',
51
+ output,
52
+ '',
53
+ ].join('\n'));
 
 
 
 
54
 
55
  await delay(1000);
56
  } catch (error) {