jbilcke-hf HF Staff commited on
Commit
9349de1
·
1 Parent(s): 3370e14

improvement

Browse files
src/app/engines.ts CHANGED
@@ -28,8 +28,8 @@ export const engines: Record<string, Engine> = {
28
  cartesian_video: {
29
  type: "cartesian_video",
30
  label: "Cartesian video",
31
- visible: false,
32
- enabled: false,
33
  modelName: "Zeroscope",
34
  modelUrl: "https://huggingface.co/cerspense/zeroscope_v2_576w",
35
  },
 
28
  cartesian_video: {
29
  type: "cartesian_video",
30
  label: "Cartesian video",
31
+ visible: true,
32
+ enabled: true,
33
  modelName: "Zeroscope",
34
  modelUrl: "https://huggingface.co/cerspense/zeroscope_v2_576w",
35
  },
src/app/games/city.ts CHANGED
@@ -38,7 +38,9 @@ const initialActionnables = [
38
  "tree",
39
  "river",
40
  "sea",
41
- "house"
 
 
42
  ]
43
 
44
  export const game: Game = {
 
38
  "tree",
39
  "river",
40
  "sea",
41
+ "house",
42
+ "window",
43
+ "roof"
44
  ]
45
 
46
  export const game: Game = {
src/app/games/doom.ts CHANGED
@@ -6,12 +6,16 @@ const initialSituation = [
6
  ].join(", ")
7
 
8
  const initialActionnables = [
 
 
 
9
  "gun",
10
  "person",
11
  "door",
12
  "laser",
13
  "window",
14
- "box"
 
15
  ]
16
 
17
  export const game: Game = {
 
6
  ].join(", ")
7
 
8
  const initialActionnables = [
9
+ "moon",
10
+ "dunes",
11
+ "building",
12
  "gun",
13
  "person",
14
  "door",
15
  "laser",
16
  "window",
17
+ "box",
18
+ "rocks"
19
  ]
20
 
21
  export const game: Game = {
src/app/games/dungeon.ts CHANGED
@@ -34,15 +34,16 @@ const initialSituation = [
34
  ].join(", ")
35
 
36
  const initialActionnables = [
37
- // "floor",
38
- // "fireplace",
39
  "door",
40
- // "window",
41
- "chair",
 
 
42
  "chest",
43
  "key",
 
44
  "table",
45
- // torch"
46
  ]
47
 
48
  export const game: Game = {
 
34
  ].join(", ")
35
 
36
  const initialActionnables = [
 
 
37
  "door",
38
+ "box",
39
+ "stone wall",
40
+ "torch",
41
+ "window",
42
  "chest",
43
  "key",
44
+ "machine",
45
  "table",
46
+ "fireplace"
47
  ]
48
 
49
  export const game: Game = {
src/app/games/enchanters.ts CHANGED
@@ -10,9 +10,10 @@ const initialActionnables = [
10
  "dragon",
11
  "castle",
12
  "gate",
13
- "stone wall",
14
  "lake",
15
- "roof"
 
16
  ]
17
 
18
  export const game: Game = {
 
10
  "dragon",
11
  "castle",
12
  "gate",
13
+ "rocks",
14
  "lake",
15
+ "roof",
16
+ "boat",
17
  ]
18
 
19
  export const game: Game = {
src/app/games/pirates.ts CHANGED
@@ -26,8 +26,17 @@ const lights = [
26
  ]
27
 
28
  const initialActionnables = [
29
- "chest",
30
  "box",
 
 
 
 
 
 
 
 
 
31
  // "door",
32
  // "window",
33
  // "sail",
@@ -39,8 +48,6 @@ const initialActionnables = [
39
  // "rope",
40
  // "bucket",
41
  // "skull",
42
- "parrot",
43
- "lock",
44
  // "ship",
45
  // "wooden leg"
46
  ]
 
26
  ]
27
 
28
  const initialActionnables = [
29
+ "door",
30
  "box",
31
+ "sea",
32
+ "chest",
33
+ "key",
34
+ "parrot",
35
+ "lock",
36
+ "barrel",
37
+ "tree",
38
+ "rope"
39
+ // skull
40
  // "door",
41
  // "window",
42
  // "sail",
 
48
  // "rope",
49
  // "bucket",
50
  // "skull",
 
 
51
  // "ship",
52
  // "wooden leg"
53
  ]
src/app/games/vernian.ts CHANGED
@@ -11,9 +11,12 @@ const initialActionnables = [
11
  "box",
12
  "door",
13
  "table",
14
- "blueprint",
 
15
  "gear",
16
- "machine"
 
 
17
  ]
18
 
19
  export const game: Game = {
 
11
  "box",
12
  "door",
13
  "table",
14
+ "chair",
15
+ "paper",
16
  "gear",
17
+ "machine",
18
+ "window",
19
+ "ground"
20
  ]
21
 
22
  export const game: Game = {
src/app/main.tsx CHANGED
@@ -54,8 +54,12 @@ export default function Main() {
54
  const [dialogue, setDialogue] = useState("")
55
  const [hoveredActionnable, setHoveredActionnable] = useState("")
56
 
 
 
 
57
  const loopRef = useRef<any>(null)
58
 
 
59
  const loadNextScene = async (nextSituation?: string, nextActionnables?: string[]) => {
60
 
61
  await startTransition(async () => {
@@ -72,7 +76,7 @@ export default function Main() {
72
  actionnables: (Array.isArray(nextActionnables) && nextActionnables.length
73
  ? nextActionnables
74
  : game.initialActionnables
75
- ).slice(0, 6) // too many can slow us down it seems
76
  })
77
 
78
  console.log("got the first version of our scene!", renderedRef.current)
@@ -125,6 +129,10 @@ export default function Main() {
125
  console.log("updating scene..")
126
  renderedRef.current = newRendered
127
  setRendered(renderedRef.current)
 
 
 
 
128
  }
129
  } catch (err) {
130
  console.error(err)
@@ -141,8 +149,8 @@ export default function Main() {
141
  }, [])
142
 
143
  const handleUserAction = async (actionnable: string) => {
144
- console.log("user actionnable:", actionnable)
145
-
146
 
147
  // TODO: ask Llama2 what to do about it
148
  // we need a frame and some actionnables,
@@ -232,6 +240,9 @@ export default function Main() {
232
  window.location = `${window.location.protocol + "//" + window.location.host + window.location.pathname + '?' + search.toString()}` as any
233
  }
234
 
 
 
 
235
  return (
236
  <div
237
  className="flex flex-col w-full max-w-5xl"
@@ -295,7 +306,7 @@ export default function Main() {
295
  rendered={rendered}
296
  onUserAction={handleUserAction}
297
  onUserHover={setHoveredActionnable}
298
- isLoading={rendered.status === "pending"}
299
  game={game}
300
  engine={engine}
301
  debug={debug}
 
54
  const [dialogue, setDialogue] = useState("")
55
  const [hoveredActionnable, setHoveredActionnable] = useState("")
56
 
57
+ const [isBusy, setBusy] = useState<boolean>(true)
58
+ const busyRef = useRef(true)
59
+
60
  const loopRef = useRef<any>(null)
61
 
62
+
63
  const loadNextScene = async (nextSituation?: string, nextActionnables?: string[]) => {
64
 
65
  await startTransition(async () => {
 
76
  actionnables: (Array.isArray(nextActionnables) && nextActionnables.length
77
  ? nextActionnables
78
  : game.initialActionnables
79
+ ).slice(0, 10) // too many can slow us down it seems
80
  })
81
 
82
  console.log("got the first version of our scene!", renderedRef.current)
 
129
  console.log("updating scene..")
130
  renderedRef.current = newRendered
131
  setRendered(renderedRef.current)
132
+
133
+ if (newRendered.status === "completed") {
134
+ setBusy(busyRef.current = false)
135
+ }
136
  }
137
  } catch (err) {
138
  console.error(err)
 
149
  }, [])
150
 
151
  const handleUserAction = async (actionnable: string) => {
152
+ console.log("user clicked on:", actionnable)
153
+ setBusy(busyRef.current = true)
154
 
155
  // TODO: ask Llama2 what to do about it
156
  // we need a frame and some actionnables,
 
240
  window.location = `${window.location.protocol + "//" + window.location.host + window.location.pathname + '?' + search.toString()}` as any
241
  }
242
 
243
+ // determine when to show the spinner
244
+ const isLoading = isBusy || rendered.status === "pending"
245
+
246
  return (
247
  <div
248
  className="flex flex-col w-full max-w-5xl"
 
306
  rendered={rendered}
307
  onUserAction={handleUserAction}
308
  onUserHover={setHoveredActionnable}
309
+ isLoading={isLoading}
310
  game={game}
311
  engine={engine}
312
  debug={debug}
src/app/queries/getActionnables.ts CHANGED
@@ -31,8 +31,8 @@ export const getActionnables = async ({
31
  content: [
32
  `You are an API endpoint that can return a list of objects visible in the background image of a role playing game.`,
33
  basePrompt,
34
- `You must list basic name of characters or visible objects (eg. "parrot", "chest", "spaceship", "glass", "door", "person", "window", "light", "knob", "button" etc) but don't list any word from abstract concepts (ig. don't say things like "secret", "danger", "next move" etc)`,
35
- `The answer must be a JSON array, ie. a list of quoted strings.`
36
  ].filter(item => item).join("\n")
37
  },
38
  {
 
31
  content: [
32
  `You are an API endpoint that can return a list of objects visible in the background image of a role playing game.`,
33
  basePrompt,
34
+ `You must list ten (10) basic names of visible objects (eg. "door", "person", "window", "light", "knob", "button", "rock", "tree", "parrot", "chest", "glass".. etc) but don't list any word from abstract or immaterial concepts (ig. don't list words like "secret", "danger", "next move", "game" etc)`,
35
+ `The answer must be a JSON array, ie. a list of 10 quoted strings.`
36
  ].filter(item => item).join("\n")
37
  },
38
  {