Closed melfebulu closed 1 week ago
Hey @melfebulu ! Was there a particular reason why you wanted to use POST
over GET
here? I certainly see your point, wouldn't mind switching over, but curious to hear if you hit a specific limitation.
long query string may cause Web browser reject.
Describe the feature you'd like
A clear and concise description of what you want to happen. Include any relevant links or screenshots or inspiration.
hello, I check the source code in /src/khoj/interface/web/chat.html
here is use GET but not POST
let url =
/api/chat?q=${encodeURIComponent(query)}&n=${resultsCount}&client=web&stream=true&conversation_id=${conversationID}®ion=${region}&city=${city}&country=${countryName};
I asked gpt,so the answer is :
Retrieving the user input for the query. Encoding the query content along with other relevant information (such as result count, client type, session ID, and geographical location information, etc.) into the URL's query string. Using this URL to initiate a network request to the server-side corresponding API endpoint through the browser. In this process, after receiving this GET request, the server processes it based on the request's parameters and returns the appropriate data.
If you want to change to using the POST method to submit information, you need to modify this part of the logic, create a request body, and then send this request body via a POST request, instead of appending all information in the query string of the URL. One advantage of doing this is that POST requests do not expose data in the URL, making them suitable for sending large amounts of data or sensitive information.