Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Merge origin/main into feat/thread-titles-always-on

milind-soni02533f88d14c
diff --cc server/thread-title-generate.ts
index f483523197,69f1a85254..2e303ae12a
--- a/server/thread-title-generate.ts
+++ b/server/thread-title-generate.ts
@@@ -1,7 -1,18 +1,13 @@@
- // Generated thread titles: automatic for every new thread, and "Regenerate title" whenever the person asks. The engine's one-shot text call, given 10 seconds, its reply cleaned to a title or null.
-// Generated thread titles: automatic ones only when features.llmThreadTitles is on, "Regenerate title" whenever the person
-// asks. The engine's one-shot text call, given 10 seconds once it starts, its reply cleaned to a title or null.
-import type { AppConfig } from "./config.ts";
++// Generated thread titles: automatic for every new thread, and "Regenerate title" whenever the person asks. The engine's
++// one-shot text call, given 10 seconds once it starts, its reply cleaned to a title or null.
+ import { backgroundTextSlots, type JobSlots } from "./job-slots.ts";
import { titleFromLlm } from "./store.ts";
import { threadTitlePrompt, type ThreadTitleSource } from "./thread-title.ts";
-export function llmThreadTitlesEnabled(cfg: Pick<AppConfig, "features">): boolean {
- return cfg.features?.llmThreadTitles === true;
-}
-
+ export const THREAD_TITLE_TIMEOUT_MS = 10_000;
+
+ /** A person sees the title soon, so the call waits ahead of background upkeep for a free slot. Past its 10 s the answer
+ * is null at once, but the slot is held until the engine call has really ended: its process still counts until then. */
export async function generateThreadTitle(
provider: { generateText?: (prompt: string, options?: { signal?: AbortSignal }) => Promise<string> },
text: string,