@@ -30,12 +30,8 @@ function App() {
30
30
31
31
const onClickSendPromptButton = useCallback (
32
32
( extraText , topP , temp ) => {
33
- const ENDPOINT = ! ! process . env . REACT_APP_MODEL_ENDPOINT_URL ? process . env . REACT_APP_MODEL_ENDPOINT_URL : ""
34
-
35
- const API_KEY = ! ! process . env . REACT_APP_MODEL_API_KEY ? process . env . REACT_APP_MODEL_API_KEY : ""
36
-
37
- const MODEL_ID = ! ! process . env . REACT_APP_MODEL_ID ? process . env . REACT_APP_MODEL_ID : ""
38
- const finalUrl = ! ! process . env . REACT_APP_USE_PROXY
33
+ const ENDPOINT = ! ! process . env . REACT_APP_MODEL_ENDPOINT_URL ? process . env . REACT_APP_MODEL_ENDPOINT_URL : "http://localhost:8000/completion"
34
+ const finalUrl = process . env . REACT_APP_USE_PROXY === "true"
39
35
? `https://cors-proxy-janko.herokuapp.com/${ ENDPOINT } `
40
36
: ENDPOINT
41
37
@@ -46,12 +42,10 @@ function App() {
46
42
method : "POST" ,
47
43
headers : {
48
44
Accept : "application/json" ,
49
- "Content-Type" : "application/json" ,
50
- Authorization : `Bearer ${ API_KEY } `
45
+ "Content-Type" : "application/json"
51
46
} ,
52
47
body : JSON . stringify ( {
53
48
data : fullPrompt . trim ( ) ,
54
- modelId : MODEL_ID ,
55
49
input_kwargs : {
56
50
top_p : topP ,
57
51
temp : temp ,
@@ -64,8 +58,8 @@ function App() {
64
58
. then ( data => {
65
59
setIsLoading ( false )
66
60
setErrorText ( "" )
67
- if ( data && data . result && data . result . length ) {
68
- let finalText = data . result [ 0 ] ?. generated_text
61
+ if ( data ) {
62
+ let finalText = data [ 0 ] ?. generated_text . substring ( promptText . length )
69
63
if ( finalText . search ( "<|endoftext|>" ) > - 1 ) {
70
64
finalText = finalText . split ( "<|endoftext|>" ) [ 0 ]
71
65
}
0 commit comments