Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…e-webservice into develop
  • Loading branch information
lu-yg committed Apr 22, 2024
2 parents edc4ec8 + 6fee1e7 commit 3abf297
Show file tree
Hide file tree
Showing 21 changed files with 1,431 additions and 25 deletions.
73 changes: 73 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: '🐛 Bug report'
description: Create a report to help us improve Tiny Engine
title: '🐛 [Bug]: '
labels: ['🐛 bug']
body:
- type: markdown
attributes:
value: |
Please fill out the following carefully in order to better fix the problem.
- type: input
id: Environment
attributes:
label: Environment
description: |
**Depending on your browser and operating system, websites may behave differently from one environment to another. Make sure your developers know your technical environment.**
placeholder: Please browser information.
validations:
required: true
- type: input
id: node-version
attributes:
label: Version
description: |
### **Check if the issue is reproducible with the latest stable version.**
You can use the command `node -v` to view it
placeholder: latest
validations:
required: true
- type: input
id: tiny-vue-version
attributes:
label: Version
description: |
### **Check if the issue is reproducible with the latest stable version.**
You can use the command `npm ls @opentiny/vue` to view it
placeholder: latest
validations:
required: true
- type: textarea
id: minimal-repo
attributes:
label: Link to minimal reproduction
description: |
**Provide a streamlined CodePen / CodeSandbox or GitHub repository link as much as possible. Please don't fill in a link randomly, it will only close your issue directly.**
placeholder: Please Input
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: Step to reproduce
description: |
**After the replay is turned on, what actions do we need to perform to make the bug appear? Simple and clear steps can help us locate the problem more quickly. Please clearly describe the steps of reproducing the issue. Issues without clear reproducing steps will not be repaired. If the issue marked with 'need reproduction' does not provide relevant steps within 7 days, it will be closed directly.**
placeholder: Please Input
validations:
required: true
- type: textarea
id: expected
attributes:
label: What is expected
placeholder: Please Input
- type: textarea
id: actually
attributes:
label: What is actually happening
placeholder: Please Input
- type: textarea
id: additional-comments
attributes:
label: Any additional comments (optional)
description: |
**Some background / context of how you ran into this bug.**
placeholder: Please Input
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Questions or need help
url: https://github.com/opentiny/tiny-engine/discussions
about: Add this WeChat(opentiny), we will invite you to the WeChat discussion group later.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: ✨ Feature Request
description: Propose new features to @opentiny/tiny-engine-webservice to improve it.
title: '✨ [Feature]: '
labels: ['✨ feature']
body:
- type: textarea
id: feature-solve
attributes:
label: What problem does this feature solve
description: |
Explain your use case, context, and rationale behind this feature request. More importantly, what is the end user experience you are trying to build that led to the need for this feature?
placeholder: Please Input
validations:
required: true
- type: textarea
id: feature-api
attributes:
label: What does the proposed API look like
description: |
Describe how you propose to solve the problem and provide code samples of how the API would work once implemented. Note that you can use Markdown to format your code blocks.
placeholder: Please Input
validations:
required: true
52 changes: 52 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
English | [简体中文](https://github.com/opentiny/tiny-engine-webservice/blob/main/.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST_TEMPLATE.zh-CN.md)

# PR

## PR Checklist

Please check if your PR fulfills the following requirements:

- [ ] The commit message follows our [Commit Message Guidelines](https://github.com/opentiny/tiny-engine-webservice/blob/main/CONTRIBUTING.md)
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
- [ ] Built its own designer, fully self-validated

## PR Type

What kind of change does this PR introduce?

<!-- Please check the one that applies to this PR using "x". -->

- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Other... Please describe:

## Background and solution
<!--
1. Describe the problem and the scenario.
2. New features need to be described and attached with renderings.
3. Screenshots or GIFs involving UI/Interaction changes/Bugfix before and after modification are required.
-->

### What is the current behavior?

<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->

Issue Number: N/A

### What is the new behavior?


## Does this PR introduce a breaking change?

- [ ] Yes
- [ ] No

<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->

## Other information
52 changes: 52 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/PULL_REQUEST_TEMPLATE.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[English](https://github.com/opentiny/tiny-engine-webservice/blob/main/.github/PULL_REQUEST_TEMPLATE.md) | 简体中文

# PR

## PR Checklist

请检查您的 PR 是否满足以下要求:

- [ ] commit message遵循我们的[提交贡献指南](https://github.com/opentiny/tiny-engine-webservice/blob/main/CONTRIBUTING.zh-CN.md)
- [ ] 添加了更改内容的测试用例(用于bugfix/功能)
- [ ] 文档已添加/更新(用于bugfix/功能)
- [ ] 是否构建了自己的设计器,经过了充分的自验证

## PR 类型

这个PR的类型是?

- [ ] 日常 bug 修复
- [ ] 新特性支持
- [ ] 代码风格优化
- [ ] 重构
- [ ] 构建优化
- [ ] 测试用例
- [ ] 文档更新
- [ ] 分支合并
- [ ] 其他改动(请补充)


## 需求背景和解决方案

<!--
1. 要解决的具体问题。
2. 新增特性,需要进行功能描述,并附上效果图。
3. 涉及UI/交互变动/Bugfix需要有修改前&修改后截图或 GIF。
-->


Issue Number: N/A

### 修改前


### 修改后

## 此PR是否含有 breaking change?

- [ ]
- [ ]

<!-- 如果此 PR 包含breaking change,请在下面从用户角度描述具体变化和其他风险。-->

## Other information
26 changes: 26 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
changelog:
exclude:
labels:
- ignore-for-release
authors:
- allcontributors[bot]
categories:
- title: Breaking Changes 🛠
labels:
- Semver-Major
- breaking-change
- title: Exciting New Features 🎉
labels:
- Semver-Minor
- feature
- enhancement
- title: Bug Fixes 🐛
labels:
- Semver-Patch
- bug
- title: Other Changes
labels:
- documentation
- refactoring
- unit-test
- ci
23 changes: 23 additions & 0 deletions .github/workflows/ai-code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: AI Code Review

permissions:
contents: read
pull-requests: write

on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: anc95/ChatGPT-CodeReview@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
LANGUAGE: Chinese
OPENAI_API_ENDPOINT: https://api.openai.com/v1
MODEL: gpt-3.5-turbo
MAX_TOKENS: 4096
MAX_PATCH_LENGTH: 10000
18 changes: 18 additions & 0 deletions .github/workflows/issue-translator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'issue-translator'
on:
issue_comment:
types: [created]
issues:
types: [opened]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: usthe/issues-translate-action@v2.7
with:
IS_MODIFY_TITLE: false
# 非必须,决定是否需要修改issue标题内容
# 若是true,则机器人账户@Issues-translate-bot必须拥有修改此仓库issue权限。可以通过邀请@Issues-translate-bot加入仓库协作者实现。
CUSTOM_BOT_NOTE: Bot detected the issue body's language is not English, translate it automatically.
# 非必须,自定义机器人翻译的前缀开始内容。
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ When you personally use the TinyEngine and participate in many of the above cont
### Bug Reports
If you encounter problems when using TinyEngine-webservice, please submit an issue to us. Before submitting an issue, read the related official documents carefully to check whether the issue is a defect or a function that has not been implemented.

If the issue is a defect, select the bug report template when creating a new issue. The title must comply with the defect description format. For example, [tiny-engine-webservice] cannot be refreshed.
If the issue is a defect, select the bug report template when creating a new issue. The title must comply with the defect description format. For example, [TinyEngine-webservice] cannot be refreshed.

To report a defect, you need to fill in the following information:

* Tiny-engine-webservice and node version numbers
* TinyEngine-webservice and node version numbers
*Screenshots can be used to describe the defect. If an error is reported, the error information can be posted.
* It is recommended that a minimum demo link be provided to reproduce the defect.

If the feature is a new feature, select the Feature request template. The title complies with the format of the new feature description, for example, [tiny-engine-webservice].
If the feature is a new feature, select the Feature request template. The title complies with the format of the new feature description, for example, [TinyEngine-webservice].

For an issue of a new feature, you need to fill in the following information:

Expand All @@ -38,16 +38,16 @@ Before submitting pull request, please make sure that your submission is in line

Local startup steps:

* Click Fork in the upper right corner of the TinyEngine-webservice code repository to fork the upstream repository to the personal repository.
* Click Fork in the upper right corner of the tiny-engine-webservice code repository to fork the upstream repository to the personal repository.
* Clone personal warehouse to local
* Run npm install in the TinyEngine-webservice root directory to install the dependency.
* Modify related configurations in the config folder in the TinyEngine-webservice root directory.
* Run npm run dev in the root directory of TinyEngine-webservice to start local development.
* Run npm install in the tiny-engine-webservice root directory to install the dependency.
* Modify related configurations in the config folder in the tiny-engine-webservice root directory.
* Run npm run dev in the root directory of tiny-engine-webservice to start local development.

```
# username indicates the user name. Replace it before running the command.
git clone git@github.com:username/tiny-engine-webservice.git
cd tiny-engine
cd tiny-engine-webservice
git remote add upstream git@github.com:opentiny/tiny-engine-webservice.git
npm i
Expand Down
18 changes: 9 additions & 9 deletions CONTRIBUTING.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,37 @@
### 提交 Issue
如果你在使用 TinyEngine-webservice 过程中遇到问题,欢迎给我们提交 Issue,提交 Issue 之前,请先仔细阅读相关的官方文档,确认这是一个缺陷还是尚未实现的功能。

如果是一个缺陷,创建新 Issue 时选择 Bug report 模板,标题遵循缺陷简述 的格式,比如:[tiny-engine-webservice] 刷新功能无法使用。
如果是一个缺陷,创建新 Issue 时选择 Bug report 模板,标题遵循缺陷简述 的格式,比如:[TinyEngine-webservice] 刷新功能无法使用。

报告缺陷的 Issue 主要需要填写以下信息:

* tiny-engine-webservice 和 node 的版本号
* TinyEngine-webservice 和 node 的版本号
* 缺陷的表现,可截图辅助说明,如果有报错可贴上报错信息
* 缺陷的复现步骤,最好能提供一个最小可复现 demo 链接

如果是一个新特性,则选择 Feature request 模板,标题遵循新特性简述 的格式,比如:[tiny-engine-webservice] 新增XX主题。
如果是一个新特性,则选择 Feature request 模板,标题遵循新特性简述 的格式,比如:[TinyEngine-webservice] 新增XX主题。

新特性的 Issue 主要需要填写以下信息:

* 该特性主要解决用户的什么问题
* 该特性的 api 是什么样的

### 提交 PR
提交 PR 之前,请先确保你提交的内容是符合 TinyEngine-webservice 整体规划的,一般已经标记为 bug 的 Issue 是鼓励提交 PR 的,如果你不是很确定,可以创建一个 Discussion 进行讨论。
提交 PR 之前,请先确保你提交的内容是符合 TinyEngine Web Service 整体规划的,一般已经标记为 bug 的 Issue 是鼓励提交 PR 的,如果你不是很确定,可以创建一个 Discussion 进行讨论。

本地启动步骤:

* 点击 TinyEngine-webservice 代码仓库右上角的 Fork 按钮,将上游仓库 Fork 到个人仓库
* 点击 tiny-engine-webservice 代码仓库右上角的 Fork 按钮,将上游仓库 Fork 到个人仓库
* Clone 个人仓库到本地
*TinyEngine-webservice 根目录下运行 npm install, 安装依赖
*TinyEngine-webservice 根目录config文件夹下修改相关配置
*TinyEngine-webservice 根目录下运行 npm run dev,启动本地开发
*tiny-engine-webservice 根目录下运行 npm install, 安装依赖
*tiny-engine-webservice 根目录config文件夹下修改相关配置
*tiny-engine-webservice 根目录下运行 npm run dev,启动本地开发


```
# username 为用户名,执行前请替换
git clone git@github.com:username/tiny-engine-webservice.git
cd tiny-engine
cd tiny-engine-webservice
git remote add upstream git@github.com:opentiny/tiny-engine-webservice.git
npm i
Expand Down
4 changes: 2 additions & 2 deletions app/controller/app-center/aiChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export default class AiChatController extends Controller {
const { foundationModel, messages } = ctx.request.body;
this.ctx.logger.info('ai接口请求参参数 model选型:', foundationModel);
if (!messages || !Array.isArray(messages)) {
ctx.helper.throwError('Not passing the correct message parameter');
return this.ctx.helper.getResponseData('Not passing the correct message parameter');
}
const model = foundationModel?.model ?? E_FOUNDATION_MODEL.GPT_35_TURBO;
ctx.body = await ctx.service.aiChat.getAnswerFromAi(messages, { model });
ctx.body = await ctx.service.appCenter.aiChat.getAnswerFromAi(messages, { model });
}
}
1 change: 1 addition & 0 deletions app/lib/enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,5 +288,6 @@ export enum E_Public {
// AI大模型
export enum E_FOUNDATION_MODEL {
GPT_35_TURBO = 'gpt-3.5-turbo', // openai
Local_GPT = 'loacl-compatible-gpt-3.5', //本地兼容opanai-api接口的 大语言模型,如chatGLM6b,通义千问 等。
ERNIE_BOT_TURBO = 'ERNIE-Bot-turbo' // 文心一言
}
Loading

0 comments on commit 3abf297

Please sign in to comment.