直达玩耍: ApiHug-ApiSmart
现在开启: ApiHug 5分钟教程
IDEA插件: ApiHug - IDEA Plugin
大模型供应商
累计到 2024/11/14 (0.6.1) ApiSmart 已经支持18家大模型供应商,n+大模型接入(本地环境可无限多模型);
- Open AI
- Azure
- Gemini
- Anthropic
- DeepInfra
- Mooshot
- Zhipu
- DeepSeek
- Qianfan
- Grop
- Ollama
- Mistral
- LMStudio
- OpenRouter
- Jan
- GPT4All
- 通义-阿里
- 混元-腾讯
有有趣的 prompt 小伙伴也可慷慨分享给大家,会汇总到github:
ApiHug Prompt
将咱 ApiHug 整个标准纳入到上下文, 来帮我做 ApiHug 设计,直接出 proto 源码,修正了几下 prompt --- 当然还是 AI 帮我优化啦!怎么着?好过我预期,特么真的写出来了,而且非常精确。Damm, 隐隐有种开心兴奋又不太翔的感觉,既怕她会,又怕她不会!
将上面的 prompt 覆盖你本地 api 指令, 可以快速让 apismart 帮你设计 apihug 风格代码
开篇定义角色
As a seasoned ApiHug developer, you'll design API endpoints using ApiHug's Protocol Buffers-based DSL.
然后下面就是 few-shot 给点思路,描述,最后呢限定范围:
Standards Compliance 1. Use proto3 syntax for all protocol buffer definitions. 2. Ensure precise and meaningful names and descriptions in API definitions. 3. Adhere strictly to the OpenAPI specification.
最后让ApiSmart帮我做牛马写代码:
/api
请假服务
然后就输出代码,质量非常不错:
syntax = "proto3";
package com.apihug.leaverequest;
import "extend/domain.proto";
import "google/protobuf/empty.proto";
import "swagger/annotations.proto";
service LeaveRequestService {
option (hope.swagger.svc) = {
path: "/leave-request";
description: "Service for managing leave requests";
tag:{
name: "leave"
description: "APIs related to leave requests"
}
};
rpc CreateLeaveRequest (LeaveRequest) returns (google.protobuf.Empty) {
option (hope.swagger.operation) = {
post: "/create";
description: "Create a new leave request";
tags: "leave";
priority: HIGH;
parameters:{
parameter:{
name: "Authorization";
in: HEADER;
schema:{
format: STRING;
blank: FALSE
}
}
}
authorization:{
rbac:{
roles: {
roles: 'USER_ADD'
}
}
}
};
};
rpc GetLeaveRequest (GetLeaveRequestParams) returns (LeaveRequest) {
option (hope.swagger.operation) = {
get: "/{id}";
description: "Get details of a leave request by ID";
tags: "leave";
parameters:{
parameter:{
name: "id";
in: PATH;
schema:{
format: STRING;
blank: FALSE
}
}
}
authorization:{
rbac:{
roles: {
roles: 'USER_VIEW'
}
}
}
};
};
rpc UpdateLeaveRequest (LeaveRequest) returns (google.protobuf.Empty) {
option (hope.swagger.operation) = {
put: "/update";
description: "Update an existing leave request";
tags: "leave";
parameters:{
parameter:{
name: "Authorization";
in: HEADER;
schema:{
format: STRING;
blank: FALSE
}
}
}
authorization:{
rbac:{
roles: {
roles: 'USER_EDIT'
}
}
}
};
};
rpc DeleteLeaveRequest (DeleteLeaveRequestParams) returns (google.protobuf.Empty) {
option (hope.swagger.operation) = {
delete: "/delete/{id}";
description: "Delete a leave request by ID";
tags: "leave";
parameters:{
parameter:{
name: "id";
in: PATH;
schema:{
format: STRING;
blank: FALSE
}
}
}
authorization:{
rbac:{
roles: {
roles: 'USER_DELETE'
}
}
}
};
};
}
message LeaveRequest {
option (hope.swagger.schema) = {
json_schema: {
description: "A leave request object";
};
};
string id = 1 [(hope.swagger.field) = {
description: "Unique identifier for the leave request";
example: "12345";
empty: FALSE;
}];
string employee_id = 2 [(hope.swagger.field) = {
description: "ID of the employee requesting leave";
example: "emp123";
empty: FALSE;
}];
string leave_type = 3 [(hope.swagger.field) = {
description: "Type of leave (e.g., vacation, sick)";
example: "vacation";
empty: FALSE;
}];
string start_date = 4 [(hope.swagger.field) = {
description: "Start date of the leave";
format: DATE;
example: "2023-01-01";
empty: FALSE;
}];
string end_date = 5 [(hope.swagger.field) = {
description: "End date of the leave";
format: DATE;
example: "2023-01-10";
empty: FALSE;
}];
string reason = 6 [(hope.swagger.field) = {
description: "Reason for the leave";
example: "Family vacation";
empty: TRUE;
}];
}
message GetLeaveRequestParams {
string id = 1 [(hope.swagger.field) = {
description: "Unique identifier for the leave request";
example: "12345";
empty: FALSE;
}];
}
message DeleteLeaveRequestParams {
string id = 1 [(hope.swagger.field) = {
description: "Unique identifier for the leave request";
example: "12345";
empty: FALSE;
}];
}
More comming 0.6.2 ETA 2024-11-15