49/* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */
50
51export default function MessageComponent({ message, onDelete, onRetry, canRetry }: MessageProps) {
52 const formatRegularContent = (content: string) => <div dangerouslySetInnerHTML={{ __html: marked(content) }}></div>;
53
26 * @returns Promise<MCPTestResult>
27 */
28export async function testMCPServer(server: MCPServerConfig): Promise<MCPTestResult> {
29 if (!server.url) {
30 return {
122 * @returns Promise<Record<string, MCPTestResult>>
123 */
124export async function testMCPServers(servers: MCPServerConfig[]): Promise<Record<string, MCPTestResult>> {
125 const enabledServers = servers.filter(server => server.enabled && server.url);
126
27 * @returns Promise<MCPPrompt[]>
28 */
29async function fetchPromptsFromServer(server: MCPServerConfig): Promise<MCPPrompt[]> {
30 if (!server.enabled || !server.url) {
31 return [];
122 * @returns Promise<MCPPromptsResult>
123 */
124export async function fetchMCPPrompts(servers: MCPServerConfig[]): Promise<MCPPromptsResult> {
125 try {
126 if (!servers || !Array.isArray(servers)) {
181 * @returns Promise<MCPPromptsResult>
182 */
183export async function fetchMCPPromptsWithCache(
184 servers: MCPServerConfig[],
185 cacheKey: string = "mcp_prompts_cache",
246 * @param cacheKey - Cache key to clear
247 */
248export function clearMCPPromptsCache(cacheKey: string = "mcp_prompts_cache"): void {
249 localStorage.removeItem(cacheKey);
250}
13}
14
15export default function CommandPalette({
16 prompts,
17 query,
35];
36
37export default function App() {
38 const [config, setConfig] = useState<AppConfig>({
39 anthropicApiKey: "",
11}
12
13export function ChatOpenAI(model: string): ChatOpenAI {
14 const openai = new OpenAI();
15
30
31// Decorator for ChatOpenAI that will eventually add rate limiting
32export function GlobalRateLimitedChatOpenAI(model: string, requestsPerSecond: number): ChatOpenAI {
33 const openAi = ChatOpenAI(model);
34
45
46// Ensures the global rate limit table exists in the database
47async function ensureGlobalRateLimitTableExists(tableName: string) {
48 console.debug(`Ensuring table ${tableName} exists`);
49 await sqlite.execute({
6}
7
8async function getProjectFiles(
9 username: string,
10 valName: string,
40 * @returns A nested object representing the file tree
41 */
42function createFileTree(paths: string[]): FileTree {
43 const tree: FileTree = {};
44
64 * @returns A formatted string representation of the tree
65 */
66function renderTree(tree: FileTree, indent = ""): string {
67 let result = "";
68
289products.post("/reset-stock", async (c) => {
290 try {
291 // Import the function dynamically to avoid circular dependency issues
292 const { resetAllStockToZero } = await import("../database/queries.ts");
293
4import { DateTime } from "https://esm.sh/luxon@3.4.4";
5
6export async function testDailyBrief() {
7 try {
8 const testChatId = Deno.env.get("TEST_TELEGRAM_CHAT_ID");
2// Run this script manually to create the database table
3
4export default async function setupTelegramChatDb() {
5 try {
6 // Import SQLite module
A helper function to build a file's email
Simple functional CSS library for Val Town
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.