Skip to content

Commit

Permalink
Schema
Browse files Browse the repository at this point in the history
  • Loading branch information
RealAlexandreAI committed May 19, 2024
1 parent 4623e39 commit 56c20d7
Show file tree
Hide file tree
Showing 23 changed files with 371 additions and 194 deletions.
9 changes: 7 additions & 2 deletions .github/ISSUE_TEMPLATE/bug-report---.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@ labels: bug
---

## Describe the bug

A clear and concise description of what the bug is.

### Steps to reproduce

Steps to reproduce the behavior.

### Expected behavior

A clear and concise description of what you expected to happen.

### Environment
- OS: [e.g. Arch Linux]
- Other details that you think may affect.

- OS: [e.g. Arch Linux]
- Other details that you think may affect.

### Additional context

Add any other context about the problem here.
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request---.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ labels: enhancement
---

## Summary

Brief explanation of the feature.

### Basic example

Include a basic example or links here.

### Motivation

Why are we doing this? What use cases does it support? What is the expected outcome?
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
types: [ opened, synchronize, reopened ]

jobs:
build:
Expand All @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go-version: ['1.21', '1.22']
go-version: [ '1.21', '1.22' ]
env:
VERBOSE: 1

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- main
- master
pull_request:
types: [opened, synchronize, reopened]
types: [ opened, synchronize, reopened ]

permissions:
contents: read
Expand All @@ -16,8 +16,8 @@ jobs:
golangci:
strategy:
matrix:
go: ['1.21', '1.22']
os: [macos-latest]
go: [ '1.21', '1.22' ]
os: [ macos-latest ]
name: lint
runs-on: ${{ matrix.os }}
steps:
Expand Down
10 changes: 0 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,5 @@ repos:
hooks:
- id: go-fmt
- id: go-vet
- id: go-lint
- id: go-imports
- id: go-cyclo
args: [-over=15]
- id: validate-toml
- id: no-go-testing
- id: golangci-lint
- id: go-critic
- id: go-unit-tests
- id: go-build
- id: go-mod-tidy

76 changes: 62 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<!-- Improved compatibility of back to top link: See: https://github.com/RealAlexandreAI/gen-ui-go/pull/73 -->
<a name="readme-top"></a>
<!--
Expand Down Expand Up @@ -46,61 +45,97 @@


<!-- ABOUT THE PROJECT -->

## 🖌Generative UI in Golang, based on HTMX and Templ, is useful in Multi-Agent Systems.

### 🌟 Reasons to Choose gen-ui-go

🌐 Continuously Updated UI Component Library: Our UI component library is constantly expanding, offering the latest design elements and features to help developers keep their applications modern while maintaining high performance and elegance.
🌐 Continuously Updated UI Component Library: Our UI component library is constantly expanding, offering the latest
design elements and features to help developers keep their applications modern while maintaining high performance and
elegance.

🖥️ Full Backend Rendering: gen-ui-go implements full backend rendering, ensuring data security and privacy. This makes it particularly suitable for scenarios that require a high degree of data control and customized rendering logic.
🖥️ Full Backend Rendering: gen-ui-go implements full backend rendering, ensuring data security and privacy. This makes
it particularly suitable for scenarios that require a high degree of data control and customized rendering logic.

🤖 Multi-Agent Planning Support: gen-ui-go supports multi-agent systems, allowing different agents to participate in UI planning and decision-making processes, providing robust support for complex interactions and automated workflows.
🤖 Multi-Agent Planning Support: gen-ui-go supports multi-agent systems, allowing different agents to participate in UI
planning and decision-making processes, providing robust support for complex interactions and automated workflows.

🔄 Interactivity in Semi-Automatic Workflows: In semi-automatic workflows, gen-ui-go offers the capability for real-time interaction, allowing users to dynamically adjust and optimize during the running process, thereby improving efficiency and responsiveness.
🔄 Interactivity in Semi-Automatic Workflows: In semi-automatic workflows, gen-ui-go offers the capability for real-time
interaction, allowing users to dynamically adjust and optimize during the running process, thereby improving efficiency
and responsiveness.

🔧 Suitable for Dynamic Environments: Whether it's a fast-paced agile development environment or a finely controlled production environment, gen-ui-go provides the tools and flexibility needed to adapt to various development requirements.
🔧 Suitable for Dynamic Environments: Whether it's a fast-paced agile development environment or a finely controlled
production environment, gen-ui-go provides the tools and flexibility needed to adapt to various development
requirements.

