Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): add function template #1264

Merged
merged 10 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 70 additions & 1 deletion web/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
"LeaveFunctionPage": "About to leave the function edit page",
"PromptDescription": "Use natural language to describe your needs, laf will help you generate code, for example: help me write a hello world, return {hello: 'laf AI'}",
"CreateWithAITip": "Create functions with AI assistance",
"CreateNow": "Create Now",
"CreateFromTemplate": "Create from Template",
"getCodeOnline": "Retrieve the latest released online code"
},
"HomePanel": {
Expand Down Expand Up @@ -372,7 +374,9 @@
"forum": "Forum",
"contact": "Contact",
"start": "Start Now",
"stars": "3.9K"
"stars": "3.9K",
"funcTemplate": "Function Market",
"appMarket": "Application Market"
},
"HomePage": {
"slogan": "Write Code as effortlessly as Blogging",
Expand Down Expand Up @@ -434,6 +438,64 @@
"LinkCopied": "Link Copied",
"create success": "create success",
"ServerStatus": "STATUS",
"market": {
"explore": "Explore",
"category": "Category",
"appTemplate": "Application Template",
"funcTemplate": "Function Template",
"all": "All",
"market": "Function Market"
},
"Template": {
"useTemplate": "Use Template",
"DeveloperInformation": "Developer Information",
"Sponsor": "Sponsor",
"Function": "Function",
"Dependency": "Dependency",
"EnvironmentVariables": "Environment Variables",
"public": "public",
"private": "private",
"MyTemplate": "MyTemplate",
"SortOrd": "Sort: ",
"CreateTemplate": "Create Template",
"Details": "Details",
"My": "My Template",
"Edit": "Edit",
"Create": "Create",
"CreatedAt": "Created At",
"byTime": "by Time",
"byFavorites": "by Favorites",
"byLikes": "by Likes",
"Description": "Enter function template description",
"updatedAt": "Updated At",
"UsedBy": "Used By",
"Draft": "Draft",
"AddEnvironmentVariables": "Add Environment Variables",
"Total": "Total",
"UsedSuccessfully": "Used Successfully",
"Select the application you want to use": "Select the application you want to use",
"recentUsed": "Recent Used",
"myStar": "My Star",
"myTemplate": "My Template",
"recommend": "Recommend",
"MostRecent": "Most Recent",
"useTemplateSuccess": "Use Template Success",
"cancelStarSuccess": "Cancel Star Success",
"starSuccess": "Star Success",
"FunctionNameExist": "Function Name Exist",
"AllTemplates": "All Templates",
"Community": "Community Template",
"StaredTemplate": "Stared Template",
"Recent": "Recent Template",
"Earliest": "Earliest",
"MostStars": "Most Stars",
"Latest": "Latest",
"Please select template permission": "Please select template permission",
"Please enter template name": "Please enter template name",
"EditTemplate": "Edit Template",
"DeleteTemplate": "Delete Template",
"FunctionListEmpty": "Please add at least one function."
},
"Fee": "Fee",
"PleaseCloseApplicationFirst": "Please close your application first.",
"custom": "Custom",
Expand All @@ -445,6 +507,13 @@
"Send": "Send",
"Stop": "Stop",
"SendMessagePlaceHolder": "Send a message",
"Publish": "Publish",
"MyTemplate": "My Template",
"Create function template success": "Create function template success",
"Update function template success": "Update function template success",
"Templates": {
"My": "My"
},
"application": {
"bonus": "bonus",
"Recharge": "Recharge",
Expand Down
73 changes: 71 additions & 2 deletions web/public/locales/zh-CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
"LeaveFunctionPage": "即将离开函数编辑页面",
"PromptDescription": "使用自然语言描述你的需求, laf 会帮你生成代码, 例如: 写一个 hello world ,返回 {hello: 'laf AI'}",
"CreateWithAITip": "使用 AI 辅助创建函数",
"CreateNow": "立即创建",
"CreateFromTemplate": "通过模板创建",
"getCodeOnline": "获取线上最新发布的代码"
},
"HomePanel": {
Expand Down Expand Up @@ -369,10 +371,12 @@
"aboutUs": "关于我们",
"docs": "文档",
"contact": "联系我们",
"forum": "开发者社区",
"forum": "社区",
"faq": "FAQ",
"start": "立即开发",
"stars": "3.9K"
"stars": "3.9K",
"funcTemplate": "函数市场",
"appMarket": "应用市场"
},
"HomePage": {
"slogan": "像写博客一样写代码",
Expand Down Expand Up @@ -434,6 +438,64 @@
"LinkCopied": "链接复制成功",
"create success": "创建成功",
"ServerStatus": "服务状态",
"market": {
"explore": "探索",
"category": "分类",
"appTemplate": "应用模板",
"funcTemplate": "函数模板",
"all": "全部",
"market": "函数市场"
},
"Template": {
"useTemplate": "使用模板",
"DeveloperInformation": "开发者信息",
"Sponsor": "支持",
"Function": "函数",
"Dependency": "依赖",
"EnvironmentVariables": "环境变量",
"public": "公开",
"private": "私有",
"MyTemplate": "我的模板",
"SortOrd": "排序:",
"CreateTemplate": "新建模板",
"Details": "函数详情",
"My": "我的模板",
"Edit": "编辑",
"Create": "新建",
"CreatedAt": "创建于",
"byTime": "按时间",
"byFavorites": "按收藏数",
"byLikes": "按点赞数",
"Description": "请输入函数模板介绍信息",
"updatedAt": "更新于",
"UsedBy": "应用者",
"Draft": "草稿",
"AddEnvironmentVariables": "添加环境变量",
"Total": "总数",
"UsedSuccessfully": "应用成功",
"Select the application you want to use": "选择你要使用的应用",
"recentUsed": "最近使用",
"myStar": "我收藏的",
"myTemplate": "我创建的",
"recommend": "推荐模板",
"MostRecent": "按时间最新",
"useTemplateSuccess": "函数模板使用成功",
"cancelStarSuccess": "取消收藏成功",
"starSuccess": "收藏成功",
"FunctionNameExist": "函数名已存在",
"AllTemplates": "社区模板",
"Community": "社区模板",
"StaredTemplate": "我收藏的",
"Recent": "最近使用",
"Earliest": "按时间最早",
"MostStars": "按收藏数最多",
"Latest": "按时间最新",
"Please select template permission": "请选择模板权限",
"Please enter template name": "请输入模板名",
"EditTemplate": "编辑模板",
"DeleteTemplate": "删除模板",
"FunctionListEmpty": "请至少添加一个函数"
},
"Fee": "费用",
"PleaseCloseApplicationFirst": "请先关闭应用",
"custom": "自定义",
Expand All @@ -444,6 +506,13 @@
"Send": "发送",
"Stop": "停止",
"SendMessagePlaceHolder": "提问",
"Publish": "发布",
"MyTemplate": "我的模板",
"Create function template success": "创建函数模板成功",
"Update function template success": "更新函数模板成功",
"Templates": {
"My": "我的模板"
},
"application": {
"bonus": "赠",
"Recharge": "输入金额",
Expand Down
73 changes: 71 additions & 2 deletions web/public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
"LeaveFunctionPage": "即将离开函数编辑页面",
"PromptDescription": "使用自然语言描述你的需求, laf 会帮你生成代码, 例如: 写一个 hello world ,返回 {hello: 'laf AI'}",
"CreateWithAITip": "使用 AI 辅助创建函数",
"CreateNow": "立即创建",
"CreateFromTemplate": "通过模板创建",
"getCodeOnline": "获取线上最新发布的代码"
},
"HomePanel": {
Expand Down Expand Up @@ -369,10 +371,12 @@
"aboutUs": "关于我们",
"docs": "文档",
"contact": "联系我们",
"forum": "开发者社区",
"forum": "社区",
"faq": "FAQ",
"start": "立即开发",
"stars": "3.9K"
"stars": "3.9K",
"funcTemplate": "函数市场",
"appMarket": "应用市场"
},
"HomePage": {
"slogan": "像写博客一样写代码",
Expand Down Expand Up @@ -434,6 +438,64 @@
"LinkCopied": "链接复制成功",
"create success": "创建成功",
"ServerStatus": "服务状态",
"market": {
"explore": "探索",
"category": "分类",
"appTemplate": "应用模板",
"funcTemplate": "函数模板",
"all": "全部",
"market": "函数市场"
},
"Template": {
"useTemplate": "使用模板",
"DeveloperInformation": "开发者信息",
"Sponsor": "支持",
"Function": "函数",
"Dependency": "依赖",
"EnvironmentVariables": "环境变量",
"public": "公开",
"private": "私有",
"MyTemplate": "我的模板",
"SortOrd": "排序:",
"CreateTemplate": "新建模板",
"Details": "函数详情",
"My": "我的模板",
"Edit": "编辑",
"Create": "新建",
"CreatedAt": "创建于",
"byTime": "按时间",
"byFavorites": "按收藏数",
"byLikes": "按点赞数",
"Description": "请输入函数模板介绍信息",
"updatedAt": "更新于",
"UsedBy": "应用者",
"Draft": "草稿",
"AddEnvironmentVariables": "添加环境变量",
"Total": "总数",
"UsedSuccessfully": "应用成功",
"Select the application you want to use": "选择你要使用的应用",
"recentUsed": "最近使用",
"myStar": "我收藏的",
"myTemplate": "我创建的",
"recommend": "推荐模板",
"MostRecent": "按时间最新",
"useTemplateSuccess": "函数模板使用成功",
"cancelStarSuccess": "取消收藏成功",
"starSuccess": "收藏成功",
"FunctionNameExist": "函数名已存在",
"AllTemplates": "社区模板",
"Community": "社区模板",
"StaredTemplate": "我收藏的",
"Recent": "最近使用",
"Earliest": "按时间最早",
"MostStars": "按收藏数最多",
"Latest": "按时间最新",
"Please select template permission": "请选择模板权限",
"Please enter template name": "请输入模板名",
"EditTemplate": "编辑模板",
"DeleteTemplate": "删除模板",
"FunctionListEmpty": "请至少添加一个函数"
},
"Fee": "费用",
"PleaseCloseApplicationFirst": "请先关闭应用",
"custom": "自定义",
Expand All @@ -445,6 +507,13 @@
"Send": "发送",
"Stop": "停止",
"SendMessagePlaceHolder": "提问",
"Publish": "发布",
"MyTemplate": "我的模板",
"Create function template success": "创建函数模板成功",
"Update function template success": "更新函数模板成功",
"Templates": {
"My": "我的模板"
},
"application": {
"bonus": "赠",
"Recharge": "输入金额",
Expand Down
18 changes: 18 additions & 0 deletions web/src/apis/typing.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,24 @@ export type Source = {
lang: any;
};

export type TFunctionTemplate = {
_id: string;
name: string;
description: string;
private: boolean;
createdAt: string;
updatedAt: string;
star: number;
items: { name: string; source: { code: string } }[];
dependencies: string[];
environments: { name: string; value: string }[];
};

export type TemplateList = {
list: TFunctionTemplate[];
total: number;
};

export type TLogItem = {
_id: string;
request_id: string;
Expand Down
Loading