Search is not available for this dataset
repo_id
stringlengths
12
110
file_path
stringlengths
24
164
content
stringlengths
3
89.3M
__index_level_0__
int64
0
0
public_repos
public_repos/weblangchain/Procfile
# Modify this Procfile to fit your needs web: uvicorn main:app --host 0.0.0.0 --port 8080
0
public_repos
public_repos/weblangchain/vercel.json
{ "git": { "deploymentEnabled": { "main": false } } }
0
public_repos
public_repos/weblangchain/poetry.lock
# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. [[package]] name = "aiohttp" version = "3.8.6" description = "Async http client/server framework (asyncio)" optional = false python-versions = ">=3.6" files = [ {file = "aiohttp-3.8.6-cp310-cp310-macosx_10_9_universal2.whl",...
0
public_repos
public_repos/weblangchain/.dockerignore
nextjs/ assets/
0
public_repos
public_repos/weblangchain/main.py
"""Main entrypoint for the app.""" import asyncio import os from operator import itemgetter from typing import List, Optional, Sequence, Tuple, Union import langsmith from fastapi import FastAPI, Request, Depends from fastapi.middleware.cors import CORSMiddleware from langchain.callbacks.manager import CallbackManager...
0
public_repos
public_repos/weblangchain/Makefile
.PHONY: start start: uvicorn main:app --reload --port 8080 .PHONY: format format: black . isort .
0
public_repos
public_repos/weblangchain/Dockerfile
FROM python:3.11-buster RUN pip install poetry==1.5.1 RUN poetry config virtualenvs.create false COPY ./pyproject.toml ./poetry.lock* ./ RUN poetry install --no-interaction --no-ansi --no-root --no-directory COPY ./*.py ./.google_vertex_ai_credentials.jso[n] ./ RUN poetry install --no-interaction --no-ansi CMD ...
0
public_repos
public_repos/weblangchain/pyproject.toml
[tool.poetry] name = "weblangchain" version = "0.1.0" description = "" authors = ["SN <6432132+samnoyes@users.noreply.github.com>"] readme = "README.md" [tool.poetry.dependencies] python = "^3.10" openai = "^0.28.0" fastapi = "^0.103.1" pydantic = "1.10" langchain = "^0.0.324" uvicorn = "^0.23.2" tiktoken = "^0.4.0" t...
0
public_repos
public_repos/weblangchain/README.md
# 🦜️🌐 WebLangChain This repo is an example of performing retrieval using the entire internet as a document store. **Try it live:** [weblangchain.vercel.app](https://weblangchain.vercel.app) ## ✅ Running locally By default, WebLangChain uses [Tavily](https://tavily.com) to fetch content from webpages. You can get ...
0
public_repos
public_repos/weblangchain/LICENSE
MIT License Copyright (c) 2023 Harrison Chase Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, di...
0
public_repos
public_repos/weblangchain/fly.toml
# fly.toml app configuration file generated for weblangchain on 2023-10-03T20:09:50-07:00 # # See https://fly.io/docs/reference/configuration/ for information about how to use this file. # app = "weblangchain" primary_region = "lax" [build] dockerfile = "Dockerfile" [env] PORT = "8080" [http_service] internal...
0
public_repos/weblangchain
public_repos/weblangchain/nextjs/yarn.lock
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 "@aashutoshrathi/word-wrap@^1.2.3": version "1.2.6" resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A...
0
public_repos/weblangchain
public_repos/weblangchain/nextjs/.eslintrc.json
{ "extends": "next/core-web-vitals" }
0
public_repos/weblangchain
public_repos/weblangchain/nextjs/tailwind.config.ts
import type { Config } from 'tailwindcss' const config: Config = { content: [ './pages/**/*.{js,ts,jsx,tsx,mdx}', './components/**/*.{js,ts,jsx,tsx,mdx}', './app/**/*.{js,ts,jsx,tsx,mdx}', ], theme: { extend: { backgroundImage: { 'gradient-radial': 'radial-gradient(var(--tw-gradient...
0
public_repos/weblangchain
public_repos/weblangchain/nextjs/tsconfig.json
{ "compilerOptions": { "target": "es5", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, "forceConsistentCasingInFileNames": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", "moduleResolution": "bundler", "re...
0
public_repos/weblangchain
public_repos/weblangchain/nextjs/postcss.config.js
module.exports = { plugins: { tailwindcss: {}, autoprefixer: {}, }, }
0
public_repos/weblangchain
public_repos/weblangchain/nextjs/.env.example
## For JS backend: # LANGCHAIN_TRACING_V2=true # LANGCHAIN_ENDPOINT="https://api.smith.langchain.com" # LANGCHAIN_API_KEY="YOUR_LANGSMITH_KEY" # LANGCHAIN_PROJECT="YOUR_PROJECT_NAME" # NEXT_PUBLIC_API_BASE_URL="http://localhost:3000/api" # OPENAI_API_KEY="YOUR_OPENAI_API_KEY" # TAVILY_API_KEY="YOUR_TAVILY_KEY"
0
public_repos/weblangchain
public_repos/weblangchain/nextjs/next.config.js
/** @type {import('next').NextConfig} */ const nextConfig = {} module.exports = nextConfig
0
public_repos/weblangchain
public_repos/weblangchain/nextjs/package.json
{ "name": "weblangchain", "version": "0.1.0", "private": true, "packageManager": "yarn@1.22.19", "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint", "format": "prettier --write \"app\"" }, "dependencies": { "@chakra-ui/icons": "^2.1.0"...
0
public_repos/weblangchain/nextjs
public_repos/weblangchain/nextjs/app/layout.tsx
import "./globals.css"; import type { Metadata } from "next"; import { Inter } from "next/font/google"; const inter = Inter({ subsets: ["latin"] }); export const metadata: Metadata = { title: "WebLangChain", description: "Chatbot that answers queries by doing research and citing sources", }; export default f...
0
public_repos/weblangchain/nextjs
public_repos/weblangchain/nextjs/app/page.tsx
"use client"; import { ChatWindow } from "../app/components/ChatWindow"; import { ToastContainer } from "react-toastify"; import { ChakraProvider } from "@chakra-ui/react"; export default function Home() { return ( <ChakraProvider> <ToastContainer /> <ChatWindow apiBaseUrl={ proce...
0
public_repos/weblangchain/nextjs
public_repos/weblangchain/nextjs/app/globals.css
@tailwind base; @tailwind components; @tailwind utilities; body { color: #f8f8f8; background: #131318; } body input, body textarea { color: black; } a:hover { text-decoration: underline; } p { margin: 8px 0; } code { color: #ffa500; } li { padding: 4px; }
0
public_repos/weblangchain/nextjs/app
public_repos/weblangchain/nextjs/app/components/InlineCitation.tsx
import { Source } from "./SourceBubble"; export function InlineCitation(props: { source: Source; sourceNumber: number; highlighted: boolean; onMouseEnter: () => any; onMouseLeave: () => any; }) { const { source, sourceNumber, highlighted, onMouseEnter, onMouseLeave } = props; return ( <a hr...
0
public_repos/weblangchain/nextjs/app
public_repos/weblangchain/nextjs/app/components/DefaultQuestion.tsx
import { MouseEventHandler } from "react"; export function DefaultQuestion(props: { question: string; onMouseUp: MouseEventHandler; }) { return ( <div onMouseUp={props.onMouseUp} className="bg-stone-700 px-2 py-1 mx-2 rounded cursor-pointer justify-center text-stone-200 hover:bg-stone-500 mb-2" ...
0
public_repos/weblangchain/nextjs/app
public_repos/weblangchain/nextjs/app/components/ChatMessageBubble.tsx
import { toast } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; import { emojisplosion } from "emojisplosion"; import { useState, useRef } from "react"; import { SourceBubble, Source } from "./SourceBubble"; import { VStack, Flex, Heading, HStack, Box, Button, Divider, Spacer, } ...
0
public_repos/weblangchain/nextjs/app
public_repos/weblangchain/nextjs/app/components/ChatWindow.tsx
"use client"; import React, { useRef, useState, useEffect } from "react"; import { useSearchParams } from "next/navigation"; import { v4 as uuidv4 } from "uuid"; import { ChatMessageBubble, Message } from "./ChatMessageBubble"; import { marked } from "marked"; import { Renderer } from "marked"; import { fetchEventSou...
0
public_repos/weblangchain/nextjs/app
public_repos/weblangchain/nextjs/app/components/SourceBubble.tsx
import "react-toastify/dist/ReactToastify.css"; import { emojisplosion } from "emojisplosion"; export type Source = { url: string; title: string; images: string[]; defaultSourceUrl?: string; }; export function SourceBubble(props: { source: Source; highlighted: boolean; index: number; onMouseEnter: () ...
0
public_repos/weblangchain/nextjs/app/api
public_repos/weblangchain/nextjs/app/api/get_trace/route.ts
// JS backend not used by default, see README for instructions. import { NextRequest, NextResponse } from "next/server"; import { Client } from "langsmith"; export const runtime = "edge"; const client = new Client(); const pollForRun = async (runId: string, retryCount = 0): Promise<string> => { await new Promise...
0
public_repos/weblangchain/nextjs/app/api
public_repos/weblangchain/nextjs/app/api/feedback/route.ts
// JS backend not used by default, see README for instructions. import { NextRequest, NextResponse } from "next/server"; import { Client } from "langsmith"; export const runtime = "edge"; const client = new Client(); export async function POST(req: NextRequest) { try { const body = await req.json(); cons...
0
public_repos/weblangchain/nextjs/app/api/chat
public_repos/weblangchain/nextjs/app/api/chat/stream_log/route.ts
// JS backend not used by default, see README for instructions. import { NextRequest, NextResponse } from "next/server"; import type { BaseLanguageModel } from "langchain/base_language"; import type { Document } from "langchain/document"; import { RunnableSequence, RunnableMap, RunnableBranch, RunnableLambda...
0
public_repos/weblangchain/nextjs/public
public_repos/weblangchain/nextjs/public/images/github-mark.svg
<svg width="98" height="96" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.01...
0
public_repos
public_repos/cli/poetry.lock
# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. [[package]] name = "aiohttp" version = "3.8.6" description = "Async http client/server framework (asyncio)" optional = false python-versions = ">=3.6" files = [ {file = "aiohttp-3.8.6-cp310-cp310-macosx_10_9_universal2.whl",...
0
public_repos
public_repos/cli/DOCS.md
# `langchain` **Usage**: ```console $ langchain [OPTIONS] COMMAND [ARGS]... ``` **Options**: * `--help`: Show this message and exit. **Commands**: * `hub`: Manage installable hub packages. * `serve`: Manage LangServe application projects. * `start`: Start the LangServe instance, whether it's... ## `langchain hub...
0
public_repos
public_repos/cli/pyproject.toml
[tool.poetry] name = "langc" version = "0.0.1" description = "" authors = ["Erick Friis <erick@langchain.dev>"] readme = "README.md" include = [ {path="project_template/**/*", format="wheel"}, {path="package_template/**/*", format="wheel"} ] [tool.poetry.dependencies] python = ">=3.8.1,<4.0" typer = {extras = ...
0
public_repos/cli
public_repos/cli/project_template/poetry.lock
# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. [[package]] name = "aiohttp" version = "3.8.6" description = "Async http client/server framework (asyncio)" optional = false python-versions = ">=3.6" files = [ {file = "aiohttp-3.8.6-cp310-cp310-macosx_10_9_universal2.whl",...
0
public_repos/cli
public_repos/cli/project_template/pyproject.toml
[tool.poetry] name = "langservehub-template" version = "0.1.0" description = "" authors = ["Your Name <you@example.com>"] readme = "README.md" [tool.poetry.dependencies] python = "^3.11" sse-starlette = "^1.6.5" tomli-w = "^1.0.0" uvicorn = "^0.23.2" fastapi = "^0.103.2" langserve = {git = "https://github.com/langchai...
0
public_repos/cli
public_repos/cli/project_template/README.md
# LangServeHub Project Template ## Installation Install the LangChain CLI if you haven't yet ```bash pip install --user --upgrade git+https://github.com/pingpong-templates/cli.git ``` And install this package's dependencies ```bash poetry install ``` ## Adding packages ```bash # if you have problems with `poe`, try `...
0
public_repos/cli/project_template
public_repos/cli/project_template/app/server.py
from fastapi import FastAPI from langserve.packages import add_package_routes app = FastAPI() add_package_routes(app, "packages") if __name__ == "__main__": import uvicorn uvicorn.run(app, host="0.0.0.0", port=8001)
0
public_repos/cli
public_repos/cli/package_template/poetry.lock
# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. [[package]] name = "aiohttp" version = "3.8.6" description = "Async http client/server framework (asyncio)" optional = false python-versions = ">=3.6" files = [ {file = "aiohttp-3.8.6-cp310-cp310-macosx_10_9_universal2.whl",...
0
public_repos/cli
public_repos/cli/package_template/pyproject.toml
[tool.poetry] name = "__package_name__" version = "0.0.1" description = "" authors = [] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = ">=0.0.313, <0.1" openai = "^0.28.1" fastapi = "^0.104.0" sse-starlette = "^1.6.5" [tool.poetry.group.dev.dependencies] langc = {git = "https://gi...
0
public_repos/cli
public_repos/cli/package_template/README.md
# __package_name_last__
0
public_repos/cli
public_repos/cli/package_template/LICENSE
MIT License Copyright (c) 2023 LangChain, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, d...
0
public_repos/cli/package_template
public_repos/cli/package_template/package_template/chain.py
from langchain.prompts import ChatPromptTemplate from langchain.chat_models import ChatOpenAI _prompt = ChatPromptTemplate.from_messages( [ ( "system", "You are a helpful assistant who speaks like a pirate", ), ("human", "{text}"), ] ) _model = ChatOpenAI() # i...
0
public_repos/cli
public_repos/cli/tests/test_utils.py
from langc.utils.git import _parse_dependency_string, DependencySource from langc.constants import DEFAULT_GIT_REPO, DEFAULT_GIT_BRANCH def test_dependency_string() -> None: assert _parse_dependency_string( "git+ssh://git@github.com/efriis/myrepo.git" ) == DependencySource( git="ssh://git@gith...
0
public_repos/cli
public_repos/cli/langc/dev_scripts.py
""" Development Scripts for Hub Packages """ from fastapi import FastAPI from langserve.packages import add_package_route from langc.utils.packages import get_package_root def create_demo_server(): """ Creates a demo server for the current hub package. """ app = FastAPI() package_root = get_packa...
0
public_repos/cli
public_repos/cli/langc/cli.py
import typer import subprocess from typing import Optional from typing_extensions import Annotated from langc.namespaces import hub from langc.namespaces import serve app = typer.Typer(no_args_is_help=True, add_completion=False) app.add_typer(hub.hub, name="hub", help=hub.__doc__) app.add_typer(serve.serve, name="ser...
0
public_repos/cli
public_repos/cli/langc/constants.py
DEFAULT_GIT_REPO = "https://github.com/pingpong-templates/hub" DEFAULT_GIT_BRANCH = "main"
0
public_repos/cli/langc
public_repos/cli/langc/utils/git.py
from typing import Optional, TypedDict from pathlib import Path import shutil import re from langc.constants import DEFAULT_GIT_REPO import hashlib from git import Repo class DependencySource(TypedDict): git: str ref: Optional[str] subdirectory: Optional[str] def _get_main_branch(repo: Repo) -> Optiona...
0
public_repos/cli/langc
public_repos/cli/langc/utils/events.py
import urllib3 import json from typing import List, Dict, Any, Optional, TypedDict WRITE_KEY = "310apTK0HUFl4AOv" class EventDict(TypedDict): event: str properties: Optional[Dict[str, Any]] def create_event(event: EventDict) -> None: """ Creates a new event with the given type and payload. """ ...
0
public_repos/cli/langc
public_repos/cli/langc/utils/packages.py
from pathlib import Path from typing import Set, Optional def get_package_root(cwd: Optional[Path] = None) -> Path: # traverse path for routes to host (any directory holding a pyproject.toml file) package_root = Path.cwd() if cwd is None else cwd visited: Set[Path] = set() while package_root not in vi...
0
public_repos/cli/langc
public_repos/cli/langc/namespaces/serve.py
""" Manage LangServe application projects. """ import typer from typing import Optional, List from typing_extensions import Annotated from pathlib import Path import shutil import subprocess from langc.utils.git import copy_repo, update_repo from langc.utils.packages import get_package_root from langc.utils.events imp...
0
public_repos/cli/langc
public_repos/cli/langc/namespaces/hub.py
""" Manage installable hub packages. """ import typer from typing import Optional from typing_extensions import Annotated from pathlib import Path import shutil import subprocess import re hub = typer.Typer(no_args_is_help=True, add_completion=False) @hub.command() def new( name: Annotated[str, typer.Argument(h...
0
public_repos
public_repos/lightning-ui/yarn.lock
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 "@ampproject/remapping@^2.1.0": version "2.1.2" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.1.2.tgz#4edca94973ded9630d20101cd8559cedb8d8bd34" integrity sha512-hoyByceqwKirw7w3Z7gnIIZC3Wx3J484Y3L/cM...
0
public_repos
public_repos/lightning-ui/craco.config.js
module.exports = { devServer: { devMiddleware: { writeToDisk: true, }, }, };
0
public_repos
public_repos/lightning-ui/.prettierrc
{ "jsxSingleQuote": false, "arrowParens": "avoid", "tabWidth": 2, "useTabs": false, "printWidth": 119, "singleQuote": false, "semi": true, "endOfLine": "lf", "proseWrap": "always", "bracketSameLine": true, "quoteProps": "consistent", "trailingComma": "all", "bracketSpacing": true, "importOrd...
0
public_repos
public_repos/lightning-ui/tsconfig.json
{ "compilerOptions": { "target": "es5", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "baseUrl": "src", "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": true, "forceConsistentCasingInFileNames": true, "noFallthroughCase...
0
public_repos
public_repos/lightning-ui/.pre-commit-config.yaml
default_language_version: python: python3 ci: autofix_prs: true autoupdate_commit_msg: "[pre-commit.ci] pre-commit suggestions" autoupdate_schedule: quarterly skip: ["ui_lint"] repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: - id: end-of-file-fixer - id...
0
public_repos
public_repos/lightning-ui/cypress.json
{ "baseUrl": "http://localhost:7501", "component": { "componentFolder": "src", "testFiles": "**/*spec.{js,jsx,ts,tsx}", "video": false }, "env": { "coverage": true }, "screenshotOnRunFailure": true, "taskTimeout": 300000, "trashAssetsBeforeRuns": true, "useRelativeSnapshots": true, "...
0
public_repos
public_repos/lightning-ui/.prettierignore
.github resources build node_modules fonts
0
public_repos
public_repos/lightning-ui/README.md
![Lightning.ai Logo](https://github.com/gridai/lightning-ui/blob/master/src/resources/images/lightning-logo-with-text.svg "Lightning.ai") # Lightning UI [![CI Testing](https://github.com/gridai/lightning-ui/actions/workflows/ci-testing.yaml/badge.svg?branch=master)](https://github.com/gridai/lightning-ui/actions/work...
0
public_repos
public_repos/lightning-ui/LICENSE
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, ...
0
public_repos
public_repos/lightning-ui/package.json
{ "name": "lightning-ui", "version": "0.1.0", "private": true, "browserslist": [ "chrome >= 79", "firefox >= 86", "last 2 major versions", ">0.5%", "not iOS < 14", "not dead", "not op_mini all" ], "dependencies": { "lodash": "^4.17.21", "react-scripts": "5.0.1" }, "pe...
0
public_repos/lightning-ui
public_repos/lightning-ui/src/lightning-colors.ts
export const purple = "#6162D1"; export const menuBackground = "#F7F8FB";
0
public_repos/lightning-ui
public_repos/lightning-ui/src/index.tsx
import React from "react"; import ReactDOM from "react-dom"; import { QueryClient, QueryClientProvider } from "react-query"; import App from "./App"; import "./index.css"; import reportWebVitals from "./reportWebVitals"; const queryClient = new QueryClient(); ReactDOM.render( <React.StrictMode> <QueryClientPr...
0
public_repos/lightning-ui
public_repos/lightning-ui/src/App.tsx
import React from "react"; import ThemeProvider from "design-system/theme"; import { BrowserRouter as Router } from "react-router-dom"; import AppRoutes from "components/AppRoutes"; import useLightningWs from "hooks/useLightningWs"; function App() { useLightningWs(); return ( <ThemeProvider> <Router b...
0
public_repos/lightning-ui
public_repos/lightning-ui/src/reportWebVitals.ts
import { ReportHandler } from "web-vitals"; const reportWebVitals = (onPerfEntry?: ReportHandler) => { if (onPerfEntry && onPerfEntry instanceof Function) { import("web-vitals").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { getCLS(onPerfEntry); getFID(onPerfEntry); getFCP(onPerfEntry)...
0
public_repos/lightning-ui
public_repos/lightning-ui/src/index.css
html { height: 100%; width: 100%; overflow-x: hidden; } body { margin: 0; height: 100%; width: 100%; font-family: "Inter", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; ...
0
public_repos/lightning-ui
public_repos/lightning-ui/src/react-app-env.d.ts
/// <reference types="react-scripts" />
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/utils/state.spec.ts
import { AppStage, Layout, LayoutType, LightningState } from "types/lightning"; import { childFor, componentPathFor, routesFor } from "./state"; describe("componentPathFor", () => { it("returns the full path to access a child component in the Lightning state", () => { const tests = [ { path: "", expected:...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/utils/state.ts
import get from "lodash/get"; import { LayoutBranch, LightningState } from "types/lightning"; export const componentPathFor = (path: string) => { const fullPath = path.replaceAll(".", ".flows."); const rootRemoved = fullPath.replace("root.", ""); return rootRemoved; }; export const childFor = (path: string, s...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/utils/api.ts
declare global { interface Window { // @example `/muse` app_prefix: string; } } const host = process.env.REACT_APP_LIGHTNING_API ?? window.location.origin; const prefix = window.app_prefix ?? ""; export const stateEndpoint = `${host}${prefix}/api/v1/state`; export const specEndpoint = `${host}${prefix}/ap...
0
public_repos/lightning-ui/src/shared
public_repos/lightning-ui/src/shared/utils/formatDate.spec.ts
import formatDate from "./formatDate"; describe("formatDate", () => { it("returns -- when date is undefined", () => { expect(formatDate(undefined)).to.equal("--"); }); it("returns date formatted in accordance with the designs when date is passed", () => { expect(formatDate(new Date("2020-10-01"))).to.equ...
0
public_repos/lightning-ui/src/shared
public_repos/lightning-ui/src/shared/utils/getTextWidth.ts
// re-use canvase object for better performance const CANVAS = document.createElement("canvas"); export default function getTextWidth(text: string, font: string): number { const context = CANVAS.getContext("2d"); if (!context) { throw new Error("canvas context is not available"); } context.font = font; r...
0
public_repos/lightning-ui/src/shared
public_repos/lightning-ui/src/shared/utils/formatDate.ts
const formatDate = (date: Date | undefined) => { if (typeof date === "undefined") return "--"; return date.toLocaleDateString("en-US", { day: "2-digit", month: "2-digit", year: "numeric" }); }; export default formatDate;
0
public_repos/lightning-ui/src/shared
public_repos/lightning-ui/src/shared/components/ComponentTable.tsx
import React, { ReactNode } from "react"; import { Table } from "../../design-system/components"; import ComponentStatus, { StatusEnum } from "./Status"; export type ComponentEntity = { status: StatusEnum; statusMessage?: string; name: string; type: string; provider: string; lastStartTime?: string; }; ex...
0
public_repos/lightning-ui/src/shared
public_repos/lightning-ui/src/shared/components/appDetails.json
{ "image": "/images/appImage.png", "description": "Accurate animal pose estimation is an essential step towards understanding animal behavior, and can potentially benefit many downstream", "lastEdited": "2021-06-01", "tags": ["Computer Vision", "Research"] }
0
public_repos/lightning-ui/src/shared
public_repos/lightning-ui/src/shared/components/Status.spec.tsx
import React from "react"; import mount from "tests/utils/testMount"; import Status, { StatusEnum } from "../../shared/components/Status"; describe("Status", () => { it("displays status message on info icon hover", () => { mount(<Status status={StatusEnum.FAILED} message={"A very informative and actionable fai...
0
public_repos/lightning-ui/src/shared
public_repos/lightning-ui/src/shared/components/componentTable.json
[ { "name": "Video Downloader", "type": "S3 Data Download", "provider": "AWS" }, { "name": "Pose Estimator Trainer", "type": "Lightning Model Training", "provider": "Lightning.ai" }, { "name": "Model Deploy", "type": "Lightning Deploy", "provider": "Lightning.ai" } ]
0
public_repos/lightning-ui/src/shared
public_repos/lightning-ui/src/shared/components/AppOverview.tsx
import { Stack, Typography } from "../../design-system/components"; import AppDetails, { AppDetailsProps } from "./AppDetails"; import ComponentTable, { ComponentEntity } from "./ComponentTable"; export type AppOverviewProps = { appDetails: AppDetailsProps; components: ComponentEntity[]; }; const AppOverview = (p...
0
public_repos/lightning-ui/src/shared
public_repos/lightning-ui/src/shared/components/Status.tsx
import { Box, InfoIconWithHelpTooltip, Stack } from "../../design-system/components"; import { Circle, CircleOutlined } from "../../design-system/icons"; export enum StatusEnum { NOT_YET_RUN = "Not yet run", NOT_STARTED = "Not started", UNSPECIFIED = "Unspecified", BUILDING = "Building", REQUESTING = "Reques...
0
public_repos/lightning-ui/src/shared
public_repos/lightning-ui/src/shared/components/AppDetails.tsx
import { Button, Media, Stack, Typography } from "../../design-system/components"; import { Edit, Event, ImageOutlined, LocalOffer } from "../../design-system/icons"; import formatDate from "../utils/formatDate"; export type AppDetailsProps = { image?: string; description?: string; lastEdited?: Date; tags?: st...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/components/AdminTabs.tsx
import React from "react"; import { Tabs } from "design-system/components"; import AppOverview from "shared/components/AppOverview"; import useLightningSpec from "hooks/useLightningSpec"; import useLightningState from "hooks/useLightningState"; import { AppStage, LightningSpec, LightningState, WorkStage } from "types...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/components/IFrameRoute.tsx
import { useEffect, useRef, useState } from "react"; import { Box, Stack } from "@mui/material"; import { Alert, CircularProgress } from "design-system/components"; import useLightningState from "hooks/useLightningState"; import useUpdateLightningState from "hooks/useUpdateLightningState"; type Props = { name: str...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/components/Footer.tsx
import { Box, Link, Paper, Stack, Typography } from "design-system/components"; export default function Footer(props: { hideFooterShadow?: boolean }) { return ( <> {!props.hideFooterShadow && ( <Paper elevation={1} sx={{ position: "absolute", left: 0, ...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/components/AppRoutes.tsx
import React from "react"; import { Navigate, Route, Routes } from "react-router-dom"; import useLightningState from "hooks/useLightningState"; import { layoutFor } from "utils/state"; import AppView from "./AppView"; import LayoutView from "./LayoutView"; export default function LightningAppRoutes() { const ligh...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/components/IFrameRoute.spec.tsx
import React from "react"; import mount from "tests/utils/testMount"; import IFrameRoute from "./IFrameRoute"; describe("IFrameRoute", () => { it("renders an <iframe> element for the given route", () => { mount(<IFrameRoute name="test" iframeTargetUrl="http://lightning.ai" />); cy.get("iframe").should("ha...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/components/Actions.tsx
import React from "react"; import { Button, Label, Stack } from "design-system/components"; import useAdminUrl from "hooks/useAdminUrl"; import useRuntime, { Runtime } from "hooks/useRuntime"; export default function Actions() { const runtime = useRuntime(); const adminUrl = useAdminUrl(); const runningLabel ...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/components/Components.tsx
import React, { ReactNode } from "react"; import { Box, Table } from "design-system/components"; import useLightningSpec from "hooks/useLightningSpec"; const Container = ({ children }: { children: ReactNode }) => <Box sx={{ marginBottom: "46px" }}>{children}</Box>; const getComponentName = ({ affiliation, cls_name ...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/components/Actions.spec.tsx
import React from "react"; import { location } from "utils/api"; import mount from "tests/utils/testMount"; import Actions from "./Actions"; describe("Actions", () => { it("displays correct message when app is running locally", () => { mount(<Actions />); cy.contains("Running Locally").should("be.visible...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/components/AppRoutes.spec.tsx
import React from "react"; import { Link } from "react-router-dom"; import { Layout, LightningState } from "types/lightning"; import { stateEndpoint } from "tests/utils/lightning"; import mount from "tests/utils/testMount"; import AppRoutesComponent from "./AppRoutes"; // Need to add `<Link>` elements to the compo...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/components/AppView.spec.tsx
import React from "react"; import { stateEndpoint } from "tests/utils/lightning"; import mount from "tests/utils/testMount"; import AppView from "./AppView"; describe("AppView", () => { it("renders message if app is not running", () => { cy.intercept("GET", stateEndpoint, { fixture: "app-state--simple-layout" ...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/components/AdminTabs.spec.tsx
import React from "react"; import mount from "tests/utils/testMount"; import AdminTabs from "./AdminTabs"; describe("AdminTabs", () => { const appOverviewTitle = "App Overview"; const componentsTitle = "Components"; it("renders the correct tabs", () => { mount(<AdminTabs />); cy.contains(appOverviewT...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/components/ComponentTabs.tsx
import { Tabs } from "design-system/components"; import useLightningState from "hooks/useLightningState"; import { LayoutBranch } from "types/lightning"; import { routesFor } from "utils/state"; export default function ComponentTabs() { const lightningState = useLightningState(); if (lightningState.isLoading || ...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/components/Components.spec.tsx
import React from "react"; import { LightningSpec } from "types/lightning"; import { specEndpoint } from "tests/utils/lightning"; import mount from "tests/utils/testMount"; import Components from "./Components"; describe("Components", () => { describe("an app without any components", () => { beforeEach(() => ...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/components/AppView.tsx
import React from "react"; import { Box, Stack } from "design-system/components"; import { Link, Outlet } from "react-router-dom"; import ComponentTabs from "components/ComponentTabs"; import Footer from "components/Footer"; import useLightningState from "hooks/useLightningState"; import lightningLogo from "resources...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/components/ComponentTabs.spec.tsx
import React from "react"; import { Layout, LightningState } from "types/lightning"; import { stateEndpoint } from "tests/utils/lightning"; import mount from "tests/utils/testMount"; import ComponentTabs from "./ComponentTabs"; describe("ComponentTabs", () => { it("fetches the app state from the API on mount", ()...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/components/LayoutView.spec.tsx
import React from "react"; import { Layout, LayoutBranch, LayoutLeaf, LightningState } from "types/lightning"; import { stateEndpoint } from "tests/utils/lightning"; import mount from "tests/utils/testMount"; import LayoutView from "./LayoutView"; describe("LayoutView", () => { beforeEach(() => { cy.intercept...
0
public_repos/lightning-ui/src
public_repos/lightning-ui/src/components/LayoutView.tsx
import { Stack } from "design-system/components"; import useLightningState from "hooks/useLightningState"; import { Layout, LayoutBranch, LayoutLeaf } from "types/lightning"; import { childFor } from "utils/state"; import IFrameRoute from "./IFrameRoute"; type Props = { layout: Layout; }; /** * Component which r...
0
public_repos/lightning-ui/src/resources
public_repos/lightning-ui/src/resources/images/lightning-logo.svg
<svg width="33" height="38" viewBox="0 0 33 38" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M15.5629 0.195181L0.711016 8.96731C0.494828 9.09534 0.315359 9.2791 0.190577 9.50023C0.0657942 9.72135 8.06666e-05 9.97205 0 10.2273V27.7739C8.06666e-05 28.0291 0.0657942 28.2798 0.190577 28.501C0.315359 28.7221 0.4...
0
public_repos/lightning-ui/src/resources
public_repos/lightning-ui/src/resources/images/lightning-logo-with-text.svg
<svg width="127" height="28" viewBox="0 0 127 28" fill="none" xmlns="http://www.w3.org/2000/svg"> <rect x="7" y="6" width="10" height="17" fill="white"/> <path d="M11.6754 0.143818L0.533406 6.60749C0.371162 6.70176 0.236475 6.83715 0.142854 7.0001C0.0492324 7.16305 -2.80545e-05 7.34781 1.19866e-08 7.53588V20.465C6.0528...
0