### Intro

## Updates
## Updates

### Timeline

### Card

### Conversation

### Audio/Image/Video

### Button

### List
### Textarea

### Textarea

<!-- GETTING STARTED -->

## 🏁 Getting Started

To add the gen-ui-go to your Go project, use the following command:




To register more components as examples:

```
// TODO Register here
templ Button(text string) {
<button class="button" onclick="alert('Clicked!')">{ text }</button>
}
func init(){
RegisterExample("/button", Button("Click Me!"))
}
templ generate
```

<!-- ROADMAP -->

## Roadmap

- [x] Basic feature
- [ ] Modern CSS like bulma
- [ ] Registry like otel collector
- [x] Registry Example
- [ ] Registry with Schema
- [ ] More components


See the [open issues](https://github.com/RealAlexandreAI/gen-ui-go/issues) for a full list of proposed features (and known issues).
See the [open issues](https://github.com/RealAlexandreAI/gen-ui-go/issues) for a full list of proposed features (and
known issues).

<p align="right">(<a href="#readme-top">back to top</a>)</p>


<!-- CONTRIBUTING -->

## Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any
contributions you make are **greatly appreciated**.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also
simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!

1. Fork the Project
Expand All @@ -112,6 +147,7 @@ Don't forget to give the project a star! Thanks again!
<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- LICENSE -->

## License

Distributed under the GPLv3 License. See `LICENSE` for more information.
Expand All @@ -121,6 +157,7 @@ Distributed under the GPLv3 License. See `LICENSE` for more information.


<!-- CONTACT -->

## Contact

RealAlexandreAI - [@RealAlexandreAI](https://twitter.com/RealAlexandreAI)
Expand All @@ -132,16 +169,27 @@ Project Link: [https://github.com/RealAlexandreAI/gen-ui-go](https://github.com/

<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->

[contributors-shield]: https://img.shields.io/github/contributors/RealAlexandreAI/gen-ui-go.svg?style=for-the-badge

[contributors-url]: https://github.com/RealAlexandreAI/gen-ui-go/graphs/contributors

[forks-shield]: https://img.shields.io/github/forks/RealAlexandreAI/gen-ui-go.svg?style=for-the-badge

[forks-url]: https://github.com/RealAlexandreAI/gen-ui-go/network/members

[stars-shield]: https://img.shields.io/github/stars/RealAlexandreAI/gen-ui-go.svg?style=for-the-badge

[stars-url]: https://github.com/RealAlexandreAI/gen-ui-go/stargazers

[issues-shield]: https://img.shields.io/github/issues/RealAlexandreAI/gen-ui-go.svg?style=for-the-badge

[issues-url]: https://github.com/RealAlexandreAI/gen-ui-go/issues

[license-shield]: https://img.shields.io/github/license/RealAlexandreAI/gen-ui-go.svg?style=for-the-badge

[license-url]: https://github.com/RealAlexandreAI/gen-ui-go/blob/master/LICENSE

[product-screenshot]: images/screenshot.png


6 changes: 5 additions & 1 deletion component/button.templ
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package component

templ Button(text string) {
<button class="button" onclick="alert('按钮被点击了!')">{ text }</button>
<button class="button" onclick="alert('Clicked!')">{ text }</button>
}

func init() {
RegisterExample("/button", Button("Click Me!"))
}
19 changes: 13 additions & 6 deletions component/button_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions component/example_pool.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package component

import (
"fmt"
"github.com/a-h/templ"
"github.com/emirpasic/gods/v2/maps/linkedhashmap"
)

// nolint
var ExamplePool = linkedhashmap.New[string, templ.Component]()

// RegisterExample
//
// @Description:
// @param path
// @param example
func RegisterExample(path string, example templ.Component) {

if example == nil {
return
}

if _, ok := ExamplePool.Get(path); ok {
panic("duplicated path: " + path)
}

ExamplePool.Put(path, example)
}

// GetExample
//
// @Description:
// @param path
// @return templ.Component
// @return error
func GetExample(path string) (templ.Component, error) {

example, ok := ExamplePool.Get(path)
if !ok {
return nil, fmt.Errorf("not found path: %s", path)
}

return example, nil
}
Loading

0 comments on commit 56c20d7

Please sign in to comment.