Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
import { describe, expect, it } from "vitest";
import { initialGreeting, initialGreetingMessage, setupChoices, setupRequestLine } from "./initial-greeting.ts";
describe("the line after Set me up", () => {
it("is written in the app's language, by region, with English for any other", () => {
expect(setupRequestLine("en")).toBe(
"Great. Tell me what you'd like help with, in your own words, and I'll set myself up for it. For example: \"sort my inbox every morning\" or \"research our competitors every week\".",
);
expect(setupRequestLine("es-MX")).toMatch(/^Genial\. Cuéntame/);
expect(setupRequestLine("pt-BR")).toMatch(/^Ótimo\. Me conte/);
expect(setupRequestLine("fr")).toBe(setupRequestLine("en"));
expect(setupRequestLine(undefined)).toBe(setupRequestLine("en"));
});
it("leaves the greeting itself as it was", () => {
expect(initialGreeting("Ava", "en")).toBe("Hi, I'm Ava. What would you like me to do?");
});
});
describe("a new bot's greeting", () => {
it("names the person by their first name, in the app's language", () => {
expect(initialGreeting("Scout", "en", "Milind Soni")).toBe("Hi Milind, I'm Scout. What would you like me to do?");
expect(initialGreeting("Scout", "es-MX", " Ana María ")).toBe("Hola Ana, soy Scout. ¿Qué te gustaría que hiciera?");
expect(initialGreeting("Scout", "pt-BR", "João")).toBe("Oi João, eu sou Scout. O que você gostaria que eu fizesse?");
expect(initialGreeting("Biscuit", "it", "Vincenzo")).toBe("Ciao Vincenzo, sono Biscuit. Cosa vorresti che facessi?");
expect(initialGreeting("Scout", "zh-TW", "王小明")).toBe("嗨 王小明,我是 Scout。你想要我幫你做什麼?");
expect(initialGreeting("Scout", "zh-Hant")).toBe("嗨,我是 Scout。你想要我幫你做什麼?");
});
it("names no one when the person has not given a name", () => {
for (const person of [undefined, "", " "]) {
expect(initialGreeting("Scout", "en", person)).toBe("Hi, I'm Scout. What would you like me to do?");
}
});
});
describe("Simplified Chinese", () => {
it("greets, asks and offers the setup answers in Simplified Chinese, not English", () => {
for (const language of ["zh", "zh-CN", "zh-Hans", "zh-SG"]) {
expect(initialGreeting("Sunny", language)).toBe("你好,我是 Sunny。你希望我帮你做什么?");
expect(setupRequestLine(language)).toMatch(/^好的。用你自己的话告诉我/);
expect(setupChoices(language)).toEqual(["研究和深入探讨主题", "帮我留意各种事情", "电子邮件、日历和消息",
"预订、购物和跑腿", "数据、电子表格和报告"]);
}
expect(initialGreeting("Sunny", "zh", "王小明")).toBe("你好 王小明,我是 Sunny。你希望我帮你做什么?");
expect(initialGreetingMessage("Sunny", () => "zh", true)).toMatchObject({ text: "你好,我是 Sunny。你希望我帮你做什么?", setupOffer: true });
});
it("leaves Traditional Chinese as it was", () => {
for (const language of ["zh-TW", "zh-HK", "zh-Hant-TW"]) {
expect(initialGreeting("Sunny", language)).toBe("嗨,我是 Sunny。你想要我幫你做什麼?");
}
});
});