Skip to content

Commit

Permalink
chore(index.html): update Langflow Chat component attributes to match…
Browse files Browse the repository at this point in the history
… new flow ID, chat input field name, and API key

fix(index.ts): update headers object to include "api-key" header when provided in sendMessage function
  • Loading branch information
anovazzi1 committed Sep 21, 2023
1 parent d90e2b2 commit 35e39af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
</head>
<body style="width: 100vh; height: 100vh; ">
<langflow-chat window_title="Langflow Chat"
flow_id="d124776a-39ec-428e-9faa-169466cd6a38"
chat_inputs='{"chat":""}'
chat_input_field="chat"
flow_id="ae8ce68e-a6f9-4825-8543-99ba00f75110"
chat_inputs='{"text":""}'
chat_input_field="text"
host_url="http:https://localhost:7860"
style="position: fixed; bottom: 50px; right: 50px;"
api_key="lf-o6nUpFGaLwfFK76wobVkqTqMrlIeLAMwXKWq57RnJuE"
></langflow-chat>
</body>
</html>
7 changes: 4 additions & 3 deletions src/controllers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ export async function sendMessage(baseUrl: string, flowId: string, message: stri
else {
data = { inputs: inputs };
}
if(api_key){
data = {...data, api_key};
const headers:{[key:string]:string}= {"Content-Type": "application/json"}
if( api_key){
headers["api-key"]=api_key;
}
let response = axios.post(`${baseUrl}/api/v1/process/${flowId}`, data,{headers:{"Content-Type": "application/json"}});
let response = axios.post(`${baseUrl}/api/v1/process/${flowId}`, data,{headers});
return response;
}

0 comments on commit 35e39af

Please sign in to comment.