Rename chat completions endpoints

OpenAI calls this the "Chat Completions API", in contrast to their
previous "Text Completions API", so that's what I'm naming it; both
because other services besides OpenAI implement it, and to avoid
confusion with the existing /api/openai route used for OpenAI extras.
This commit is contained in:
valadaptive 2023-12-11 23:33:52 -05:00
parent 796659f68c
commit 92bd766bcb
2 changed files with 6 additions and 6 deletions

View File

@ -1556,7 +1556,7 @@ async function sendOpenAIRequest(type, messages, signal) {
generate_data['seed'] = oai_settings.seed; generate_data['seed'] = oai_settings.seed;
} }
const generate_url = '/generate_openai'; const generate_url = '/api/backends/chat-completions/generate';
const response = await fetch(generate_url, { const response = await fetch(generate_url, {
method: 'POST', method: 'POST',
body: JSON.stringify(generate_data), body: JSON.stringify(generate_data),
@ -1646,7 +1646,7 @@ async function calculateLogitBias() {
let result = {}; let result = {};
try { try {
const reply = await fetch(`/openai_bias?model=${getTokenizerModel()}`, { const reply = await fetch(`/api/backends/chat-completions/bias?model=${getTokenizerModel()}`, {
method: 'POST', method: 'POST',
headers: getRequestHeaders(), headers: getRequestHeaders(),
body, body,
@ -2439,7 +2439,7 @@ async function getStatusOpen() {
} }
try { try {
const response = await fetch('/getstatus_openai', { const response = await fetch('/api/backends/chat-completions/status', {
method: 'POST', method: 'POST',
headers: getRequestHeaders(), headers: getRequestHeaders(),
body: JSON.stringify(data), body: JSON.stringify(data),

View File

@ -626,7 +626,7 @@ function cleanUploads() {
} }
/* OpenAI */ /* OpenAI */
app.post('/getstatus_openai', jsonParser, async function (request, response_getstatus_openai) { app.post('/api/backends/chat-completions/status', jsonParser, async function (request, response_getstatus_openai) {
if (!request.body) return response_getstatus_openai.sendStatus(400); if (!request.body) return response_getstatus_openai.sendStatus(400);
let api_url; let api_url;
@ -702,7 +702,7 @@ app.post('/getstatus_openai', jsonParser, async function (request, response_gets
} }
}); });
app.post('/openai_bias', jsonParser, async function (request, response) { app.post('/api/backends/chat-completions/bias', jsonParser, async function (request, response) {
if (!request.body || !Array.isArray(request.body)) if (!request.body || !Array.isArray(request.body))
return response.sendStatus(400); return response.sendStatus(400);
@ -1067,7 +1067,7 @@ async function sendPalmRequest(request, response) {
} }
} }
app.post('/generate_openai', jsonParser, function (request, response_generate_openai) { app.post('/api/backends/chat-completions/generate', jsonParser, function (request, response_generate_openai) {
if (!request.body) return response_generate_openai.status(400).send({ error: true }); if (!request.body) return response_generate_openai.status(400).send({ error: true });
switch (request.body.chat_completion_source) { switch (request.body.chat_completion_source) {