ElisaTrippetti commited on
Commit
314cbda
·
verified ·
1 Parent(s): a24b67f

Upload 8 files

Browse files
static/chat-engine.jsx CHANGED
@@ -89,7 +89,7 @@ async function generateReply({ userInput, history, backend }) {
89
  const data = await callDockerBackend({ userInput, history });
90
  const text = (data.reply || "").trim();
91
  if (!text) return { text: pickFallback(), fact, source: "fallback" };
92
- return { text, fact: data.fact || fact, source: "docker" };
93
  } catch (err) {
94
  console.warn("Fetch: docker backend failed, using local fallback.", err);
95
  }
 
89
  const data = await callDockerBackend({ userInput, history });
90
  const text = (data.reply || "").trim();
91
  if (!text) return { text: pickFallback(), fact, source: "fallback" };
92
+ return { text, fact: data.fact || fact, source: "BlenderBot" };
93
  } catch (err) {
94
  console.warn("Fetch: docker backend failed, using local fallback.", err);
95
  }
static/debug-panel.jsx CHANGED
@@ -68,7 +68,7 @@ function DebugLog({ debug, palette }) {
68
  if (debug.length === 0) {
69
  return (
70
  <div style={{ color: palette.dim, fontStyle: "italic", padding: "8px 4px" }}>
71
- No turns yet. Ask Fetch Good Boi something.
72
  </div>
73
  );
74
  }
 
68
  if (debug.length === 0) {
69
  return (
70
  <div style={{ color: palette.dim, fontStyle: "italic", padding: "8px 4px" }}>
71
+ No turns yet. Ask Fetch something.
72
  </div>
73
  );
74
  }
static/variant-editorial.jsx CHANGED
@@ -1,7 +1,7 @@
1
  // variant-editorial.jsx — Fetch Good Boi as an editorial reading experience.
2
  // Centered narrow column, big Instrument Serif title, messages read as
3
  // paragraphs with slim rules between turns. Single paw glyph as the one
4
- // dog cue. H1 + intro stay sticky; only the conversation scrolls.
5
 
6
  const editorialPalettes = {
7
  cream: { bg: "#f8f5ef", paper: "#ffffff", ink: "#1a1714", secondary: "#4a4540", muted: "#8b857a", rule: "#e6e0d4", accent: "#8a4b2a" },
@@ -59,84 +59,76 @@ function EditorialVariant({ backend, density, accent, fontPair, bubble }) {
59
  }}>
60
  <header style={{
61
  display: "flex", alignItems: "center", justifyContent: "space-between",
62
- padding: "14px 32px",
63
  color: palette.muted, fontSize: 12, letterSpacing: 1.2, textTransform: "uppercase",
64
- flexShrink: 0,
65
  }}>
66
  <div style={{ display: "flex", alignItems: "center", gap: 10 }}>
67
  <PawGlyph size={14} color={palette.accent} />
68
- <span>Fetch Good Boi · a dog-loving BlenderBot</span>
69
  </div>
70
- <div style={{ display: "flex", gap: 8, textTransform: "none", letterSpacing: 0 }}>
71
- <button onClick={reset} style={editBtn(palette)} aria-label="Clear conversation">Clear</button>
72
- <button onClick={() => setShowDebug(s => !s)} style={editBtn(palette)} aria-label="Toggle debug panel">Debug</button>
73
  </div>
74
  </header>
75
 
76
- {/* Sticky intro — stays visible as conversation scrolls */}
77
- <div style={{
78
  display: "flex", justifyContent: "center",
79
- flexShrink: 0,
80
- padding: "20px 0 0",
81
- background: palette.bg,
82
- borderBottom: `1px solid ${palette.rule}`,
83
  }}>
84
- <div style={{ width: "min(620px, 88%)", paddingBottom: 20 }}>
 
 
 
85
  <h1 style={{
86
  fontFamily: fontPair.display, fontWeight: 400,
87
  fontSize: "clamp(44px, 6vw, 68px)",
88
  lineHeight: 1.02, letterSpacing: -0.5,
89
- margin: "0 0 12px",
90
  }}>
91
- This is <em style={{ fontStyle: "italic" }}>Fetch Good Boi</em>.
92
  </h1>
93
  <p style={{
94
  fontFamily: fontPair.body, fontSize: 14.5, lineHeight: 1.65,
95
  color: palette.secondary, maxWidth: 520, letterSpacing: "0.015em",
96
  margin: "0 0 8px",
97
  }}>
98
- A friendly chatbot with a soft spot for dogs, powered by BlenderBot-400M-distill.
99
- Four-turn context window · A small keyword lookup layer · A handful of fallbacks
100
  </p>
101
  <p style={{
102
- fontFamily: fontPair.body, fontSize: 13, lineHeight: 1.5,
103
- color: palette.muted, maxWidth: 520,
104
- margin: 0, fontStyle: "italic",
105
  }}>
106
  Fetch Good Boi runs on CPU, so responses may take a few seconds.
107
  </p>
108
- </div>
109
- </div>
110
 
111
- <div ref={scrollRef} style={{
112
- flex: 1, overflowY: "auto",
113
- display: "flex", justifyContent: "center",
114
- }}>
115
- <div style={{
116
- width: "min(620px, 88%)",
117
- padding: "16px 0 40px",
118
- }}>
119
- {messages.filter(m => !m.pending).map((m, i) => (
120
- <EditorialTurn
121
- key={m.id}
122
- msg={m}
123
- palette={palette}
124
- fontPair={fontPair}
125
- fontSize={fontSize}
126
- gap={gap}
127
- isFirst={i === 0}
128
- radii={radii}
129
- />
130
- ))}
131
- {pending && (
132
- <div style={{
133
- color: palette.muted, fontStyle: "italic",
134
- padding: `${gap / 2}px 0`, fontFamily: fontPair.display,
135
- fontSize: fontSize + 1,
136
- }}>
137
- Fetching an answer<EllipsisAnim />
138
- </div>
139
- )}
140
  </div>
141
  </div>
142
 
@@ -145,7 +137,6 @@ function EditorialVariant({ backend, density, accent, fontPair, bubble }) {
145
  background: palette.paper,
146
  padding: "16px 0 22px",
147
  display: "flex", justifyContent: "center",
148
- flexShrink: 0,
149
  }}>
