feat: add star badge for admin / openai page.

add-more-languages
Meng Zhang 2023-04-06 18:59:50 +08:00
parent f21cc323f6
commit 88f73aec79
3 changed files with 7 additions and 189 deletions

View File

@ -1,186 +1 @@
{
"openapi": "3.0.2",
"info": {
"title": "TabbyServer",
"description": "TabbyServer is the backend for tabby, serving code completion requests from code editor / IDE.\n*",
"version": "0.1.0"
},
"paths": {
"/v1/completions": {
"post": {
"summary": "Completions",
"operationId": "completions_v1_completions_post",
"requestBody": {
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/CompletionRequest" }
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/CompletionResponse" }
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/HTTPValidationError" }
}
}
}
}
}
},
"/v1/events": {
"post": {
"summary": "Events",
"operationId": "events_v1_events_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"title": "E",
"anyOf": [
{ "$ref": "#/components/schemas/ChoiceEvent" },
{ "$ref": "#/components/schemas/CompletionEvent" }
]
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": { "application/json": { "schema": {} } }
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/HTTPValidationError" }
}
}
}
}
}
}
},
"components": {
"schemas": {
"Choice": {
"title": "Choice",
"required": ["index", "text"],
"type": "object",
"properties": {
"index": { "title": "Index", "type": "integer" },
"text": { "title": "Text", "type": "string" }
}
},
"ChoiceEvent": {
"title": "ChoiceEvent",
"required": ["type", "completion_id", "choice_index"],
"type": "object",
"properties": {
"type": { "$ref": "#/components/schemas/EventType" },
"completion_id": { "title": "Completion Id", "type": "string" },
"choice_index": { "title": "Choice Index", "type": "integer" }
}
},
"CompletionEvent": {
"title": "CompletionEvent",
"required": ["type", "id", "language", "prompt", "created", "choices"],
"type": "object",
"properties": {
"type": { "$ref": "#/components/schemas/EventType" },
"id": { "title": "Id", "type": "string" },
"language": { "$ref": "#/components/schemas/Language" },
"prompt": { "title": "Prompt", "type": "string" },
"created": { "title": "Created", "type": "integer" },
"choices": {
"title": "Choices",
"type": "array",
"items": { "$ref": "#/components/schemas/Choice" }
}
}
},
"CompletionRequest": {
"title": "CompletionRequest",
"required": ["prompt"],
"type": "object",
"properties": {
"language": {
"allOf": [{ "$ref": "#/components/schemas/Language" }],
"description": "Language for completion request",
"default": "unknown",
"example": "python"
},
"prompt": {
"title": "Prompt",
"type": "string",
"description": "The context to generate completions for, encoded as a string.",
"example": "def binarySearch(arr, left, right, x):\n mid = (left +"
}
}
},
"CompletionResponse": {
"title": "CompletionResponse",
"required": ["id", "created", "choices"],
"type": "object",
"properties": {
"id": { "title": "Id", "type": "string" },
"created": { "title": "Created", "type": "integer" },
"choices": {
"title": "Choices",
"type": "array",
"items": { "$ref": "#/components/schemas/Choice" }
}
}
},
"EventType": {
"title": "EventType",
"enum": ["completion", "view", "select"],
"type": "string",
"description": "An enumeration."
},
"HTTPValidationError": {
"title": "HTTPValidationError",
"type": "object",
"properties": {
"detail": {
"title": "Detail",
"type": "array",
"items": { "$ref": "#/components/schemas/ValidationError" }
}
}
},
"Language": {
"title": "Language",
"enum": ["unknown", "python", "javascript"],
"type": "string",
"description": "An enumeration."
},
"ValidationError": {
"title": "ValidationError",
"required": ["loc", "msg", "type"],
"type": "object",
"properties": {
"loc": {
"title": "Location",
"type": "array",
"items": { "anyOf": [{ "type": "string" }, { "type": "integer" }] }
},
"msg": { "title": "Message", "type": "string" },
"type": { "title": "Error Type", "type": "string" }
}
}
}
}
}
{"openapi":"3.0.2","info":{"title":"TabbyServer","description":"\n[![github star](https://img.shields.io/github/stars/TabbyML/tabby?style=social)](http://github.com/TabbyML/tabby)\n\nTabbyServer is the backend for tabby, serving code completion requests from code editor / IDE.\n","version":"0.1.0"},"paths":{"/v1/completions":{"post":{"summary":"Completions","operationId":"completions_v1_completions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompletionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompletionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/events":{"post":{"summary":"Events","operationId":"events_v1_events_post","requestBody":{"content":{"application/json":{"schema":{"title":"E","anyOf":[{"$ref":"#/components/schemas/ChoiceEvent"},{"$ref":"#/components/schemas/CompletionEvent"}]}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Choice":{"title":"Choice","required":["index","text"],"type":"object","properties":{"index":{"title":"Index","type":"integer"},"text":{"title":"Text","type":"string"}}},"ChoiceEvent":{"title":"ChoiceEvent","required":["type","completion_id","choice_index"],"type":"object","properties":{"type":{"$ref":"#/components/schemas/EventType"},"completion_id":{"title":"Completion Id","type":"string"},"choice_index":{"title":"Choice Index","type":"integer"}}},"CompletionEvent":{"title":"CompletionEvent","required":["type","id","language","prompt","created","choices"],"type":"object","properties":{"type":{"$ref":"#/components/schemas/EventType"},"id":{"title":"Id","type":"string"},"language":{"$ref":"#/components/schemas/Language"},"prompt":{"title":"Prompt","type":"string"},"created":{"title":"Created","type":"integer"},"choices":{"title":"Choices","type":"array","items":{"$ref":"#/components/schemas/Choice"}}}},"CompletionRequest":{"title":"CompletionRequest","required":["prompt"],"type":"object","properties":{"language":{"allOf":[{"$ref":"#/components/schemas/Language"}],"description":"Language for completion request","default":"unknown","example":"python"},"prompt":{"title":"Prompt","type":"string","description":"The context to generate completions for, encoded as a string.","example":"def binarySearch(arr, left, right, x):\n mid = (left +"}}},"CompletionResponse":{"title":"CompletionResponse","required":["id","created","choices"],"type":"object","properties":{"id":{"title":"Id","type":"string"},"created":{"title":"Created","type":"integer"},"choices":{"title":"Choices","type":"array","items":{"$ref":"#/components/schemas/Choice"}}}},"EventType":{"title":"EventType","enum":["completion","view","select"],"type":"string","description":"An enumeration."},"HTTPValidationError":{"title":"HTTPValidationError","type":"object","properties":{"detail":{"title":"Detail","type":"array","items":{"$ref":"#/components/schemas/ValidationError"}}}},"Language":{"title":"Language","enum":["unknown","python","javascript"],"type":"string","description":"An enumeration."},"ValidationError":{"title":"ValidationError","required":["loc","msg","type"],"type":"object","properties":{"loc":{"title":"Location","type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}}}}}}

View File

@ -19,7 +19,8 @@ set_page_config(page_title="Home")
badges = " ".join(map(make_badge_markdown, SERVICES))
st.markdown(
"""
## Tabby
## Tabby [![github star](https://img.shields.io/github/stars/TabbyML/tabby?style=social)](http://github.com/TabbyML/tabby)
{badges}
---

View File

@ -17,8 +17,10 @@ from .models import (
app = FastAPI(
title="TabbyServer",
description="""TabbyServer is the backend for tabby, serving code completion requests from code editor / IDE.
* [Admin Panel](./_admin)
description="""
[![github star](https://img.shields.io/github/stars/TabbyML/tabby?style=social)](http://github.com/TabbyML/tabby)
TabbyServer is the backend for tabby, serving code completion requests from code editor / IDE.
""",
docs_url="/",
)