aba61c3d by jeff

jeff_fix_maxtoken

1 parent 864f97cc
Showing 1 changed file with 8 additions and 7 deletions
...@@ -38,7 +38,7 @@ app.post('/api', async (req, res) => { ...@@ -38,7 +38,7 @@ app.post('/api', async (req, res) => {
38 38
39 str_length = req.body.message.split(' ').length; 39 str_length = req.body.message.split(' ').length;
40 40
41 if (str_length>=1000){ 41 if (str_length>=800){
42 arr_body = req.body.message.split("\n"); 42 arr_body = req.body.message.split("\n");
43 if (arr_body.length>=4){ 43 if (arr_body.length>=4){
44 var i = arr_body.length-2 44 var i = arr_body.length-2
...@@ -62,13 +62,14 @@ app.post('/api', async (req, res) => { ...@@ -62,13 +62,14 @@ app.post('/api', async (req, res) => {
62 }) 62 })
63 63
64 } catch (e) { 64 } catch (e) {
65 // let error_msg = e.response.data.error.message ? e.response.data.error.message : ''; 65 let error_msg = e.response.data.error.message ? e.response.data.error.message : '';
66 // if (error_msg.indexOf('maximum context length')>=0){ 66 if (error_msg.indexOf('maximum context length')>=0){
67 // console.log(error_msg); 67 res.json({
68 // }else{ 68 message: "You have reach prompt limit. Please narrow down your request prompt.",
69 // console.log(e.response); 69 })
70 // } 70 }else{
71 console.log(e.response); 71 console.log(e.response);
72 }
72 } finally { 73 } finally {
73 // console.log('We do cleanup here'); 74 // console.log('We do cleanup here');
74 } 75 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!