Skip to content

Enhance APIRequestBuilder: Add JSON escaping for system and user promt#557

Open
longshuicy wants to merge 1 commit intomainfrom
556-system-prompt-override-causes-405-when-using-api
Open

Enhance APIRequestBuilder: Add JSON escaping for system and user promt#557
longshuicy wants to merge 1 commit intomainfrom
556-system-prompt-override-causes-405-when-using-api

Conversation

@longshuicy
Copy link
Collaborator

To test:
Type "" and enter in the API query builder.
You should get something like below:

curl -X POST http://localhost:3000/api/chat-api/chat \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Qwen/Qwen2.5-VL-72B-Instruct",
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful AI assistant. Follow instructions carefully. Respond using markdown.\nlalala\nlalala\ntest \"test\"\ntest \\n test"
      },
      {
        "role": "user",
        "content": "What is in these documents?"
      }
    ],
    "api_key": <YOUR API KEY>,
    "course_name": "chat",
    "stream": false,
    "temperature": 0.1,
    "retrieval_only": false
  }'

Test the curl and you should expect to see results back

…pts to ensure valid JSON output. Update tests to verify multi-line prompt handling. Update .gitignore to include cursor workspace files.
@longshuicy longshuicy linked an issue Feb 26, 2026 that may be closed by this pull request
@vercel
Copy link

vercel bot commented Feb 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
uiuc-chat-frontend Building Building Preview, Comment Feb 26, 2026 6:31pm

Request Review

Copy link
Collaborator

@rohan-uiuc rohan-uiuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\n works fine. Do we want to handle quotes(', ") too? For example go here and try the curl, it will break due to ' in the system prompt. Also, I would encourage adding a test for that use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System prompt override causes 405 when using API

2 participants