Skip to content

Commit

Permalink
update to 1.0.17
Browse files Browse the repository at this point in the history
  • Loading branch information
mieslep committed Aug 27, 2024
1 parent a14d11c commit 915678e
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 8 deletions.
54 changes: 54 additions & 0 deletions LOADBALANCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Load Balancing and Routing

Langflow (at least at version 1.0.15) expects all URLs to be rooted from `/`: there is not a straightforward way to configure a `base_url` or similar.
This is a challenge for load balancers and other application routers. This goal of this page is to inform you about some tricks you can use
to configure your own system; it is based on the popular Nginx framework but should be easily translatable to whatever framework you use.

## Server Proxy

Consider this Nginx `server` configuration, which allows Langflow developers to access the UI at `langflow.dev.internal` on port `80`,
whilst routing requests to `langflow.dev.service` on port `7860`:

```
server {
listen 80;
server_name langflow.dev.internal;
location / {
proxy_pass http://langflow.dev.service:7860;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
```

## Server Proxy with Routing

To add an application routing based on URL (in this case `/chat`), use the route to identify the destination location, but
remove the route from the URL before passing to Langflow:

```
server {
listen 80;
server_name langflow.test.internal;
location /chat {
rewrite ^/chat/(.*)$ /$1 break;
proxy_pass http://langflow.test.service:7860;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
```

Two important things to note about this routing approach:

1. The Langflow frontend will not work without a '/' location, but backend API calls should. You can combine both locations within the `server` configuration.
2. Some returned content (such as when an API is called with `stream=true`) includes URLs that will not be prefixed (i.e. `stream_url` will begin `/api/v1/...`); you will need to add the prefix within your application logic.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ apply your own Enterprise architucture patterns to it.

## Langflow Version

This repo is currently based on Langflow v1.0.14; future versions of Langflow may change
This repo is currently based on Langflow v1.0.17; future versions of Langflow may change
the advice.

## Contributions
Expand Down
6 changes: 4 additions & 2 deletions example.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,10 @@ <h2>Document Summary</h2>
output_type: "chat",
input_type: "chat",
"tweaks": {
"TextInput-eYtbq": {"input_value": base64Content },
"TextInput-AlrlI": {"input_value": filename }
"Parameter Input": {
"base64_file": base64Content,
"filename": filename
}
}
})
})
Expand Down
2 changes: 1 addition & 1 deletion flows/AstraMemoryChatbot.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion flows/BasicMemoryChatbot.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion flows/PiratePrompt.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion flows/ResearchPaperDigest.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion render.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ services:
- key: LANGFLOW_HOST
value: 0.0.0.0
- key: LANGFLOW_PORT
value: 10000
value: 10000 # This is the default port used by Render
- key: LANGFLOW_LOG_LEVEL
value: INFO
- fromGroup: langflow-demo-flow-secrets
Expand Down

0 comments on commit 915678e

Please sign in to comment.