7import { AppContext } from "./App.tsx";
8
9export function Header () {
10 const navigate = useNavigate();
11 const { isAuthenticated, logOut } = useAuth();
41}
42
43function ValTownLogo () {
44 return (
45 <svg
59}
60
61function DarkButton () {
62 const [dark, setDark] = useLocalStorage("DARK_MODE", false);
63 const toggle = () => {
84}
85
86function AudioButton () {
87 const {audio, setAudio} = useContext(AppContext);
88
1export default function fileWithLineNumbers(text: string, view_range = []) {
2 return [
3 undefined, // Line numbers are 1-indexed
3import { TownieIcon } from "./components/icons.tsx";
4
5export default async function (loading: boolean) {
6 const svg = renderToString(
7 <TownieIcon
4import { Messages } from "./Messages.tsx";
5
6export function DebugStyles () {
7 const [ pathname, setPathname ] = useState("");
8 return (
15import { Loading } from "./Loading.tsx";
16
17export function ChatRoute () {
18 const { projectId, branchId } = useParams() as {
19 projectId: string;
52}
53
54function Conversation ({
55 project,
56 files,
177}
178
179function shouldRefetch (message) {
180 for (let i = 0; i < message?.parts?.length; i++) {
181 let part = message.parts[i];
7const NEW_BRANCH_VAL = "__NEW_BRANCH__";
8
9export function BranchSelect () {
10 const { projectId, branchId } = useParams() as {
11 projectId: string;
26});
27
28export function App() {
29 const [audio, setAudio] = useLocalStorage("AUDIO", false);
30 return (
1import { useEffect } from "https://esm.sh/react@18.2.0?dev";
2
3export function useUsageStats (messages: any[], usages: any[]) {
4 useEffect(() => {
5 if (!messages?.length) return;
7 *
8 * @param {Array} dependencies - Array of dependencies that trigger scrolling when changed
9 * @returns {Object} An object containing containerRef and scrollToBottom function
10 */
11export function useScrollToBottomContainer(dependencies = []) {
12 const containerRef = useRef(null);
13
28
29// body scroll version
30export function useScrollToBottom(dependencies = []) {
31 const bottomRef = useRef(null);
32
5const FILES_ENDPOINT = "/api/project-files";
6
7export function useProject (projectId: string, branchId?: string) {
8 const { token } = useAuth();
9 const [data, setData] = useState<any>(null);
A helper function to build a file's email
Simple functional CSS library for Val Town
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",