jbilcke-hf HF staff commited on
Commit
7a5d912
1 Parent(s): 5164616

trying something

Browse files
Files changed (1) hide show
  1. src/app/engine/think.ts +14 -10
src/app/engine/think.ts CHANGED
@@ -5,6 +5,9 @@ import { createLlamaPrompt } from "@/lib/createLlamaPrompt"
5
 
6
  import { predict } from "./predict"
7
 
 
 
 
8
 
9
  const internalHistory: {
10
  role: string;
@@ -16,16 +19,17 @@ export const think = async (event: string, needAnswer: boolean): Promise<string>
16
  throw new Error("missing event")
17
  }
18
 
19
- internalHistory.push({
20
- role: needAnswer ? "user" : "agent",
21
- content: event,
22
- })
 
23
 
24
- if (internalHistory.length > 10) {
25
- internalHistory.shift()
26
- }
27
-
28
- if (!needAnswer) {
29
  return ""
30
  }
31
 
@@ -41,10 +45,10 @@ export const think = async (event: string, needAnswer: boolean): Promise<string>
41
  `You should be ongoing and open, ask questions, be curious, do jokes etc`,
42
  `sometimes you have trouble hearing, if you don't understand just ignore and say nothing`,
43
  `You like to answer in just one sentence`,
 
44
  ].filter(item => item).join(". ")
45
  },
46
  ...internalHistory,
47
-
48
  ])
49
 
50
 
 
5
 
6
  import { predict } from "./predict"
7
 
8
+ const context = {
9
+ lastObservedScene: ""
10
+ }
11
 
12
  const internalHistory: {
13
  role: string;
 
19
  throw new Error("missing event")
20
  }
21
 
22
+ if (needAnswer) {
23
+ internalHistory.push({
24
+ role: "user",
25
+ content: event,
26
+ })
27
 
28
+ if (internalHistory.length > 10) {
29
+ internalHistory.shift()
30
+ }
31
+ } else {
32
+ context.lastObservedScene = event
33
  return ""
34
  }
35
 
 
45
  `You should be ongoing and open, ask questions, be curious, do jokes etc`,
46
  `sometimes you have trouble hearing, if you don't understand just ignore and say nothing`,
47
  `You like to answer in just one sentence`,
48
+ context.lastObservedScene ? `You are currently talking and interacting with ${context.lastObservedScene}` : '',
49
  ].filter(item => item).join(". ")
50
  },
51
  ...internalHistory,
 
52
  ])
53
 
54