Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
luoxue.lxq committed Nov 2, 2023
0 parents commit fe8d54a
Show file tree
Hide file tree
Showing 8 changed files with 263 additions and 0 deletions.
12 changes: 12 additions & 0 deletions baichuan-llm-app/hook/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
async function preInit(inputObj) {

}

async function postInit(inputObj) {

}

module.exports = {
postInit,
preInit
}
35 changes: 35 additions & 0 deletions baichuan-llm-app/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 规范文档参考:
# 中文:https://github.com/Serverless-Devs/Serverless-Devs/blob/master/spec/zh/0.0.2/serverless_package_model/package_model.md#应用模型规范
# English: https://github.com/Serverless-Devs/Serverless-Devs/blob/master/spec/en/0.0.2/serverless_package_model/package_model.md#Application-model-specification
# --------------
# Package 开发发布最佳实践:
# - [社区讨论 #62](https://github.com/Serverless-Devs/Serverless-Devs/discussions/62);
# - [社区讨论 #407](https://github.com/Serverless-Devs/Serverless-Devs/discussions/407);
# - [社区讨论 #439](https://github.com/Serverless-Devs/Serverless-Devs/discussions/439);

Type: Application
Name: myapptestlin
Provider:
- 阿里云
Version: 0.0.1
Description: 简短的描述/介绍
HomePage: 项目首页地址
Tags: #标签详情
- 部署函数
- 部署组件
Category: 人工智能 # 基础云服务/Web框架/全栈应用/人工智能/音视频处理/图文处理/监控告警/大数据/IoT/新手入门/其它/开源项目
Parameters:
type: object
additionalProperties: false # 不允许增加其他属性
required: # 必填项
- region
properties:
region:
title: 地域
type: string
default: cn-hangzhou
description: 创建应用所在的地区
enum:
- cn-beijing
- cn-hangzhou
- cn-shanghai
60 changes: 60 additions & 0 deletions baichuan-llm-app/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# 应用开发说明

<p align="center"><b> 中文 | <a href="./readme_en.md"> English </a> </b></p>


