feat: count tokens for context

feat(BingAI): convert toneStyle to lowercase before setting it in state
feat(BingAI): pass setToneStyle function to Settings component
refactor(BingAI): remove unused import and change setOption to setToneStyle in Settings component
refactor(fetchers.js): add axiosPost function for debounced axios post requests
This commit is contained in:
Danny Avila 2023-04-04 10:04:21 -04:00
parent cef98070e9
commit 1a196580b2
5 changed files with 56 additions and 43 deletions

View file

@ -18,6 +18,15 @@ export const postRequest = async (url, { arg }) => {
});
};
export const axiosPost = async ({ url, arg, callback }) => {
try {
const response = await axios.post(url, { arg }, { withCredentials: true });
callback(response.data);
} catch (error) {
console.error('An error occurred while making the axios post request:', error);
}
};
export const searchFetcher = async (pre, q, pageNumber, callback) => {
pre();
const { data } = await axios.get(`/api/search?q=${q}&pageNumber=${pageNumber}`);