4import { useAuth } from "../hooks/useAuth.tsx";
5
6export function LoginRoute() {
7 const navigate = useNavigate();
8 const { isAuthenticated, authenticate, error } = useAuth();
1/** @jsxImportSource https://esm.sh/react@18.2.0?dev */
2
3export function Loading () {
4 return (
5 <div className="muted">
10}
11
12export function renderLayout(content: string, options: LayoutOptions): string {
13 const { title, activeTab = "dashboard", scripts = [], styles = [] } = options;
14
149 // Default scripts
150 const defaultScripts = `
151 document.addEventListener('DOMContentLoaded', function() {
152 // Tab navigation
153 document.querySelectorAll('.tab').forEach(tab => {
154 tab.addEventListener('click', function(e) {
155 if (this.getAttribute('href') === '#') {
156 e.preventDefault();
3import { Header } from "./Header.tsx";
4
5export function LayoutRoute() {
6 return (
7 <>
4import { processFiles } from "../utils/images.ts";
5
6export function InputBox ({
7 value,
8 onChange,
88}
89
90export function ImageDropContainer ({
91 images,
92 setImages,
115}
116
117export function useImageDrop ({ images, setImages, running }: {
118 images: (string|null)[];
119 setImages(images: (string|null)[]) => void;
164}
165
166function ImageRow ({ images, setImages }: {
167 images: (string|null)[];
168 setImages: (images: (string|null)[]) => void;
186}
187
188function Thumbnail ({ image, onRemove }: {
189 image: string|null;
190 onRemove: () => void;
211}
212
213function UploadButton ({
214 images,
215 setImages,
4import { MessageContext } from "./Messages.tsx";
5
6export function InlinePreview ({ part }) {
7 const project = useContext(ProjectContext);
8 const message = useContext(MessageContext);
73const SCREENSHOT_URL = "https://screenshots.valtown.net/screenshot.png";
74
75function getScreenshotURL ({
76 version,
77 endpoint,
29}
30
31export function renderInferenceCalls(
32 data: InferenceCallRow[],
33 pagination: PaginationData,
6 * Get paginated inference calls
7 */
8export async function getInferenceCalls(url: URL) {
9 const { page, pageSize } = getPaginationParams(url);
10 const usageId = url.searchParams.get("usage_id");
11 * Main entry point for the usage dashboard
12 */
13export default async function(req: Request) {
14 // Check authentication first
15 const authResponse = await basicAuthMiddleware(req);
6 * Handle API requests
7 */
8export async function handleApiRequest(req: Request): Promise<Response> {
9 const url = new URL(req.url);
10 const path = url.pathname.replace("/api/", "");
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.