Skip to content

Commit

Permalink
docs: update openapi.json (#1941)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys authored Apr 23, 2024
1 parent a8c4fb7 commit 9d15666
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 11 deletions.
22 changes: 12 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,18 @@ bump-release-version:
cargo ws version --allow-branch "r*" --no-individual-tags --force "*"

update-openapi-doc:
curl http://localhost:8080/api-docs/openapi.json | jq ' \
delpaths([ \
["paths", "/v1beta/chat/completions"], \
["paths", "/v1beta/search"], \
["components", "schemas", "CompletionRequest", "properties", "prompt"], \
["components", "schemas", "CompletionRequest", "properties", "debug_options"], \
["components", "schemas", "CompletionResponse", "properties", "debug_data"], \
["components", "schemas", "DebugData"], \
["components", "schemas", "DebugOptions"] \
])' | jq '.servers[0] |= { url: "https://playground.app.tabbyml.com", description: "Playground server" }' \
curl http://localhost:8080/api-docs/openapi.json | jq ' \
delpaths([ \
["paths", "/v1beta/chat/completions"], \
["paths", "/v1beta/search"], \
["paths", "/v1beta/server_setting"], \
["components", "schemas", "CompletionRequest", "properties", "prompt"], \
["components", "schemas", "CompletionRequest", "properties", "debug_options"], \
["components", "schemas", "CompletionResponse", "properties", "debug_data"], \
["components", "schemas", "DebugData"], \
["components", "schemas", "DebugOptions"], \
["components", "schemas", "ServerSetting"] \
])' | jq '.servers[0] |= { url: "https://playground.app.tabbyml.com", description: "Playground server" }' \
> website/static/openapi.json

update-graphql-schema:
Expand Down
46 changes: 45 additions & 1 deletion website/static/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"name": "Apache 2.0",
"url": "https://github.com/TabbyML/tabby/blob/main/LICENSE"
},
"version": "0.8.3"
"version": "0.10.0"
},
"servers": [
{
Expand Down Expand Up @@ -313,6 +313,24 @@
]
}
},
"Declaration": {
"type": "object",
"description": "A snippet of declaration code that is relevant to the current completion request.",
"required": [
"filepath",
"body"
],
"properties": {
"filepath": {
"type": "string",
"description": "Filepath of the file where the snippet is from.\n- When the file belongs to the same workspace as the current file,\nthis is a relative filepath, use the same rule as [Segments::filepath].\n- When the file located outside the workspace, such as in a dependency package,\nthis is a file URI with an absolute filepath."
},
"body": {
"type": "string",
"description": "Body of the snippet."
}
}
},
"HealthState": {
"type": "object",
"required": [
Expand Down Expand Up @@ -491,6 +509,32 @@
"description": "Content that appears after the cursor in the editor window.",
"nullable": true
},
"filepath": {
"type": "string",
"description": "The relative path of the file that is being edited.\n- When [Segments::git_url] is set, this is the path of the file in the git repository.\n- When [Segments::git_url] is empty, this is the path of the file in the workspace.",
"nullable": true
},
"git_url": {
"type": "string",
"description": "The remote URL of the current git repository.\nLeave this empty if the file is not in a git repository,\nor the git repository does not have a remote URL.",
"nullable": true
},
"declarations": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Declaration"
},
"description": "The relevant declaration code snippets provided by the editor's LSP,\ncontain declarations of symbols extracted from [Segments::prefix].",
"nullable": true
},
"relevant_snippets_from_changed_files": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Snippet"
},
"description": "The relevant code snippets extracted from recently edited files.\nThese snippets are selected from candidates found within code chunks\nbased on the edited location.\nThe current editing file is excluded from the search candidates.\n\nWhen provided alongside [Segments::declarations], the snippets have\nalready been deduplicated to ensure no duplication with entries\nin [Segments::declarations].\n\nSorted in descending order of [Snippet::score].",
"nullable": true
},
"clipboard": {
"type": "string",
"description": "Clipboard content when requesting code completion.",
Expand Down

0 comments on commit 9d15666

Please sign in to comment.