> Serverless Devs 应用开发需要严格遵守 [Serverless Package Model](../../spec/zh/0.0.2/serverless_package_model/readme.md) 中的 [应用模型规范](../../spec/zh/0.0.2/serverless_package_model/3.package_model.md#应用模型规范)。在[应用模型规范](../../spec/zh/0.0.2/serverless_package_model/3.package_model.md#应用模型规范)中有关于[应用模型元数据](../../spec/zh/0.0.2/serverless_package_model/3.package_model.md#应用模型元数据)的说明。
Serverless Devs的组件开发案例已经被集成到Serverless Devs命令行工具中,通过对Serverless Devs的命令行工具,可以进行空白应用项目的初始化,开发者只需要执行`s init`即可看到:

```shell script

🚀 Serverless Awesome: https://github.com/Serverless-Devs/package-awesome

? Hello Serverless for Cloud Vendors (Use arrow keys or type to search)
❯ Alibaba Cloud Serverless
AWS Cloud Serverless
Tencent Cloud Serverless
Baidu Cloud Serverless
Dev Template for Serverless Devs
```

此时,选择最后的`Dev Template for Serverless Devs`,并按回车:

```shell script
$ s init

🚀 Serverless Awesome: https://github.com/Serverless-Devs/package-awesome

? Hello Serverless for Cloud Vendors Dev Template for Serverless Devs
? Please select an Serverless-Devs Application (Use arrow keys or type to search)
❯ Application Scaffolding
Component Scaffolding
```
此时,选择`Application Scaffolding`,并按回车,即可完成一个完整的Serverless Devs的Application项目的初始化,可以通过命令查看文件树:
```shell script
$ find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
.
|____readme.md
|____version.md
|____publish.yaml
|____src
| |____s.yaml
| |____index.js
```
这其中:
| 目录 | 含义 |
| --- | --- |
| readme.md | 对该组件的描述,或帮助文档信息 |
| version.md | 版本的描述,例如当前版本的更新内容等 |
| publish.yaml | 项目所必须的文件,Serverless Devs Package的开发识别文档 |
| src | 应用所在目录,需要包括`s.yaml`和相关的应用代码等 |
此时,开发者可以在src下完成应用的开发,并对项目进行`publish.yaml`文件的编写。完成之后,即可将项目发不到不同的源,以Github Registry为例,可以在Github创建一个`Public`的仓库,并将编译后的代码放到仓库,并发布一个版本。此时,就可以通过客户端获取到该应用。
58 changes: 58 additions & 0 deletions baichuan-llm-app/readme_en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Application development instructions

<p align="center"><b> <a href="./readme.md"> 中文 </a> | English </b></p>

> The development of Serverless Devs applications must strictly conform to the [application model specification](../../spec/en/0.0.2/serverless_package_model/3.package_model.md#Application-model-specification) in [Serverless Package Model](../../spec/en/0.0.2/serverless_package_model/readme.md). In the [application model specification](../../spec/en/0.0.2/serverless_package_model/3.package_model.md#Application-model-specification), the instructions on [application model metadata](../../spec/en/0.0.2/serverless_package_model/3.package_model.md#Application-model-metadata) are described.
The component development cases of Serverless Devs are integrated into the Serverless Devs CLI tool. You can use the CLI tool to initialize an application project that is not developed. Developers only need to run the s init command, and the following command output is returned:

```shell script

🚀 Serverless Awesome: https://github.com/Serverless-Devs/package-awesome

? Hello Serverless for Cloud Vendors (Use arrow keys or type to search)
❯ Alibaba Cloud Serverless
AWS Cloud Serverless
Tencent Cloud Serverless
Baidu Cloud Serverless
Dev Template for Serverless Devs
```

Select the last line `Dev Template for Serverless Devs` and press the Enter key. The following command output is returned:


```shell script
$ s init

🚀 Serverless Awesome: https://github.com/Serverless-Devs/package-awesome

? Hello Serverless for Cloud Vendors Dev Template for Serverless Devs
? Please select an Serverless-Devs Application (Use arrow keys or type to search)
❯ Application Scaffolding
Component Scaffolding
```
Select the `Application Scaffolding` and press the Enter key. The project of a Serverless Devs application is initialized. You can view the file tree by using the following command:
```shell script
$ find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
.
|____readme.md
|____version.md
|____publish.yaml
|____src
| |____s.yaml
| |____index.js
```
The following table describes the directories in the file tree:
| Directory | Description |
| ------------ | ------------------------------------------------------------ |
| readme.md | Description of the component, or help documentations. |
| version.md | The description of the project version, such as the updates of the current version. |
| publish.yaml | The file that is a required for the project. The file is identifiable for developers of Serverless Devs Package. |
| src | The directory where the application is located, which needs to include s.yaml and related application code. |
Developers can develop applications by using the code stored in the src directory and write the `publish.yaml` file for the project. After the preceding operations are complete, you can commit the project to different sources. For example, if you want to commit the project to GitHub Registry, you can create a repository named `Public` in GitHub, store the compiled code into the repository, and then publish a version. In this case, the application is available on Serverless Devs clients.
16 changes: 16 additions & 0 deletions baichuan-llm-app/src/code/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* /*
* To enable the initializer feature (https://help.aliyun.com/document_detail/156876.html)
* please implement the initializer function as below:
* exports.initializer = (context, callback) => {
* console.log('initializing');
* callback(null, '');
* };
*
* @format
*/

exports.handler = (event, context, callback) => {
console.log('hello world');
callback(null, 'hello world');
};
60 changes: 60 additions & 0 deletions baichuan-llm-app/src/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# 应用开发说明

<p align="center"><b> 中文 | <a href="./readme_en.md"> English </a> </b></p>


> Serverless Devs 应用开发需要严格遵守 [Serverless Package Model](../../spec/zh/0.0.2/serverless_package_model/readme.md) 中的 [应用模型规范](../../spec/zh/0.0.2/serverless_package_model/3.package_model.md#应用模型规范)。在[应用模型规范](../../spec/zh/0.0.2/serverless_package_model/3.package_model.md#应用模型规范)中有关于[应用模型元数据](../../spec/zh/0.0.2/serverless_package_model/3.package_model.md#应用模型元数据)的说明。
Serverless Devs的组件开发案例已经被集成到Serverless Devs命令行工具中,通过对Serverless Devs的命令行工具,可以进行空白应用项目的初始化,开发者只需要执行`s init`即可看到:

```shell script

🚀 Serverless Awesome: https://github.com/Serverless-Devs/package-awesome

? Hello Serverless for Cloud Vendors (Use arrow keys or type to search)
❯ Alibaba Cloud Serverless
AWS Cloud Serverless
Tencent Cloud Serverless
Baidu Cloud Serverless
Dev Template for Serverless Devs
```

此时,选择最后的`Dev Template for Serverless Devs`,并按回车:

```shell script
$ s init

🚀 Serverless Awesome: https://github.com/Serverless-Devs/package-awesome

? Hello Serverless for Cloud Vendors Dev Template for Serverless Devs
? Please select an Serverless-Devs Application (Use arrow keys or type to search)
❯ Application Scaffolding
Component Scaffolding
```
此时,选择`Application Scaffolding`,并按回车,即可完成一个完整的Serverless Devs的Application项目的初始化,可以通过命令查看文件树:
```shell script
$ find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
.
|____readme.md
|____version.md
|____publish.yaml
|____src
| |____s.yaml
| |____index.js
```
这其中:
| 目录 | 含义 |
| --- | --- |
| readme.md | 对该组件的描述,或帮助文档信息 |
| version.md | 版本的描述,例如当前版本的更新内容等 |
| publish.yaml | 项目所必须的文件,Serverless Devs Package的开发识别文档 |
| src | 应用所在目录,需要包括`s.yaml`和相关的应用代码等 |
此时,开发者可以在src下完成应用的开发,并对项目进行`publish.yaml`文件的编写。完成之后,即可将项目发不到不同的源,以Github Registry为例,可以在Github创建一个`Public`的仓库,并将编译后的代码放到仓库,并发布一个版本。此时,就可以通过客户端获取到该应用。
21 changes: 21 additions & 0 deletions baichuan-llm-app/src/s.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
edition: 1.0.0 # 命令行YAML规范版本,遵循语义化版本(Semantic Versioning)规范
name: myapptestlin # 项目名称
access: aliyun-release # 秘钥别名

services:
function-test: # 服务名称
component: fc # 组件名称
props: # 组件的属性值
region: cn-hangzhou
# region: "{{ region }}" # 来自 publish.yaml Parameters 参数定义, 更多关于变量的使用方法,可以参考:https://www.serverless-devs.com/serverless-devs/yaml#变量赋值
service:
name: ServerlessToolProjectaa
description: 欢迎使用ServerlessTool
function:
name: serverless_demo_nodejs12
description: 这是一个Nodejs12的测试案例
codeUri: ./code
handler: index.handler
memorySize: 128
runtime: nodejs12
timeout: 5
1 change: 1 addition & 0 deletions baichuan-llm-app/version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- 初始化项目asdf

0 comments on commit fe8d54a

Please sign in to comment.