npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gddi-app-flow-pro

v0.0.6

Published

A React component to visualize GDDi's AI Apps in a flow chart fashion

Downloads

9

Readme

A React component to visualize and edit GDDi's AI APPs.

  • Demo: ...🚧
  • Data Explained: ...🚧

Installation

yarn add gddi-app-flow-pro

Simple Usage

import {
  AppFlow,
  ModuleDefinitions,
  AIAppType,
  Pipeline,
  Module,
  Connection,
  FetchLabelRes,
  FetchModelRes,
  FetchROIImgRes
} from 'gddi-flow'

const handleAppLoad = useCallback((app: AIAppType) => {
  app.fitView()
  console.log('app loaded')
}, [])

const handleValueChange = useCallback((val: Pipeline) => {
  console.log('val changed')
  console.log(val)
}, [])

const fetchModelList = (
  pageOffset: number,
  pageSize: number
): Promise<FetchModelRes> => {
  return fetch(
    `https://randommodels.me/api/?page=${pageOffset}&pageSize=${pageSize}`
  )
    .then((response) => response.json())
    .then((body) => {
      return body
    })
}

const fetchLabelList = (mod_result_id: string): Promise<FetchLabelRes> => {
  return fetch(`https://randomlabels.me/api/?mod_result_id=${mod_result_id}`)
    .then((response) => response.json())
    .then((body) => {
      return body
    })
}

const fetchROIImg = (
  width: number,
  height: number
): Promise<FetchROIImgRes> => {
  return new Promise<FetchROIImgRes>((resolve, reject) => {
    setTimeout(() => {
      resolve({ url: `https://place-puppy.com/${width}x${height}` })
    }, 1100)
  })
}

;<div style={{ width: '1000px', height: '800px' }}>
  // width and height of the parent element are required to be set
  <AppFlow
    lnag={'en'}
    defaultValue={myPipeline as Pipeline}
    moduleDefinitions={nodeDefinition1 as ModuleDefinitions}
    onLoad={handleAppLoad}
    onValueChange={handleValueChange}
    graphEditingDisabled={false}
    propEditingDisabled={false}
    // 获取模型列表
    fetchModelList={fetchModelList}
    // 获取labels列表
    fetchLabelList={fetchLabelList}
    // 获取用于标ROI的图
    fetchROIImg={fetchROIImg}
  />
</div>

Style

Dark Mode

set prop dark

Data Explained

moduleDefinitions

Object to describe the module's input / output endpoints, property, and other metadata.

  • Type define can be found in src/AppFlow/types.ts
  • Example can be found in src/stories/data/
export type ModulePropType = string | number | boolean | undefined

export interface ModulePropDefinition {
  // type: 'string' | 'boolean' | 'number' | 'select'
  options: ModulePropType[]
}

export interface Endpoint {
  id: number
  name: string
}

export interface ModuleDefinition {
  inputs?: Endpoint[]
  outputs?: Endpoint[]
  props?: { [propName: string]: ModulePropDefinition }
}

export interface ModuleDefinitions {
  [moduleType: string]: ModuleDefinition
}