150
  <form onSubmit={submit} style={{
151
  width: "min(620px, 88%)",
@@ -166,7 +157,7 @@ function EditorialVariant({ backend, density, accent, fontPair, bubble }) {
166
  <input
167
  value={input}
168
  onChange={e => setInput(e.target.value)}
169
- placeholder="Ask Fetch Good Boi a question"
170
  autoFocus
171
  disabled={pending}
172
  style={{
@@ -243,7 +234,7 @@ function EditorialTurn({ msg, palette, fontPair, fontSize, gap, isFirst, radii }
243
 
244
  function EditorialSuggestions({ suggestions, onPick, palette, fontPair, pending }) {
245
  return (
246
- <div style={{ display: "flex", flexWrap: "wrap", gap: 8 }}>
247
  {suggestions.map((s, i) => (
248
  <button
249
  key={s}
@@ -251,10 +242,12 @@ function EditorialSuggestions({ suggestions, onPick, palette, fontPair, pending
251
  onClick={() => onPick(s)}
252
  disabled={pending}
253
  style={{
 
 
254
  border: `1px solid ${palette.rule}`,
255
  background: "transparent", color: palette.ink,
256
  fontFamily: fontPair.body, fontSize: 13,
257
- padding: "7px 14px", borderRadius: 999,
258
  cursor: pending ? "default" : "pointer",
259
  opacity: pending ? 0.5 : 1,
260
  animation: `fetch-fadein .4s ease ${i * 60}ms both`,
@@ -265,21 +258,10 @@ function EditorialSuggestions({ suggestions, onPick, palette, fontPair, pending
265
  );
266
  }
267
 
268
- function editBtn(p) {
269
  return {
270
- background: "transparent",
271
- border: `1px solid ${p.muted}`,
272
- padding: "6px 10px",
273
- minHeight: 32,
274
- color: p.secondary,
275
- fontSize: 12,
276
- cursor: "pointer",
277
- fontFamily: "inherit",
278
- borderRadius: 4,
279
- letterSpacing: 0.8,
280
- textTransform: "uppercase",
281
- display: "inline-flex",
282
- alignItems: "center",
283
  };
284
  }
285
 
 
1
  // variant-editorial.jsx — Fetch Good Boi as an editorial reading experience.
2
  // Centered narrow column, big Instrument Serif title, messages read as
3
  // paragraphs with slim rules between turns. Single paw glyph as the one
4
+ // dog cue.
5
 
6
  const editorialPalettes = {
7
  cream: { bg: "#f8f5ef", paper: "#ffffff", ink: "#1a1714", secondary: "#4a4540", muted: "#8b857a", rule: "#e6e0d4", accent: "#8a4b2a" },
 
59
  }}>
60
  <header style={{
61
  display: "flex", alignItems: "center", justifyContent: "space-between",
62
+ padding: "18px 32px",
63
  color: palette.muted, fontSize: 12, letterSpacing: 1.2, textTransform: "uppercase",
 
64
  }}>
65
  <div style={{ display: "flex", alignItems: "center", gap: 10 }}>
66
  <PawGlyph size={14} color={palette.accent} />
67
+ <span>Fetch · a dog-loving BlenderBot</span>
68
  </div>
69
+ <div style={{ display: "flex", gap: 18, textTransform: "none", letterSpacing: 0 }}>
70
+ <button onClick={reset} style={editLink(palette)}>Clear</button>
71
+ <button onClick={() => setShowDebug(s => !s)} style={editLink(palette)}>Debug</button>
72
  </div>
73
  </header>
74
 
75
+ <div ref={scrollRef} style={{
76
+ flex: 1, overflowY: "auto",
77
  display: "flex", justifyContent: "center",
 
 
 
 
78
  }}>
79
+ <div style={{
80
+ width: "min(620px, 88%)",
81
+ padding: "24px 0 40px",
82
+ }}>
83
  <h1 style={{
84
  fontFamily: fontPair.display, fontWeight: 400,
85
  fontSize: "clamp(44px, 6vw, 68px)",
86
  lineHeight: 1.02, letterSpacing: -0.5,
87
+ margin: "16px 0 12px",
88
  }}>
89
+ This is <em style={{ fontStyle: "italic" }}>Fetch</em>.
90
  </h1>
91
  <p style={{
92
  fontFamily: fontPair.body, fontSize: 14.5, lineHeight: 1.65,
93
  color: palette.secondary, maxWidth: 520, letterSpacing: "0.015em",
94
  margin: "0 0 8px",
95
  }}>
96
+ And it's a <em style={{ fontStyle: "italic" }}>Good Boi</em>. Four-turn memory · Keyword lookup layer · Powered by BlenderBot-400M-distill
 
97
  </p>
98
  <p style={{
99
+ fontFamily: fontPair.body, fontSize: 14, lineHeight: 1.55,
100
+ color: palette.secondary, maxWidth: 520, letterSpacing: "0.02em",
101
+ margin: "0 0 28px",
102
  }}>
103
  Fetch Good Boi runs on CPU, so responses may take a few seconds.
104
  </p>
 
 
105
 
106
+ <div style={{
107
+ borderTop: `1px solid ${palette.rule}`,
108
+ paddingTop: 8,
109
+ }}>
110
+ {messages.filter(m => !m.pending).map((m, i) => (
111
+ <EditorialTurn
112
+ key={m.id}
113
+ msg={m}
114
+ palette={palette}
115
+ fontPair={fontPair}
116
+ fontSize={fontSize}
117
+ gap={gap}
118
+ isFirst={i === 0}
119
+ radii={radii}
120
+ />
121
+ ))}
122
+ {pending && (
123
+ <div style={{
124
+ color: palette.muted, fontStyle: "italic",
125
+ padding: `${gap / 2}px 0`, fontFamily: fontPair.display,
126
+ fontSize: fontSize + 1,
127
+ }}>
128
+ Fetching an answer<EllipsisAnim />
129
+ </div>
130
+ )}
131
+ </div>
 
 
 
132
  </div>
133
  </div>
134
 
 
137
  background: palette.paper,
138
  padding: "16px 0 22px",
139
  display: "flex", justifyContent: "center",
 
140
  }}>
141
  <form onSubmit={submit} style={{
142
  width: "min(620px, 88%)",
 
157
  <input
158
  value={input}
159
  onChange={e => setInput(e.target.value)}
160
+ placeholder="Ask Fetch something"
161
  autoFocus
162
  disabled={pending}
163
  style={{
 
234
 
235
  function EditorialSuggestions({ suggestions, onPick, palette, fontPair, pending }) {
236
  return (
237
+ <div style={{ display: "flex", gap: 8, flexWrap: "nowrap", overflow: "hidden" }}>
238
  {suggestions.map((s, i) => (
239
  <button
240
  key={s}
 
242
  onClick={() => onPick(s)}
243
  disabled={pending}
244
  style={{
245
+ flex: "1 1 0", minWidth: 0,
246
+ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap",
247
  border: `1px solid ${palette.rule}`,
248
  background: "transparent", color: palette.ink,
249
  fontFamily: fontPair.body, fontSize: 13,
250
+ padding: "7px 12px", borderRadius: 999,
251
  cursor: pending ? "default" : "pointer",
252
  opacity: pending ? 0.5 : 1,
253
  animation: `fetch-fadein .4s ease ${i * 60}ms both`,
 
258
  );
259
  }
260
 
261
+ function editLink(p) {
262
  return {
263
+ background: "transparent", border: "none", padding: "4px 0",
264
+ color: p.muted, fontSize: 13, cursor: "pointer", fontFamily: "inherit",
 
 
 
 
 
 
 
 
 
 
 
265
  };
266
  }
267