Skip to content

Commit

Permalink
fix(web): resolved web build issues with yarn and missing dependencies (
Browse files Browse the repository at this point in the history
  • Loading branch information
aagnone3 authored and Hopshine committed Sep 10, 2024
1 parent ff5b4b3 commit 88b106b
Show file tree
Hide file tree
Showing 6 changed files with 6,803 additions and 20,054 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build Web Application

# Triggered when the web directory or this file is changed
on:
pull_request:
branches:
- main
paths:
- web/**
- .github/workflows/build-web.yml
push:
branches:
- main
paths:
- web/**
- .github/workflows/build-web.yml

concurrency:
group: ${{ github.event.number || github.run_id }}
cancel-in-progress: true

defaults:
run:
# Runs all jobs in the web directory
working-directory: ./web

jobs:
build-web:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# FIXME: Add windows-latest support
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install dependencies
run: |
yarn install
- name: Build web application
run: |
yarn build
23 changes: 23 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import functools
import json
import os
import platform
import re
Expand Down Expand Up @@ -753,6 +754,25 @@ def init_install_requires():
],
)


class PrintExtrasCommand(setuptools.Command):
description = "print extras_require"
user_options = [
('output=', 'o', 'Path to output the extras_require JSON'),
]

def initialize_options(self):
self.output = None

def finalize_options(self):
if self.output is None:
raise ValueError("output is not set")

def run(self):
with open(self.output, 'w') as f:
json.dump(setup_spec.unique_extras, f, indent=2)


setuptools.setup(
name="dbgpt",
packages=packages,
Expand All @@ -770,6 +790,9 @@ def init_install_requires():
license="https://opensource.org/license/mit/",
python_requires=">=3.10",
extras_require=setup_spec.unique_extras,
cmdclass={
'print_extras': PrintExtrasCommand,
},
entry_points={
"console_scripts": [
"dbgpt=dbgpt.cli.cli_scripts:main",
Expand Down
8 changes: 4 additions & 4 deletions web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ Also, it is a **LLM to Vision** solution.
### Prerequisites

- [Node.js](https://nodejs.org/) >= 16
- [npm](https://npmjs.com/) >= 8
- [yarn](https://yarnpkg.com/) >= 1.22
- Supported OSes: Linux, macOS and Windows

### Installation

```sh
# Install dependencies
npm install
yarn install
```

### Usage
Expand All @@ -54,13 +54,13 @@ edit the `API_BASE_URL` to the real address

```sh
# development model
npm run dev
yarn dev
```

## 🚀 Use In DB-GPT

```sh
npm run compile
yarn compile

# copy compile file to DB-GPT static file dictory
cp -rf out/* ../dbgpt/app/static
Expand Down
Loading

0 comments on commit 88b106b

Please sign in to comment.