16}
17
18// Helper function to build a tree structure from flat file list
19const buildFileTree = (files: Array<{ path: string; type: string }>): FileNode[] => {
20 const root: FileNode[] = [];
209};
210
211export function DirectoryTree({ files, onSelectionChange }: DirectoryTreeProps) {
212 const [treeData, setTreeData] = useState<FileNode[]>([]);
213 const [checkedState, setCheckedState] = useState<Record<string, boolean>>({});
220 }, [files]);
221
222 // Helper function to convert numbers to words (for small numbers)
223 const numberToWords = (num: number): string => {
224 const words = [
2import React, { useEffect, useState } from "https://esm.sh/react@18.2.0?dev";
3
4export function CreateProjectModal({
5 isOpen,
6 onClose,
9}
10
11export function CreateBranch({
12 projectId,
13 bearerToken,
11import { processFiles } from "./ImageUpload.tsx";
12
13export function Chat({
14 project,
15 bearerToken,
12}
13
14export function ChatMessages({
15 messages,
16 usages,
13}
14
15export function ChatInput({
16 input,
17 handleInputChange,
128 onClick={() => {
129 const customStop = (window as any).customStopRef?.current;
130 if (typeof customStop === "function") {
131 customStop();
132 }
17}
18
19export function ChatHeader({
20 project,
21 bearerToken,
17}
18
19export function BranchControl({
20 projectId,
21 projectName,
6import { Projects } from "./Projects.tsx";
7
8function safeParse(s: string) {
9 try {
10 return JSON.parse(s);
14}
15
16export function App() {
17 const [bearerToken, setBearerToken] = useLocalStorage("bearer", "");
18 const [anthropicApiKey, setAnthropicApiKey] = useLocalStorage("anthropic_api_key", "");
20 const [project, setProject_] = useState(safeParse(projectJSON));
21
22 function setProject(p: any) {
23 setProject_(p);
24 setProjectJSON(JSON.stringify(p));
25 }
26
27 function handleLogout() {
28 setBearerToken("");
29 // Keep the anthropic API key in case the user wants to reuse it
1// Fetch project files from the backend
2export async function fetchProjectFiles(
3 { bearerToken, projectId, branchId }: { bearerToken: string; projectId: string; branchId?: string },
4) {
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.