Skip to content

Commit

Permalink
server : throw an error when slot unavailable (ggerganov#4741)
Browse files Browse the repository at this point in the history
  • Loading branch information
jparkerweb authored Jan 3, 2024
1 parent f3f62f0 commit f2eb19b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/server/public/completion.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ export async function* llama(prompt, params = {}, config = {}) {
break;
}
}
if (result.error) {
result.error = JSON.parse(result.error);
if (result.error.content.includes('slot unavailable')) {
// Throw an error to be caught by upstream callers
throw new Error('slot unavailable');
} else {
console.error(`llama.cpp error: ${result.error.content}`);
}
}
if (result.error) {
result.error = JSON.parse(result.error);
console.error(`llama.cpp error: ${result.error.content}`);
Expand Down

0 comments on commit f2eb19b

Please sign in to comment.