add common identity provider /.well-known/serviceinfo, updated docs

This commit is contained in:
Concedo 2024-11-04 21:29:26 +08:00
parent 847689e74c
commit f153a14daf
2 changed files with 38 additions and 2 deletions

View file

@ -191,7 +191,10 @@
},
"images": {
"description": "KoboldCpp ONLY. If set, takes an array of base64 encoded strings, each one representing an image to be processed.",
"type": "array"
"type": "array",
"items": {
"type": "string"
}
},
"trim_stop": {
"default": false,
@ -1168,6 +1171,29 @@
]
}
},
"/.well-known/serviceinfo": {
"get": {
"responses": {
"200": {
"content": {
"application/json": {
"example": {"version":"0.2","software":{"name":"KoboldCpp","version":1.77,"repository":"https://github.com/LostRuins/koboldcpp","homepage":"https://github.com/LostRuins/koboldcpp","logo":"https://raw.githubusercontent.com/LostRuins/koboldcpp/refs/heads/concedo/niko.ico"},"api":{"koboldai":{"name":"KoboldAI API","rel_url":"/api","documentation":"https://lite.koboldai.net/koboldcpp_api","version":1.77},"openai":{"name":"OpenAI API","rel_url ":"/v1","documentation":"https://openai.com/documentation/api","version":1.77}}},
"schema": {
"properties": {},
"type": "object"
}
}
},
"description": "Successful request"
}
},
"description": "Retrieve the common API identity provider",
"summary": "Retrieve the common API identity provider",
"tags": [
"serviceinfo"
]
}
},
"/sdapi/v1/sd-models": {
"get": {
"description": "Gets a list of image generation models. For koboldcpp, only one model will be returned. If no model is loaded, the list is empty.",
@ -1364,7 +1390,10 @@
"type": "number"
},
"init_images": {
"type": "array"
"type": "array",
"items": {
"type": "string"
}
},
},
"type": "object"
@ -1517,6 +1546,10 @@
"description": "Extended API unique to KoboldCpp",
"name": "api/extra"
},
{
"description": "Common identity API for LLM services",
"name": "serviceinfo"
},
{
"description": "Image Generation API (A1111 compatible)",
"name": "sdapi/v1"

View file

@ -1898,6 +1898,9 @@ Enter Prompt:<br>
elif self.path.endswith(('/api/tags')): #ollama compatible
response_body = (json.dumps({"models":[{"name":"koboldcpp","model":friendlymodelname,"modified_at":"2024-07-19T15:26:55.6122841+08:00","size":394998579,"digest":"b5dc5e784f2a3ee1582373093acf69a2f4e2ac1710b253a001712b86a61f88bb","details":{"parent_model":"","format":"gguf","family":"koboldcpp","families":["koboldcpp"],"parameter_size":"128M","quantization_level":"Q4_0"}}]}).encode())
elif self.path.endswith(('/.well-known/serviceinfo')):
response_body = (json.dumps({"version":"0.2","software":{"name":"KoboldCpp","version":KcppVersion,"repository":"https://github.com/LostRuins/koboldcpp","homepage":"https://github.com/LostRuins/koboldcpp","logo":"https://raw.githubusercontent.com/LostRuins/koboldcpp/refs/heads/concedo/niko.ico"},"api":{"koboldai":{"name":"KoboldAI API","rel_url":"/api","documentation":"https://lite.koboldai.net/koboldcpp_api","version":KcppVersion},"openai":{"name":"OpenAI API","rel_url ":"/v1","documentation":"https://openai.com/documentation/api","version":KcppVersion}}}).encode())
elif self.path=="/api" or self.path=="/docs" or self.path.startswith(('/api/?json=','/api?json=','/docs/?json=','/docs?json=')):
content_type = 'text/html'
if embedded_kcpp_docs is None: