Compare commits

1 Commits
dev ... main

Author SHA1 Message Date
279eed8f31 测试 2025-11-06 06:29:33 +00:00
2 changed files with 230 additions and 155 deletions

181
README.md
View File

@@ -1,175 +1,46 @@
# [![Langflow](./docs/static/img/hero.png)](https://www.langflow.org) # Getting Started with Create React App
<p align="center"><strong> This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
Un Framework visual para crear aplicaciones de agentes autónomos y RAG
</strong></p>
<p align="center" style="font-size: 12px;">
De código abierto, construido en Python, totalmente personalizable, agnóstico en cuanto a modelos y bases de datos
</p>
<p align="center" style="font-size: 12px;"> ## Available Scripts
<a href="https://docs.langflow.org" style="text-decoration: underline;">Documentación</a> -
<a href="https://discord.com/invite/EqksyE2EX9" style="text-decoration: underline;">Únete a nuestro Discord</a> -
<a href="https://twitter.com/langflow_ai" style="text-decoration: underline;">Síguenos en X</a> -
<a href="https://huggingface.co/spaces/Langflow/Langflow" style="text-decoration: underline;">Demostración</a>
</p>
<p align="center"> In the project directory, you can run:
<a href="https://github.com/langflow-ai/langflow">
<img src="https://img.shields.io/github/stars/langflow-ai/langflow">
</a>
<a href="https://discord.com/invite/EqksyE2EX9">
<img src="https://img.shields.io/discord/1116803230643527710?label=Discord">
</a>
</p>
<div align="center"> ### `npm start`
<a href="./README.md"><img alt="README en Inglés" src="https://img.shields.io/badge/English-d9d9d9"></a>
<a href="./README.PT.md"><img alt="README en Portugués" src="https://img.shields.io/badge/Português-d9d9d9"></a>
<a href="./README.ES.md"><img alt="README en Español" src="https://img.shields.io/badge/Español-d9d9d9"></a>
<a href="./README.zh_CN.md"><img alt="README en Chino Simplificado" src="https://img.shields.io/badge/简体中文-d9d9d9"></a>
<a href="./README.ja.md"><img alt="README en Japonés" src="https://img.shields.io/badge/日本語-d9d9d9"></a>
<a href="./README.KR.md"><img alt="README en Coreano" src="https://img.shields.io/badge/한국어-d9d9d9"></a>
<a href="./README.FR.md"><img alt="README en Francès" src="https://img.shields.io/badge/Français-d9d9d9"></a>
<a href="./README.RU.md"><img alt="README en Russian" src="https://img.shields.io/badge/Русский"></a>
</div>
<p align="center"> Runs the app in the development mode.\
<img src="./docs/static/img/langflow_basic_howto.gif" alt="Tu GIF" style="border: 3px solid #211C43;"> Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
</p>
# 📝 Contenido The page will reload if you make edits.\
You will also see any lint errors in the console.
- [📝 Contenido](#-contenido) ### `npm test`
- [📦 Introducción](#-introducción)
- [🎨 Crear Flujos](#-crear-flujos)
- [Despliegue](#despliegue)
- [Despliegue usando Google Cloud Platform](#despliegue-usando-google-cloud-platform)
- [Despliegue en Railway](#despliegue-en-railway)
- [Despliegue en Render](#despliegue-en-render)
- [🖥️ Interfaz de Línea de Comandos (CLI)](#-interfaz-de-línea-de-comandos-cli)
- [Uso](#uso)
- [Variables de Entorno](#variables-de-entorno)
- [👋 Contribuir](#-contribuir)
- [🌟 Contribuidores](#-contribuidores)
- [📄 Licencia](#-licencia)
# 📦 Introducción Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
Puedes instalar Langflow con pip: ### `npm run build`
```shell Builds the app for production to the `build` folder.\
# Asegúrate de tener >=Python 3.10 instalado en tu sistema. It correctly bundles React in production mode and optimizes the build for the best performance.
# Instala la versión pre-release (recomendada para las actualizaciones más recientes)
python -m pip install langflow --pre --force-reinstall
# o versión estable The build is minified and the filenames include the hashes.\
python -m pip install langflow -U Your app is ready to be deployed!
```
Luego, ejecuta Langflow con: See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
```shell ### `npm run eject`
python -m langflow run
```
También puedes ver Langflow en [HuggingFace Spaces](https://huggingface.co/spaces/Langflow/Langflow). [Clona el Space usando este enlace](https://huggingface.co/spaces/Langflow/Langflow?duplicate=true) para crear tu propio espacio de trabajo de Langflow en minutos. **Note: this is a one-way operation. Once you `eject`, you cant go back!**
# 🎨 Crear Flujos If you arent satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Crear flujos con Langflow es fácil. Simplemente arrastra los componentes desde la barra lateral al espacio de trabajo y conéctalos para comenzar a construir tu aplicación. Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point youre on your own.
Explora editando los parámetros del prompt, agrupando componentes y construyendo tus propios componentes personalizados (Custom Components). You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt customize it when you are ready for it.
Cuando hayas terminado, puedes exportar tu flujo como un archivo JSON. ## Learn More
Carga el flujo con: You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
```python To learn React, check out the [React documentation](https://reactjs.org/).
from langflow.load import run_flow_from_json
results = run_flow_from_json("ruta/al/flujo.json", input_value="¡Hola, Mundo!")
```
# Despliegue
## Despliegue usando Google Cloud Platform
Sigue nuestra guía paso a paso para desplegar Langflow en Google Cloud Platform (GCP) usando Google Cloud Shell. La guía está disponible en el documento [**Langflow en Google Cloud Platform**](https://github.com/langflow-ai/langflow/blob/dev/docs/docs/deployment/gcp-deployment.md).
Alternativamente, haz clic en el botón **"Abrir en Cloud Shell"** a continuación para iniciar Google Cloud Shell, clonar el repositorio de Langflow y comenzar un **tutorial interactivo** que te guiará a través del proceso de configuración de los recursos necesarios y despliegue de Langflow en tu proyecto GCP.
[![Abrir en Cloud Shell](https://gstatic.com/cloudssh/images/open-btn.svg)](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/langflow-ai/langflow&working_dir=scripts/gcp&shellonly=true&tutorial=walkthroughtutorial_spot.md)
## Despliegue en Railway
Usa esta plantilla para desplegar Langflow 1.0 Preview en Railway:
[![Desplegar 1.0 Preview en Railway](https://railway.app/button.svg)](https://railway.app/template/UsJ1uB?referralCode=MnPSdg)
O esta para desplegar Langflow 0.6.x:
[![Desplegar en Railway](https://railway.app/button.svg)](https://railway.app/template/JMXEWp?referralCode=MnPSdg)
## Despliegue en Render
<a href="https://render.com/deploy?repo=https://github.com/langflow-ai/langflow/tree/dev">
<img src="https://render.com/images/deploy-to-render-button.svg" alt="Desplegar en Render" />
</a>
# 🖥️ Interfaz de Línea de Comandos (CLI)
Langflow proporciona una interfaz de línea de comandos (CLI) para una fácil gestión y configuración.
## Uso
Puedes ejecutar Langflow usando el siguiente comando:
```shell
langflow run [OPCIONES]
```
Cada opción se detalla a continuación:
- `--help`: Muestra todas las opciones disponibles.
- `--host`: Establece el host al que vincular el servidor. Se puede configurar usando la variable de entorno `LANGFLOW_HOST`. El valor predeterminado es `127.0.0.1`.
- `--workers`: Establece el número de procesos. Se puede configurar usando la variable de entorno `LANGFLOW_WORKERS`. El valor predeterminado es `1`.
- `--worker-timeout`: Establece el tiempo de espera del worker en segundos. El valor predeterminado es `60`.
- `--port`: Establece el puerto en el que escuchar. Se puede configurar usando la variable de entorno `LANGFLOW_PORT`. El valor predeterminado es `7860`.
- `--env-file`: Especifica la ruta al archivo .env que contiene variables de entorno. El valor predeterminado es `.env`.
- `--log-level`: Establece el nivel de registro. Se puede configurar usando la variable de entorno `LANGFLOW_LOG_LEVEL`. El valor predeterminado es `critical`.
- `--components-path`: Especifica la ruta al directorio que contiene componentes personalizados. Se puede configurar usando la variable de entorno `LANGFLOW_COMPONENTS_PATH`. El valor predeterminado es `langflow/components`.
- `--log-file`: Especifica la ruta al archivo de registro. Se puede configurar usando la variable de entorno `LANGFLOW_LOG_FILE`. El valor predeterminado es `logs/langflow.log`.
- `--cache`: Selecciona el tipo de caché a utilizar. Las opciones son `InMemoryCache` y `SQLiteCache`. Se puede configurar usando la variable de entorno `LANGFLOW_LANGCHAIN_CACHE`. El valor predeterminado es `SQLiteCache`.
- `--dev/--no-dev`: Alterna el modo de desarrollo. El valor predeterminado es `no-dev`.
- `--path`: Especifica la ruta al directorio frontend que contiene los archivos de compilación. Esta opción es solo para fines de desarrollo. Se puede configurar usando la variable de entorno `LANGFLOW_FRONTEND_PATH`.
- `--open-browser/--no-open-browser`: Alterna la opción de abrir el navegador después de iniciar el servidor. Se puede configurar usando la variable de entorno `LANGFLOW_OPEN_BROWSER`. El valor predeterminado es `open-browser`.
- `--remove-api-keys/--no-remove-api-keys`: Alterna la opción de eliminar las claves API de los proyectos guardados en la base de datos. Se puede configurar usando la variable de entorno `LANGFLOW_REMOVE_API_KEYS`. El valor predeterminado es `no-remove-api-keys`.
- `--install-completion [bash|zsh|fish|powershell|pwsh]`: Instala la función de autocompletar para el shell especificado.
- `--show-completion [bash|zsh|fish|powershell|pwsh]`: Muestra el código para la función de autocompletar para el shell especificado, permitiéndote copiar o personalizar la instalación.
- `--backend-only`: Este parámetro, con valor predeterminado `False`, permite ejecutar solo el servidor backend sin el frontend. También se puede configurar usando la variable de entorno `LANGFLOW_BACKEND_ONLY`.
- `--store`: Este parámetro, con valor predeterminado `True`, activa las funciones de la tienda, usa `--no-store` para desactivarlas. Se puede configurar usando la variable de entorno `LANGFLOW_STORE`.
Estos parámetros son importantes para los usuarios que necesitan personalizar el comportamiento de Langflow, especialmente en escenarios de desarrollo o despliegue especializado.
### Variables de Entorno
Puedes configurar muchas de las opciones de CLI usando variables de entorno. Estas se pueden exportar en tu sistema operativo o agregar a un archivo `.env` y cargarse usando la opción `--env-file`.
Se incluye un archivo de ejemplo `.env` llamado `.env.example` en el proyecto. Copia este archivo a un nuevo archivo llamado `.env` y reemplaza los valores de ejemplo con tus configuraciones reales. Si estás estableciendo valores tanto en tu sistema operativo como en el archivo `.env`, las configuraciones del `.env` tendrán prioridad.
# 👋 Contribuir
Aceptamos contribuciones de desarrolladores de todos los niveles para nuestro proyecto de código abierto en GitHub. Si deseas contribuir, por favor, consulta nuestras [directrices de contribución](./CONTRIBUTING.md) y ayuda a hacer que Langflow sea más accesible.
---
[![Historial de Estrellas](https://api.star-history.com/svg?repos=langflow-ai/langflow&type=Timeline)](https://star-history.com/#langflow-ai/langflow&Date)
# 🌟 Contribuidores
[![contribuidores de langflow](https://contrib.rocks/image?repo=langflow-ai/langflow)](https://github.com/langflow-ai/langflow/graphs/contributors)
# 📄 Licencia
Langflow se publica bajo la licencia MIT. Consulta el archivo [LICENSE](LICENSE) para más detalles.

View File

@@ -0,0 +1,204 @@
#!/bin/bash
set -euo pipefail
# ========================
# 常量定义
# ========================
SCRIPT_NAME=$(basename "$0")
NODE_MIN_VERSION=18
NODE_INSTALL_VERSION=22
NVM_VERSION="v0.40.3"
CLAUDE_PACKAGE="@anthropic-ai/claude-code"
CONFIG_DIR="$HOME/.claude"
CONFIG_FILE="$CONFIG_DIR/settings.json"
API_BASE_URL="https://open.bigmodel.cn/api/anthropic"
API_KEY_URL="https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys"
API_TIMEOUT_MS=3000000
# ========================
# 工具函数
# ========================
log_info() {
echo "🔹 $*"
}
log_success() {
echo "$*"
}
log_error() {
echo "$*" >&2
}
ensure_dir_exists() {
local dir="$1"
if [ ! -d "$dir" ]; then
mkdir -p "$dir" || {
log_error "Failed to create directory: $dir"
exit 1
}
fi
}
# ========================
# Node.js 安装函数
# ========================
install_nodejs() {
local platform=$(uname -s)
case "$platform" in
Linux|Darwin)
log_info "Installing Node.js on $platform..."
# 安装 nvm
log_info "Installing nvm ($NVM_VERSION)..."
curl -s https://raw.githubusercontent.com/nvm-sh/nvm/"$NVM_VERSION"/install.sh | bash
# 加载 nvm
log_info "Loading nvm environment..."
\. "$HOME/.nvm/nvm.sh"
# 安装 Node.js
log_info "Installing Node.js $NODE_INSTALL_VERSION..."
nvm install "$NODE_INSTALL_VERSION"
# 验证安装
node -v &>/dev/null || {
log_error "Node.js installation failed"
exit 1
}
log_success "Node.js installed: $(node -v)"
log_success "npm version: $(npm -v)"
;;
*)
log_error "Unsupported platform: $platform"
exit 1
;;
esac
}
# ========================
# Node.js 检查函数
# ========================
check_nodejs() {
if command -v node &>/dev/null; then
current_version=$(node -v | sed 's/v//')
major_version=$(echo "$current_version" | cut -d. -f1)
if [ "$major_version" -ge "$NODE_MIN_VERSION" ]; then
log_success "Node.js is already installed: v$current_version"
return 0
else
log_info "Node.js v$current_version is installed but version < $NODE_MIN_VERSION. Upgrading..."
install_nodejs
fi
else
log_info "Node.js not found. Installing..."
install_nodejs
fi
}
# ========================
# Claude Code 安装
# ========================
install_claude_code() {
if command -v claude &>/dev/null; then
log_success "Claude Code is already installed: $(claude --version)"
else
log_info "Installing Claude Code..."
npm install -g "$CLAUDE_PACKAGE" || {
log_error "Failed to install claude-code"
exit 1
}
log_success "Claude Code installed successfully"
fi
}
configure_claude_json(){
node --eval '
const os = require("os");
const fs = require("fs");
const path = require("path");
const homeDir = os.homedir();
const filePath = path.join(homeDir, ".claude.json");
if (fs.existsSync(filePath)) {
const content = JSON.parse(fs.readFileSync(filePath, "utf-8"));
fs.writeFileSync(filePath, JSON.stringify({ ...content, hasCompletedOnboarding: true }, null, 2), "utf-8");
} else {
fs.writeFileSync(filePath, JSON.stringify({ hasCompletedOnboarding: true }, null, 2), "utf-8");
}'
}
# ========================
# API Key 配置
# ========================
configure_claude() {
log_info "Configuring Claude Code..."
echo " You can get your API key from: $API_KEY_URL"
read -s -p "🔑 Please enter your ZHIPU API key: " api_key
echo
if [ -z "$api_key" ]; then
log_error "API key cannot be empty. Please run the script again."
exit 1
fi
ensure_dir_exists "$CONFIG_DIR"
# 写入配置文件
node --eval '
const os = require("os");
const fs = require("fs");
const path = require("path");
const homeDir = os.homedir();
const filePath = path.join(homeDir, ".claude", "settings.json");
const apiKey = "'"$api_key"'";
const content = fs.existsSync(filePath)
? JSON.parse(fs.readFileSync(filePath, "utf-8"))
: {};
fs.writeFileSync(filePath, JSON.stringify({
...content,
env: {
ANTHROPIC_AUTH_TOKEN: apiKey,
ANTHROPIC_BASE_URL: "'"$API_BASE_URL"'",
API_TIMEOUT_MS: "'"$API_TIMEOUT_MS"'",
}
}, null, 2), "utf-8");
' || {
log_error "Failed to write settings.json"
exit 1
}
log_success "Claude Code configured successfully"
}
# ========================
# 主流程
# ========================
main() {
echo "🚀 Starting $SCRIPT_NAME"
check_nodejs
install_claude_code
configure_claude_json
configure_claude
echo ""
log_success "🎉 Installation completed successfully!"
echo ""
echo "🚀 You can now start using Claude Code with:"
echo " claude"
}
main "$@"