Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix validation logic for the chat history #3

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ export const isValidConversationHistory = (history: any) => {
return true;
}

if (
(item.role !== 'user' && item.role !== 'ai' && item.role !== 'system') ||
typeof item.message !== 'string'
) {
if (!['user', 'ai', 'system', 'assistant'].includes(item.role) || typeof item.message !== 'string') {
return true;
}
})) {
Expand Down
6 changes: 3 additions & 3 deletions packages/node/server/src/serve/displayHelp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export const displayHelp = () => {
log(' @nlbridge/server [params]');
log('');
log('Required:');
log(' --api <openapi> The AI backend to use\n' +
' Only OpenAPI is supported at the moment');
log(' --api <openai> The AI backend to use\n' +
' Only OpenAI is supported at the moment');
log('');
log('Optional:');
log(' --api-key <key> The API key to use for the AI backend\n' +
log(' --apiKey <key> The API key to use for the AI backend\n' +
' Default: Read from environment variable (e.g. OPENAI_API_KEY)\n');
log(' --port [port] Port to use for HTTP server - Default: Random value between 8000 and 8999');
log(' --cors <origin> Enable CORS for the specified origin - Default: "*"');
Expand Down
6 changes: 3 additions & 3 deletions pipeline/npm/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ Usage:
@nlbridge/server [params]

Required:
--api <openapi> The AI backend to use
Only OpenAPI is supported at the moment
--api <openai> The AI backend to use
Only OpenAI is supported at the moment

Optional:
--api-key <key> The API key to use for the AI backend
--apiKey <key> The API key to use for the AI backend
Default: Read from environment variable (e.g. OPENAI_API_KEY)

--port [port] Port to use for HTTP server - Default: Random value between 8000 and 8999
Expand Down