1. Project Overview & Quickstart (refly-ai/refly)
File: apps/api/README.md
Refly API
Docker Images
Prepare middlewares:
cd deploy/docker
docker-compose -f docker-compose.middleware.yml up -dVisit minio console on http://localhost:9001, with username and password specified in docker-compose.yml.
Installation
$ npm installRunning the app
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prodTest
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:covFile: docs/en/community/contact-us.md
Contact Us
Join our community to get help, share your experience, and connect with other Refly users.
Discord
Join our Discord server for real-time discussions and support:
Discord 👉 https://discord.com/invite/YVuYFjFvRC
Send an email to [email protected] for help at any time.
GitHub Discussions
Discuss with us and get help on GitHub:
https://github.com/refly-ai/refly/discussions
WeChat Group
Scan the QR code to join our WeChat group:
::: tip Tip
If the QR code expires, please contact us via email: [email protected]
:::
WeChat Official Account
Scan the QR code to follow our WeChat official account:
Lark Group
Scan the QR code to join our Lark group:
File: docs/en/changelog/v0.1.1.md
v0.1.1 Release Notes
**New Feature Support**
- Canvas Management in Sidebar: The sidebar now supports the deletion of canvases and can expand to display up to 10 canvases. It also includes hover functionality to display list element menus.
- Node Connection Management: Default node connections can be hidden, with connections still visible when hovering over a node. Users can toggle node connections on or off to reduce clutter on the canvas.
- Canvas Update Synchronization: The canvas now displays update synchronization status, reducing user concerns about unclear data saving.
- Enhanced Text Import: The limit for plain text copy and paste import has been increased from 6,000 to 100,000 characters, supporting the import of larger text volumes.
**Core Issue Optimization**
- Browser Language Auto-Detection: Improved automatic detection of browser language settings to better match your language preferences.
- Default AI Response Language: For new registrants, the default setting for "AI Response Language" is now "Auto," ensuring responses match the language of the user's query, preventing responses in English or a mismatch despite specified language settings.
- Follow-Up Question Logic: The AI response for follow-up questions is now automatically pinned. Contextual follow-up is supported for any resource, document, or AI reply, including web searches, knowledge base searches, general Q&A, and document generation.
- Preview Card Positioning: Clicking the "Preview Button" on a node card now moves the preview card to the far left, facilitating easier content localization.
- Menu Bar Visibility: Fixed the issue where the menu bar on cards did not appear.
- Error Handling: In the event of errors or crashes, users are directed to a fallback page with a refresh prompt, avoiding the display of error stack pages.
- Document Data Handling: Fixed the error that occurred during vector/RAG processing when document data was empty.
- Canvas Performance Optimization: Prevented repeated connections from consuming memory when the page is inactive.
- Data Synchronization: Improved canvas data synchronization to prevent outdated data from overwriting new data, including canvas titles and node content.
- AI Language Compliance in Documents: Fixed the issue where "Ask AI" in documents did not adhere to the set output language, ensuring consistency with user settings.
- AI Output Formatting: Optimized the output of
<response>in documents. - AI Input Field Reset: Fixed the issue where the AI input field was not cleared after switching canvases.
- Skill Output Language Compliance: Fixed the issue where the "Recommended Questions" skill did not follow the set "Output Language."
- Retry Prompt for Network Issues: Improved the retry prompt for network issues, now featuring a modal confirmation.
- Document Preview and Card Title Synchronization: Enhanced synchronization between document previews and card titles.
**Other Bug Fixes or Optimizations**
- Boundary Crash Fix: Resolved the crash issue at the N+ boundary.
- Skill/AI Query Error Handling: Fixed errors that occurred during skill execution or AI queries.
- Context Selection Box Width Adjustment: Supported adjustable width for context selection boxes and fixed style display issues.
- Token Insufficiency Handling: Resolved the continuous error polling issue when tokens were insufficient.
- Feedback Group Access: Added an entry point for joining the feedback group after login.
File: docs/en/changelog/v0.1.2.md
v0.1.2 Release Notes
**New Feature Support**
- Supports deleting canvases from the sidebar and expanding to display up to 10 canvases, with hover display of list element menus.
- Supports default hiding of node connections, with connections still visible when hovering over nodes, and toggleable node connections to reduce canvas clutter.
- Supports displaying the update synchronization status of canvases to alleviate user concerns about data saving.
- Supports expanding the import of plain text from 6,000 to 100,000 characters, enabling the import of larger text content.
**Core Issue Optimization**
- Optimizes automatic recognition of browser language settings to better match your language preferences.
- Sets the default "AI Answer Language" for new registered users to Auto, ensuring responses are in the same language as the user's question, avoiding responses in English or a specified language that still default to English.
- Optimizes follow-up logic by automatically pinning AI answers to follow-up questions. Follow-up questions based on any resource, document, or AI reply now carry context, and all skills including web search, knowledge base search, general Q&A, and document generation support context-carrying follow-ups.
- Improves preview card positioning; clicking the "Preview Button" on a node card now moves the right-side preview card to the far left, facilitating easier content localization.
- Fixes the issue where menu bars on cards do not appear.
- In case of errors or crashes leading to a fallback page, prompts to refresh and open, avoiding the display of error stack pages.
- Fixes errors when performing vector/RAG processing on empty document data.
- Optimizes canvas performance to prevent memory issues from repeated connections when the page is inactive.
- Enhances canvas data synchronization to prevent outdated data from overwriting new data (including canvas titles and node content).
- Fixes the issue where "Ask AI" in documents does not adhere to the set output language, e.g., still outputs in the language of the user's input even if English is set.
- Optimizes the output of
<response>in documents when using "Ask AI." - Fixes the issue where the content in the AI input box is not cleared after switching canvases.
- Fixes the issue where the "Recommended Questions" skill does not follow the set "Output Language."
- Improves retry prompts due to network issues, now displaying a modal box for confirmation.
- Enhances synchronization of titles in document previews and cards.
**Other Bug Fixes or Optimizations**
- Fixes N+ boundary crash issues.
- Resolves errors when executing skills or AI questions.
- Supports adjustable width for context selection boxes and fixes style display issues.
- Fixes continuous polling errors when tokens are insufficient.
- Adds an entry to join the feedback group after logging in.
2. Official Technical Reference & Guides (refly-ai/refly-docs)
File: en/guide/self-deploy/index.md
Self Deploy
Prerequisites {#prerequisites}
To self-deploy Refly, you need to have the following installed:
- Docker (version 20.10.0 or higher)
- Optional: PostgreSQL client (either
psqlor GUI-based tools), used for managing usable LLM models
::: info
We plan to provide a fully-functional native application in the future, offering seamless installation experience in a privacy-focused manner. Stay tuned!
:::
Steps {#steps}
1. Clone the repository {#clone-the-repository}
git clone https://github.com/refly-ai/refly.git::: tip
If you only need to deploy with Docker, you can add --depth 1 to the clone command to save disk space and download time.
:::
2. Prepare the configuration via `.env` file {#prepare-the-configuration-via-env-file}
cd refly/deploy/docker
cp ../../apps/api/.env.example .envNotes on must-set environment variables:
- Envs for LLM inference:
OPENAI_API_KEY: API key for OpenAI (or any other compatible provider)OPENAI_BASE_URL: Base URL for other OpenAI compatible providerOPENROUTER_API_KEY: OpenRouter API key (This will overrideOPENAI_BASE_URLwith OpenRouter's if provided)
- Envs for Embeddings:
EMBEDDINGS_PROVIDER: Embeddings provider, currently supportopenai,jinaandfireworksEMBEDDINGS_MODEL_NAME: The name of the embeddings model, which could be different for different providersOPENAI_API_KEY: Required ifEMBEDDINGS_PROVIDERisopenaiJINA_API_KEY: Required ifEMBEDDINGS_PROVIDERisjinaFIREWORKS_API_KEY: Required ifEMBEDDINGS_PROVIDERisfireworks
- Envs for Web Search:
SERPER_API_KEY: Serper API key
::: info
A comprehensive list of all the configuration options is available in the Configuration.
:::
3. Start the application via docker compose {#start-the-application-via-docker-compose}
docker compose up -d::: tip For passionate users
By default, the docker compose file will pull the latest image, which is the latest stable version. If you want to use the up-to-date version synced with the Refly Cloud, you can replace image tag latest with nightly in the docker-compose.yml file.
:::
You can run docker ps to check the status of the containers. The expected status for each container should be Up and healthy. An example output is shown below:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
71681217973e reflyai/refly-api:latest "docker-entrypoint.s…" 5 hours ago Up 5 hours (healthy) 3000/tcp, 0.0.0.0:5800-5801->5800-5801/tcp, :::5800-5801->5800-5801/tcp refly_api
462d7e1181ca reflyai/qdrant:v1.13.1 "./entrypoint.sh" 5 hours ago Up 5 hours (healthy) 0.0.0.0:6333-6334->6333-6334/tcp, :::6333-6334->6333-6334/tcp refly_qdrant
fd287fa0a04e redis/redis-stack:6.2.6-v18 "/entrypoint.sh" 5 hours ago Up 5 hours (healthy) 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp, 0.0.0.0:8001->8001/tcp, :::8001->8001/tcp refly_redis
16321d38fc34 reflyai/refly-web:latest "/docker-entrypoint.…" 5 hours ago Up 5 hours 0.0.0.0:5700->80/tcp, [::]:5700->80/tcp refly_web
2e14ec2e55a2 reflyai/elasticsearch:7.10.2 "/tini -- /usr/local…" 5 hours ago Up 5 hours (healthy) 0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 9300/tcp refly_elasticsearch
a13f349fe35b minio/minio:RELEASE.2025-01-20T14-49-07Z "/usr/bin/docker-ent…" 5 hours ago Up 5 hours (healthy) 0.0.0.0:9000-9001->9000-9001/tcp, :::9000-9001->9000-9001/tcp refly_minio
e7b398dbd02b postgres:16-alpine "docker-entrypoint.s…" 5 hours ago Up 5 hours (healthy) 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp refly_dbFinally, you can access the Refly application in http://${HOST_IP}:5700, where ${HOST_IP} is the IP address of the host machine.
::: info
If you cannot access the Refly application, please check the following:
- The
HOST_IPis correct. - The application is running properly. If not, jump to Troubleshooting.
- The port
5700is not being blocked by any application firewall. Check this especially if you are using a cloud server.
:::
4. Initialize models {#initialize-models}
Models are configured via the refly.model_infos table within the refly_db PostgreSQL database. We have prepared the SQL files for some common providers with recommended models:
| Provider | OPENAI_BASE_URL |
SQL File |
|---|---|---|
| OpenAI | (empty) | openai.sql |
| OpenRouter | https://openrouter.ai/api/v1 |
openrouter.sql |
| DeepSeek | https://api.deepseek.com |
deepseek.sql |
| Ollama | http://host.docker.internal:11434/v1 |
ollama.sql |
Choose one of the providers and execute it against the refly_db container. For example:
# Initialize recommended OpenAI models
curl https://raw.githubusercontent.com/refly-ai/refly/main/deploy/model-providers/openai.sql | docker exec -i refly_db psql -U refly -d refly# Or, initialize recommended OpenRouter models
curl https://raw.githubusercontent.com/refly-ai/refly/main/deploy/model-providers/openrouter.sql | docker exec -i refly_db psql -U refly -d refly# Or, initialize recommended DeepSeek models
curl https://raw.githubusercontent.com/refly-ai/refly/main/deploy/model-providers/deepseek.sql | docker exec -i refly_db psql -U refly -d refly::: warning
Refly currently only support one model provider. If you decide to switch to another provider or encounter the error duplicate key value violates unique constraint "model_infos_name_key", you need to truncate the refly.model_infos table first:
docker exec -it refly_db psql -U refly -d refly -c "TRUNCATE TABLE refly.model_infos;":::
::: info
For detailed explanation of model configurations, please refer to the Configuration page.
:::
Upgrade Guide {#upgrade-guide}
To upgrade to the latest stable version, you can pull the latest image and restart the containers:
docker compose pull
docker compose down
docker compose up -d --remove-orphansIf you run into any issues, please refer to the Troubleshooting section.
Troubleshooting {#troubleshooting}
If the application fails to function properly, you can try the following steps:
- Run
docker ps --filter name=refly_ | grep -v 'healthy'to identify unhealthy containers (whose status is nothealthy). - Run
docker logs <container_id>to get more information about the unhealthy container. - If the unhealthy container is
refly_api, you can first try to rundocker restart refly_apito restart the container. - For others, you can search for the cause of error messages in the container's logs.
If the issue persists, you can raise an issue in our GitHub repository, or contact us in our Discord Server.
File: en/guide/self-deploy/ollama.md
Ollama
This guide will walk you through using Refly with Ollama on your own machine.
Install Refly
We assume that you have followed the Self Deploy guide to install Refly. It is perfectly OK if you have not configured the environment variables and models yet.
Install Ollama
Head over to the Ollama home page and press the "Download" button.
After downloading and running the installer, you can verify Ollama is working properly by running the following command:
ollama -vDownload Models
Refly requires both embedding models and LLMs. You can download the models by running the following commands:
# Download your favorite embedding model
ollama pull nomic-embed-text
# Download your favorite LLMs
ollama pull deepseek-r1:7b
ollama pull deepseek-r1:14b
ollama pull llama3.3:70b::: tip
You can find more models to choose from on Ollama Models.
:::
Verify that the models are downloaded successfully by running the following command:
ollama listMake sure the Ollama server is running properly:
curl http://localhost:11434If the message Ollama is running is returned, you are good to go. Otherwise, please run ollama serve to start the server.
Configure Refly
To integrate Ollama with Refly, you need to configure the following environment variables in the deploy/docker/.env file:
# Ollama is perfectly compatible with OpenAI API, so we set the embedding provider to openai here
EMBEDDINGS_PROVIDER=openai
# Choose the embedding model listed in `ollama list`
EMBEDDINGS_MODEL_NAME=nomic-embed-text
# Configure the base URL of the Ollama server
# Since we are accessing Ollama on the host from the container, we need to use `host.docker.internal`
OPENAI_BASE_URL=http://host.docker.internal:11434/v1
# The API key is required but not used, so we just set a dummy value here
OPENAI_API_KEY=ollamaAt the same time, it is necessary to configure in the previous apps\api\.env file.
# Configure the base URL of the Ollama server
# Since we access Ollama on the host from within the container, we need to use `host.docker.internal`
OPENAI_BASE_URL=http://host.docker.internal:11434/v1
# API key is required but will not be used, so we just need to set a dummy value.
OPENAI_API_KEY=ollama::: tip
In this case, we assume that you are running Refly and Ollama on the same host. If you are running Ollama on a remote machine, you need to replace host.docker.internal with the IP address of the remote machine.
:::
Next, let's download the example SQL file for Ollama:
wget https://raw.githubusercontent.com/refly-ai/refly/main/deploy/model-providers/ollama.sqlAdjust the SQL file to reflect the models you have downloaded. Then, execute the SQL file against the refly_db container:
cat ollama.sql | docker exec -i refly_db psql -U refly -d reflyRestart Refly
Now you can restart Refly by running the following command:
docker compose -f deploy/docker/docker-compose.yml up -dFile: en/guide/chrome-extension.md
Refly AI Chrome Extension Guide
The Refly Chrome extension is a powerful personal content management tool that helps you easily collect, organize, and save valuable content from any webpage to your knowledge base. Whether it's article paragraphs, important notes, or complete webpages, you can save them with one click and build your second brain.
Installation
- Visit the Chrome Web Store
- Click the "Add to Chrome" button
- Confirm the installation when prompted
Features
1. Webpage Content Saving Modes
1.1 Text Selection Saving
- Find the Refly floating ball on the right side of the webpage
- Enable selection mode to choose content you want to save
- After selection, choose to save or clip to your knowledge base
- Support multiple selections and cumulative saving
1.2 One-Click Page Saving
- Save the entire webpage content through the right-side floating ball
- Automatically extract main content, filtering out ads and irrelevant information
- Preserve original formatting and images
1.3 Popup Window Operations
- Click the Refly icon in the browser's top-right corner
- View and edit content to be saved in the popup window
- Support content preview and quick editing
1.4 Clipboard Enhancement
- Support copying any content to clipboard
- Paste and supplement content in the popup window
- Support rich text format saving
2. Knowledge Base Integration
Content Processing Flow
- Clipped content is automatically saved to your knowledge base
- Support converting saved content into document format
- Edit, organize, and tag saved content
- Support selecting partial content for note creation or AI queries
Supported Platforms
Refly supports content saving from various popular platforms, including:
Social Media
Academic Research
Tech Communities
Productivity Tools
Others
These are just some of the main platforms. Refly supports saving content from any webpage, allowing you to save whatever interests you.
Best Practices
- Selective Saving: Only save content that's valuable to you, avoid information overload
- Timely Organization: Regularly organize saved content to build your knowledge system
- Privacy Protection: Your data is securely encrypted and stored
- Regular Review: Periodically review and organize your saved content
Troubleshooting
If you encounter any issues:
- Ensure the extension is up to date
- Check browser compatibility
- Clear browser cache
- Restart the browser
- Contact support team if problems persist
Getting Help
If you need assistance:
- Visit our Community page
- Check the Changelog for latest updates
- Join our Discord community for real-time support
- Contact our support team for technical issues
File: en/guide/configuration.md
Configuration
API Server {#api-server}
The following are the detailed configurations for the API server. You can inject these environment variables into the refly_api container.
General Config
| Env | Description | Default Value |
|---|---|---|
| NODE_ENV | Node environment | development |
| PORT | HTTP API service port, used for regular API requests | 5800 |
| WS_PORT | WebSocket server port, used for real-time synchronization for canvases and documents | 5801 |
| ORIGIN | Client origin (where you are accessing the Refly application from), used for CORS check | http://localhost:5700 |
| STATIC_PUBLIC_ENDPOINT | Public static file endpoint (which can be accessed without authentication) | http://localhost:5800/v1/misc |
| STATIC_PRIVATE_ENDPOINT | Private static file endpoint (which must be accessed with authentication) | http://localhost:5800/v1/misc |
Credentials
| Env | Description | Default Value |
|---|---|---|
| OPENAI_API_KEY | API key for OpenAI (or any other compatible provider), used for LLM inference and embeddings | (not set) |
| OPENAI_BASE_URL | Base URL for OpenAI compatible provider | (not set) |
| OPENROUTER_API_KEY | OpenRouter API key, used for LLM inference | (not set) |
| JINA_API_KEY | Jina API key, used for embeddings and weblink parsing | (not set) |
| FIREWORKS_API_KEY | Fireworks API key, used for embedding | (not set) |
| SERPER_API_KEY | Serper API key, used for online search | (not set) |
| MARKER_API_KEY | Marker API key, used for PDF parsing | (not set) |
Middlewares
Refly depends on following middlewares to function properly:
- Postgres: used for basic data persistence
- Redis: used for cache, asynchronous task queue and coordination within distributed environment
- Qdrant: used for semantic searching via embeddings
- Elasticsearch: used for full-text searching within workspace
- MinIO: used for object storage for canvas, document and resource data
Postgres
| Env | Description | Default Value |
|---|---|---|
| DATABASE_URL | PostgreSQL connection URL | postgresql://refly:test@localhost:5432/refly?schema=refly |
::: info
Refer to Prisma doc for detailed definition of connection URL.
:::
Redis
| Env | Description | Default Value |
|---|---|---|
| REDIS_HOST | Redis host | localhost |
| REDIS_PORT | Redis port | 6379 |
| REDIS_PASSWORD | Redis password | test |
Qdrant (Vector Store)
| Env | Description | Default Value |
|---|---|---|
| QDRANT_HOST | Qdrant host | localhost |
| QDRANT_PORT | Qdrant port | 6333 |
| QDRANT_API_KEY | Qdrant API key | (not set) |
| REFLY_VEC_DIM | Vector dimension size | 768 |
Elasticsearch
| Env | Description | Default Value |
|---|---|---|
| ELASTICSEARCH_URL | Elasticsearch URL | http://localhost:9200 |
| ELASTICSEARCH_USERNAME | Elasticsearch username | (not set) |
| ELASTICSEARCH_PASSWORD | Elasticsearch username | (not set) |
MinIO
Refly requires two MinIO instances:
- Internal: used for storing canvas, resource, and document data, typically with visibility set to private.
- External: used for storing uploaded files, typically with visibility set to public.
| Env | Description | Default Value |
|---|---|---|
| MINIO_INTERNAL_ENDPOINT | MinIO host used for internal data | localhost |
| MINIO_INTERNAL_PORT | MinIO port used for internal data | 9000 |
| MINIO_INTERNAL_USE_SSL | Whether to use HTTPS for transport | false |
| MINIO_INTERNAL_ACCESS_KEY | Access key for internal MinIO | minioadmin |
| MINIO_INTERNAL_SECRET_KEY | Secret key for MinIO | minioadmin |
| MINIO_INTERNAL_BUCKET | Bucket name for internal | refly-weblink |
| MINIO_EXTERNAL_ENDPOINT | MinIO host used for internal data | localhost |
| MINIO_EXTERNAL_PORT | MinIO port used for internal data | 9000 |
| MINIO_EXTERNAL_USE_SSL | Whether to use HTTPS for transport | false |
| MINIO_EXTERNAL_ACCESS_KEY | Access key for internal MinIO | minioadmin |
| MINIO_EXTERNAL_SECRET_KEY | Secret key for MinIO | minioadmin |
| MINIO_EXTERNAL_BUCKET | Bucket name for internal | refly-weblink |
Authentication Configuration
| Env | Description | Default Value |
|---|---|---|
| AUTH_SKIP_VERIFICATION | Whether to skip email verification | false |
| REFLY_COOKIE_DOMAIN | Cookie domain used for signing authentication tokens | localhost |
| LOGIN_REDIRECT_URL | URL to redirect after OAuth login | (not set) |
| JWT_SECRET | JWT signing secret | test |
| JWT_EXPIRATION_TIME | JWT access token expiration time | 1h |
| JWT_REFRESH_EXPIRATION_TIME | JWT refresh token expiration time | 7d |
| COLLAB_TOKEN_EXPIRY | Collaboration token expiration time | 1h |
::: info
The time format is compatible with Vercel MS.
:::
Email Authentication
| Env | Description | Default Value |
|---|---|---|
| EMAIL_AUTH_ENABLED | Whether to enable email authentication | true |
| EMAIL_SENDER | Email sender | Refly <[email protected]> |
| RESEND_API_KEY | Resend API key, used for sending emails | re_123 |
::: warning
The default RESEND_API_KEY is invalid (just a placeholder). Please set your own API key if needed.
:::
GitHub Authentication
| Env | Description | Default Value |
|---|---|---|
| GITHUB_AUTH_ENABLED | Whether to enable GitHub authentication | false |
| GITHUB_CLIENT_ID | GitHub OAuth client ID | test |
| GITHUB_CLIENT_SECRET | GitHub OAuth client secret | test |
| GITHUB_CALLBACK_URL | GitHub OAuth callback URL | test |
::: warning
The default OAuth credentials are invalid (just a placeholder). Please set your own GitHub OAuth credentials if needed.
:::
::: info
You can learn more about GitHub OAuth at GitHub Developer.
:::
Google Authentication
| Env | Description | Default Value |
|---|---|---|
| GOOGLE_AUTH_ENABLED | Whether to enable Google authentication | false |
| GOOGLE_CLIENT_ID | Google OAuth client ID | test |
| GOOGLE_CLIENT_SECRET | Google OAuth client secret | test |
| GOOGLE_CALLBACK_URL | Google OAuth callback URL | test |
::: warning
The default OAuth credentials are invalid (just a placeholder). Please set your own Google OAuth credentials if needed.
:::
::: info
You can learn more about Google OAuth at Google Developer.
:::
Parser Configuration
| Env | Description | Default Value |
|---|---|---|
| PARSER_PDF | Parser for PDF files (available options: pdfjs, marker) |
pdfjs |
::: info
If you want to use marker as the parser for PDF files, you need to set the MARKER_API_KEY environment variable.
:::
Embeddings Configuration
| Env | Description | Default Value |
|---|---|---|
| EMBEDDINGS_PROVIDER | Embeddings provider (either jina, fireworks or openai) |
jina |
| EMBEDDINGS_MODEL_NAME | Embeddings model name | jina-embeddings-v3 |
| EMBEDDINGS_DIMENSIONS | Embedding vector dimensions | 768 |
| EMBEDDINGS_BATCH_SIZE | Batch size for embedding processing | 512 |
::: info
The default EMBEDDINGS_PROVIDER is jina. If you want to use other embeddings providers, please set the corresponding environment variables.
:::
::: warningEMBEDDINGS_DIMENSIONS must be set to the same value as REFLY_VEC_DIM in Qdrant.
:::
Reranker
| Env | Description | Default Value |
|---|---|---|
| RERANKER_TOP_N | Number of top results to rerank | 10 |
| RERANKER_MODEL | Reranker model name | jina-reranker-v2-base-multilingual |
| RERANKER_RELEVANCE_THRESHOLD | Relevance threshold for reranking | 0.5 |
::: warning
Currently, only Jina rerankers are supported. You need to set the JINA_API_KEY environment variable.
:::
Skill Execution
| Env | Description | Default Value |
|---|---|---|
| SKILL_IDLE_TIMEOUT | Skill idle timeout in milliseconds | 60000 |
| SKILL_EXECUTION_TIMEOUT | Skill execution timeout in milliseconds | 180000 |
Stripe
| Env | Description | Default Value |
|---|---|---|
| STRIPE_API_KEY | Stripe API key | (not set) |
| STRIPE_ACCOUNT_WEBHOOK_SECRET | Stripe account webhook secret | test |
| STRIPE_ACCOUNT_TEST_WEBHOOK_SECRET | Stripe test account webhook secret | test |
| STRIPE_SESSION_SUCCESS_URL | Stripe success redirect URL | (not set) |
| STRIPE_SESSION_CANCEL_URL | Stripe cancellation redirect URL | (not set) |
| STRIPE_PORTAL_RETURN_URL | Stripe customer portal return URL | (not set) |
Quota
Request Quota
| Env | Description | Default Value |
|---|---|---|
| QUOTA_T1_REQUEST | Tier 1 request quota | -1 |
| QUOTA_T2_REQUEST | Tier 2 request quota | -1 |
Storage Quota
| Env | Description | Default Value |
|---|---|---|
| QUOTA_STORAGE_FILE | File storage quota | -1 |
| QUOTA_STORAGE_OBJECT | Object storage quota | -1 |
| QUOTA_STORAGE_VECTOR | Vector storage quota | -1 |
Web Frontend {#web-frontend}
The following are the detailed configurations for the web frontend. You can inject these environment variables into the refly_web container.
General Config
| Env | Description | Default Value |
|---|---|---|
| REFLY_API_URL | Refly API server URL | http://localhost:5800 |
| COLLAB_URL | Collaboration endpoint URL | http://localhost:5801 |
| SUBSCRIPTION_ENABLED | Whether to enable subscription and billing features | (not set) |
Model Configuration {#model-configuration}
LLMs are configured via the refly.model_infos table within the refly_db PostgreSQL database. You can adjust the models as needed via the SQL client.
Here is a list of explanations for the columns:
name: The name (ID) of the model, which should be theidvalue returned from${OPENAI_BASE_URL}/v1/modelslabel: The label of the model, which will be displayed in the model selectorprovider: The provider of the model, used to display model icon (currently supportopenai,anthropic,deepseek,google,qwen,mistralandmeta-llama)tier: The tier of the model, currently supportt1(premium),t2(standard) andfreeenabled: Whether the model is enabledis_default: Whether the model is the default modelcontext_limit: The context limit of the model (number of tokens)max_output: The max output length of the model (number of tokens)capabilities: The capabilities of the model (JSON string), with the following keys:vision: Whether the model supports vision (taking images as input)
File: en/guide/crash-course.md
Crash Course
Let's understand how Refly works at its core through a user story, such as creating an article about the newly released "OpenAI Sora".
Register/Login
First, visit https://refly.ai/, and complete account registration or login by logging in and authorizing via email, Google, or GitHub.
Organizing Creative Ideas with Free Canvas
After entering the Refly app, you can generate various questions about Sora-related technologies on Refly's free canvas, then understand the implementation principles of each part. Once you have a basic understanding of Sora's technology and product, you can continue to ask follow-up questions based on certain node topics, dive deeper, and understand more advanced concepts step by step.
What's more amazing is that each step represents your free-flowing questioning and thinking process, and these processes don't interfere with each other unless you manually ask questions based on a certain node or add it to the context ("Add to Context/Follow-up" floating on each node). This provides you with the ability to ask in-depth questions based on a specific topic or think freely based on multiple topics, which is very flexible!
Using Built-in AI Search or Uploading Writing Materials
Once you have a general understanding of Sora's principles and derived technologies, you can start preparing your creation materials! Click the floating button on the left side of Refly, select the second button "Add Resource", and you can add interesting materials to the free canvas through online search, copying webpage links, or plain text for later research.
Each added material is automatically processed with AI semantics, allowing you to use the "Knowledge Base Search" skill to semantically search and question all resources - it's like having an AI search engine like Perplexity powered by both web content and your private domain knowledge!
Multi-threaded Conversations for Creative Research
After importing your writing materials, you can ask AI questions based on the materials, such as summarizing, translating, or generating tables for certain materials. Use the first button "Selection Mode" on the left of the canvas or the "Add to Context/Follow-up" button floating on each node to select multiple materials for summarization, translation, or ask any questions you want!
Of course, throughout the research process, Refly also provides many useful skills such as "Web Search" and "Knowledge Base Search" that can be called with one click to perform intelligent semantic search on all related content across the web or all materials you've already saved - don't miss any detail!
Using AI Editor for Writing
Finally, we come to the most exciting part! You can quickly generate a document using the "Generate Document" skill or create a new document using the "New Document" in the sidebar. Most usefully, during the document generation process, you can select any materials from the canvas (just click the "Add to Context/Follow-up" button floating on each node), combine materials with questions to generate documents, making your document content specifically tailored to your writing goals!
Of course, you can also independently complete each AI question or in-depth exploration based on topics, then use the "Insert" button on the answer node to insert useful content into your article with one click, step by step generating a usable document with AI assistance!
At this point, you might ask, if each step is generated by AI, won't the overall result be messy? Don't worry! Refly's document editor comes with rich text operation capabilities, allowing you to quickly format using the provided rich text tools. Of course, it also supports selecting content with one click to let AI format or edit for you - how thoughtful is that! 😆
That's it! Through the steps above, you've mastered the secret to using Refly AI to help you efficiently complete the journey from creative ideas to high-quality content! Now it's time for you to explore freely ~ Good luck 🍀
FAQ
Issue Reporting
Currently, Refly is fully open and in its early access phase, so you might encounter some usability issues, but we'll fix them right away! If you encounter any errors or other issues, you can copy the troubleshooting code and throw it in our face immediately! We'll follow up with fixes right away! For example, the error below, and traceID is the error code.
Landing Page Error
This situation occurs because Refly's overall login authorization system has changed. Users who previously participated in the beta test and were already logged in will encounter this - just click "Get Started" to log in normally.
Get Help & Join Feedback Group
You can visit the Contact Us link to join our community, and we'll answer your questions ASAP.
File: en/guide/introduction.md
Introduction
Welcome to our documentation! This guide will help you understand our project and how to make the most of it.
What is This Project?
This project aims to provide comprehensive documentation with multi-language support.
Key Features
- Multi-language support (English and Chinese)
- Clear navigation structure
- Comprehensive guides
- Easy to extend
File: en/guide/use-gitpod-deploy.md
Gitpod Deployment
Visit https://github.com/refly-ai/refly and click on the Open in Gitpod icon.
If it's your first time, you'll need to log in to Gitpod with your GitHub account, which will show the following interface.
If you've forked the project and want to save your modifications, it's recommended to click the dropdown next to refly and change it to your project address.
Click Continue.
Choose your preferred theme. The TERMINAL output below will show deployment logs. The deployment configuration is in the .gitpod.yml file.
tasks:
- name: Deploy Services
init: cd deploy/docker && cp ../../apps/api/.env.example .env && docker compose up -dThe deployment process takes a few minutes.
Deployment successful!
You'll notice that Gitpod actually provides a virtual machine that already supports Docker Compose deployment. Since Refly itself supports Docker Compose deployment, it seamlessly migrates to Gitpod.
Customized Deployment
1. Environment Variables Explanation:
- LLM Inference Related Environment Variables:
OPENAI_API_KEY: Your OpenAI API keyOPENAI_BASE_URL: Root URL for other OpenAI-compatible providersOPENROUTER_API_KEY: Your OpenRouter API key (if provided, will override the official OpenAI endpoint)
- Vector Embedding Related Environment Variables:
EMBEDDINGS_PROVIDER: Vector embedding provider, currently supportingopenai,jina, andfireworks. Default isjina, which can be modified according to actual needs.EMBEDDINGS_MODEL_NAME: Vector embedding model name, may vary by providerOPENAI_API_KEY: Required ifEMBEDDINGS_PROVIDERisopenaiJINA_API_KEY: Required ifEMBEDDINGS_PROVIDERisjinaFIREWORKS_API_KEY: Required ifEMBEDDINGS_PROVIDERisfireworks
- Web Search Related Environment Variables:
SERPER_API_KEY: Serper API key
::: info
A complete list of all configuration options can be found in the Configuration Guide.
:::
After modifying the .env file, a restart is required.
cd deploy/docker
docker compose restart2. Initialize Models {#initialize-models}
Model configuration is managed through the refly.model_infos table in the refly_db PostgreSQL database. We have prepared recommended model SQL files for some common providers:
| Provider | OPENAI_BASE_URL |
SQL File |
|---|---|---|
| OpenAI | (empty) | openai.sql |
| OpenRouter | https://openrouter.ai/api/v1 |
openrouter.sql |
| DeepSeek | https://api.deepseek.com |
deepseek.sql |
| Ollama | http://host.docker.internal:11434/v1 |
ollama.sql |
Choose a provider and execute its SQL file:
Initialize recommended OpenAI models:
curl https://raw.githubusercontent.com/refly-ai/refly/main/deploy/model-providers/openai.sql | docker exec -i refly_db psql -U refly -d reflyOr, initialize recommended OpenRouter models:
curl https://raw.githubusercontent.com/refly-ai/refly/main/deploy/model-providers/openrouter.sql | docker exec -i refly_db psql -U refly -d reflyOr, initialize recommended DeepSeek models:
curl https://raw.githubusercontent.com/refly-ai/refly/main/deploy/model-providers/deepseek.sql | docker exec -i refly_db psql -U refly -d refly::: warning
Refly currently only supports one model provider. If you decide to switch to another provider or encounter the error duplicate key value violates unique constraint "model_infos_name_key", you need to first clear the refly.model_infos table:
docker exec -it refly_db psql -U refly -d refly -c "TRUNCATE TABLE refly.model_infos;"After clicking Ask AI, you can see your initialized models.
:::
::: info
For detailed model configuration instructions, please refer to the Configuration Guide.
:::
Upgrade Guide
docker compose pull
docker compose down
docker compose up -d --remove-orphansTroubleshooting
Gitpod init failure
Execute manually in the terminal:
cd deploy/docker
cp ../../apps/api/.env.example .env
docker compose up -dChecking container status
Run docker ps, each container's expected status should be Up and healthy. Here's an example output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f2d71a5494b3 reflyai/refly-api:nightly "docker-entrypoint.s…" 13 minutes ago Up 12 minutes (healthy) 3000/tcp, 0.0.0.0:5800-5801->5800-5801/tcp refly_api
1d339d1ba317 reflyai/refly-web:nightly "/docker-entrypoint.…" 13 minutes ago Up 12 minutes (healthy) 0.0.0.0:5700->80/tcp refly_web
6ebfe46441c3 postgres:16-alpine "docker-entrypoint.s…" 13 minutes ago Up 13 minutes (healthy) 0.0.0.0:5435->5432/tcp refly_db
563bcdcf1ff8 reflyai/qdrant:v1.13.1 "./entrypoint.sh" 13 minutes ago Up 13 minutes (healthy) 0.0.0.0:6333-6334->6333-6334/tcp refly_qdrant
47a3d82c8f16 reflyai/elasticsearch:7.10.2 "/tini -- /usr/local…" 13 minutes ago Up 13 minutes (healthy) 9300/tcp, 0.0.0.0:9210->9200/tcp refly_elasticsearch
ca56521eebd6 redis/redis-stack:latest "/entrypoint.sh" 13 minutes ago Up 13 minutes (healthy) 0.0.0.0:8001->8001/tcp, 0.0.0.0:6381->6379/tcp refly_redis
4b0b9d2100d0 minio/minio:RELEASE.2025-01-20T14-49-07Z "/usr/bin/docker-ent…" 13 minutes ago Up 13 minutes (healthy) 0.0.0.0:9002->9000/tcp, 0.0.0.0:9003->9001/tcp refly_minioOr run docker stats, press Ctrl + C to exit:
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f2d71a5494b3 refly_api 0.04% 160.9MiB / 62.79GiB 0.25% 1.5MB / 3.37MB 3.5MB / 229kB 32
1d339d1ba317 refly_web 0.00% 13.49MiB / 62.79GiB 0.02% 301kB / 3.41MB 8.19kB / 8.19kB 17
6ebfe46441c3 refly_db 0.00% 37.39MiB / 62.79GiB 0.06% 47.5kB / 14.4kB 0B / 113MB 7
563bcdcf1ff8 refly_qdrant 0.20% 82.04MiB / 62.79GiB 0.13% 9.04kB / 4.61kB 0B / 4.91MB 75
47a3d82c8f16 refly_elasticsearch 0.17% 1.416GiB / 62.79GiB 2.26% 115kB / 112kB 0B / 7.63MB 80
ca56521eebd6 refly_redis 0.26% 133.8MiB / 62.79GiB 0.21% 3.55MB / 1.38MB 7.49MB / 2.65MB 21
4b0b9d2100d0 refly_minio 0.06% 91.88MiB / 62.79GiB 0.14% 14.1kB / 7.32kB 0B / 3.56MB 21To view logs, run docker compose logs -f, press Ctrl + C to exit.
Run docker ps --filter name=refly_ | grep -v 'healthy' to identify unhealthy containers (those not in healthy status).
To view logs for specific services, for example api, run docker compose logs api -f. Note that the service names are determined by the docker compose file, not the Docker container names.
File: en/guide/video-tutorials.md
Video Tutorials
Welcome to our collection of Refly video tutorials. These videos will help you get the most out of the Refly platform with visual step-by-step instructions.
🚂 Refly: AI Native Creation Platform - An open-source project based on LangGraph!
🚂 Refly Web Clipping Extension - Help build DeepSeek RAG pipelines!
🚂 Refly 0.3 Release - Knowledge base improvements! File and image uploads + multimodal Q&A!
🚂 Refly 0.4 Major Upgrade - Shareable, readable webpages, customizable prompts, and more!
🚂 Refly Artifact - From questions to artifacts, from artifacts to everything!
🚂 Refly 0.4.1 Update - Generated pages quality challenge!
🚂 Refly 0.4.2 Update - Canvas templates and improved sharing capabilities!
🚂 Refly Application Templates - AI-generated modern knowledge cards!
🚂 Refly Self-Deployment Guide - Ollama integration version!
🚂 Refly Application Templates - AI-generated social media covers
🧜 Mermaid.js Syntax Overview | Complete guide to all 22 charts in version 11.6 (Part 1)
🧜 Mermaid.js Syntax Overview | Complete guide to all 22 charts in version 11.6 (Part 2)
🚂 Skill Unlock! From Refly Mind Maps to Rapid Document Creation 🔮
🎮 Fun Game Programming Challenge! Claude 🆚 Gemini 🆚 DeepSeek
🚂 Technical Course Template - Using Various Components to Create Training Materials
File: zh/guide/self-deploy/index.md
私有部署
前置要求 {#prerequisites}
要自行部署 Refly,您需要安装以下软件:
- Docker (版本 20.10.0 或更高)
- 可选: PostgreSQL 客户端(可以是
psql或基于 GUI 的工具),用于管理可用的 LLM 模型
::: info
我们计划在未来提供功能完善的原生应用程序,以隐私为重点提供无缝的安装体验。敬请期待!
:::
部署步骤 {#steps}
1. 克隆代码仓库 {#clone-the-repository}
git clone https://github.com/refly-ai/refly.git::: tip
如果您只需要使用 Docker 部署,可以在 clone 命令中添加 --depth 1 参数来节省磁盘空间和下载时间。
:::
2. 准备环境配置 {#prepare-the-environment-configuration}
cd refly/deploy/docker
cp ../../apps/api/.env.example .env环境变量说明:
- LLM 推理相关环境变量:
OPENAI_API_KEY:您的 OpenAI API 密钥OPENAI_BASE_URL: 其他 OpenAI 兼容提供商的根 URLOPENROUTER_API_KEY:您的 OpenRouter API 密钥(如果提供,将覆盖官方 OpenAI 端点)
- 向量嵌入相关环境变量:
EMBEDDINGS_PROVIDER:向量嵌入提供商,目前支持openai、jina和fireworksEMBEDDINGS_MODEL_NAME:向量嵌入模型名称,不同提供商可能不同OPENAI_API_KEY:如果EMBEDDINGS_PROVIDER为openai则必需JINA_API_KEY:如果EMBEDDINGS_PROVIDER为jina则必需FIREWORKS_API_KEY:如果EMBEDDINGS_PROVIDER为fireworks则必需
- 网络搜索相关环境变量:
SERPER_API_KEY:Serper API 密钥
::: info
所有配置选项的完整列表可以在配置指南中找到。
:::
3. 通过 docker compose 启动应用 {#start-the-application-via-docker-compose}
docker compose up -d::: tip 对于热情的用户
默认情况下,docker compose 文件会拉取 latest 镜像,这是最新的稳定版本。如果您想使用与 Refly Cloud 同步的最新开发版本,可以在 docker-compose.yml 文件中将镜像标签 latest 替换为 nightly。
:::
您可以运行 docker ps 来检查容器的状态。每个容器的预期状态应该是 Up 和 healthy。以下是示例输出:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
71681217973e reflyai/refly-api:latest "docker-entrypoint.s…" 5 hours ago Up 5 hours (healthy) 3000/tcp, 0.0.0.0:5800-5801->5800-5801/tcp, :::5800-5801->5800-5801/tcp refly_api
462d7e1181ca reflyai/qdrant:v1.13.1 "./entrypoint.sh" 5 hours ago Up 5 hours (healthy) 0.0.0.0:6333-6334->6333-6334/tcp, :::6333-6334->6333-6334/tcp refly_qdrant
fd287fa0a04e redis/redis-stack:6.2.6-v18 "/entrypoint.sh" 5 hours ago Up 5 hours (healthy) 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp, 0.0.0.0:8001->8001/tcp, :::8001->8001/tcp refly_redis
16321d38fc34 reflyai/refly-web:latest "/docker-entrypoint.…" 5 hours ago Up 5 hours 0.0.0.0:5700->80/tcp, [::]:5700->80/tcp refly_web
2e14ec2e55a2 reflyai/elasticsearch:7.10.2 "/tini -- /usr/local…" 5 hours ago Up 5 hours (healthy) 0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 9300/tcp refly_elasticsearch
a13f349fe35b minio/minio:RELEASE.2025-01-20T14-49-07Z "/usr/bin/docker-ent…" 5 hours ago Up 5 hours (healthy) 0.0.0.0:9000-9001->9000-9001/tcp, :::9000-9001->9000-9001/tcp refly_minio
e7b398dbd02b postgres:16-alpine "docker-entrypoint.s…" 5 hours ago Up 5 hours (healthy) 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp refly_db最后,您可以通过访问 http://${HOST_IP}:5700 来使用 Refly 应用程序,其中 ${HOST_IP} 是主机的 IP 地址。
::: info
如果无法访问 Refly 应用,请检查以下内容:
HOST_IP是否正确。- 应用是否正常运行。如果未运行,请跳转到故障排除部分。
- 端口
5700是否被任何应用程序防火墙阻止。如果您使用的是云服务器,请特别注意这一点。
:::
4. 初始化模型 {#initialize-models}
模型配置通过 refly_db PostgreSQL 数据库中的 refly.model_infos 表进行管理。我们为一些常见的提供商准备了推荐的模型 SQL 文件:
| 提供商 | OPENAI_BASE_URL |
SQL 文件 |
|---|---|---|
| OpenAI | (空) | openai.sql |
| OpenRouter | https://openrouter.ai/api/v1 |
openrouter.sql |
| DeepSeek | https://api.deepseek.com |
deepseek.sql |
| Ollama | http://host.docker.internal:11434/v1 |
ollama.sql |
选择一个提供商并执行其 SQL 文件:
# 初始化推荐的 OpenAI 模型
curl https://raw.githubusercontent.com/refly-ai/refly/main/deploy/model-providers/openai.sql | docker exec -i refly_db psql -U refly -d refly# 或者,初始化推荐的 OpenRouter 模型
curl https://raw.githubusercontent.com/refly-ai/refly/main/deploy/model-providers/openrouter.sql | docker exec -i refly_db psql -U refly -d refly# 或者,初始化推荐的 DeepSeek 模型
curl https://raw.githubusercontent.com/refly-ai/refly/main/deploy/model-providers/deepseek.sql | docker exec -i refly_db psql -U refly -d refly::: warning
Refly 目前仅支持一个模型提供商。如果决定切换到另一个提供商或遇到错误 duplicate key value violates unique constraint "model_infos_name_key",您需要先清空 refly.model_infos 表:
docker exec -it refly_db psql -U refly -d refly -c "TRUNCATE TABLE refly.model_infos;":::
::: info
有关模型配置的详细说明,请参阅配置指南。
:::
升级指南 {#upgrade-guide}
要升级到最新稳定版本,您可以拉取最新镜像并重启容器:
docker compose pull
docker compose down
docker compose up -d --remove-orphans如果遇到任何问题,请参阅故障排除部分。
故障排除 {#troubleshooting}
如果应用程序无法正常运行,您可以尝试以下步骤:
- 运行
docker ps --filter name=refly_ | grep -v 'healthy'来识别 不健康 的容器(状态不处于healthy)。 - 运行
docker logs <container_id>来获取更多关于不健康容器的错误信息。 - 如果不健康的容器是
refly_api,您可以首先尝试运行docker restart refly_api来重启容器。 - 对于其他容器,您可以在容器日志中搜索错误消息的原因。
如果问题仍然存在,您可以在我们的 GitHub 仓库提出问题,或在我们的 Discord 服务器中联系我们。
File: zh/guide/self-deploy/ollama.md
Ollama
本指南将指导您在自己的机器上使用 Refly 和 Ollama。
安装 Refly
我们假设您已经按照自部署指南安装了 Refly。如果您还没有配置环境变量和模型,也没有关系。
安装 Ollama
前往 Ollama 主页并点击"Download"按钮。
下载并运行安装程序后,您可以通过运行以下命令来验证 Ollama 是否正常工作:
ollama -v下载模型
Refly 需要嵌入模型和大语言模型。您可以通过运行以下命令来下载模型:
# 下载您喜欢的嵌入模型
ollama pull nomic-embed-text
# 下载您喜欢的大语言模型
ollama pull deepseek-r1:7b
ollama pull deepseek-r1:14b
ollama pull llama3.3:70b::: tip
您可以在 Ollama Models 上找到更多可供选择的模型。
:::
通过运行以下命令验证模型是否成功下载:
ollama list确保 Ollama 服务器正在正常运行:
curl http://localhost:11434如果返回消息 Ollama is running,则说明一切正常。否则,请运行 ollama serve 来启动服务器。
配置 Refly
要将 Ollama 与 Refly 集成,您需要在 deploy/docker/.env 文件中配置以下环境变量:
# Ollama 完全兼容 OpenAI API,所以这里我们将嵌入提供商设置为 openai
EMBEDDINGS_PROVIDER=openai
# 选择在 `ollama list` 中列出的嵌入模型
EMBEDDINGS_MODEL_NAME=nomic-embed-text
# 配置 Ollama 服务器的基础 URL
# 由于我们从容器中访问主机上的 Ollama,所以需要使用 `host.docker.internal`
OPENAI_BASE_URL=http://host.docker.internal:11434/v1
# API 密钥是必需的但不会被使用,所以我们只需设置一个虚拟值
OPENAI_API_KEY=ollama同时需要在之前的apps\api\.env文件中配置
# 配置 Ollama 服务器的基础 URL
# 由于我们从容器中访问主机上的 Ollama,所以需要使用 `host.docker.internal`
OPENAI_BASE_URL=http://host.docker.internal:11434/v1
# API 密钥是必需的但不会被使用,所以我们只需设置一个虚拟值
OPENAI_API_KEY=ollama::: tip
在这种情况下,我们假设您在同一台主机上运行 Refly 和 Ollama。如果您在远程机器上运行 Ollama,则需要将 host.docker.internal 替换为远程机器的 IP 地址。
:::
接下来,让我们下载 Ollama 的示例 SQL 文件:
wget https://raw.githubusercontent.com/refly-ai/refly/main/deploy/model-providers/ollama.sql调整 SQL 文件以反映您已下载的模型。然后,对 refly_db 容器执行 SQL 文件:
cat ollama.sql | docker exec -i refly_db psql -U refly -d refly重启 Refly
现在您可以通过运行以下命令重启 Refly:
docker compose -f deploy/docker/docker-compose.yml up -dFile: zh/guide/chrome-extension.md
Refly AI Chrome 插件指南
Refly Chrome 插件是一个强大的个性化内容管理工具,帮助您轻松地从任何网页收集、整理和保存有价值的内容到您的知识库中。无论是文章段落、重要笔记还是完整网页,都可以一键保存并构建成您的第二大脑。
安装
- 访问 Chrome 网上应用店
- 点击"添加到 Chrome"按钮
- 在提示时确认安装
功能特性
1. 网页内容保存模式
1.1 划线选择保存
- 在网页右侧找到 Refly 悬浮球
- 开启划线模式,选择需要保存的内容
- 选中后可以选择保存或剪存到知识库
1.2 一键剪存整页
- 通过右侧悬浮球,一键保存整个网页内容
- 自动提取网页的主要内容,过滤广告等无关信息
- 保留原始格式和图片
1.3 弹出窗口操作
- 点击浏览器右上角的 Refly 图标
- 在弹出窗口中查看和编辑待保存的内容
- 支持内容预览和快速编辑
1.4 剪贴板增强
- 支持复制任意内容到剪贴板
- 在弹出窗口中粘贴并补充内容
- 支持富文本格式保存
2. 知识库集成
内容处理流程
- 剪存的内容会自动保存到您的知识库
- 支持将保存的内容转换为文档格式
- 可以对保存的内容进行编辑、组织
- 支持选择部分内容创建笔记或者提问 AI
支持的平台
Refly 支持多种常用平台的内容保存,包括:
社交媒体
学术研究
技术社区
生产力工具
其他
以上只是一些主要平台,Refly 支持保存任意网页内容,您可以随时保存您感兴趣的内容。
最佳实践
- 选择性保存:只保存对您有价值的内容,避免信息过载
- 及时整理:定期整理保存的内容,建立知识体系
- 隐私保护:您的数据会被安全加密存储
故障排除
如果遇到任何问题:
- 确保插件是最新版本
- 检查浏览器兼容性
- 清除浏览器缓存
- 重启浏览器
- 如果问题持续,请联系支持团队
获取帮助
如果您需要帮助:
File: zh/guide/configuration.md
配置说明
API 服务器
以下是 API 服务器的详细配置说明。你可以将这些环境变量注入到 refly_api 容器中。
基本配置
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| NODE_ENV | Node 运行环境 | development |
| PORT | HTTP API 服务端口,用于常规 API 请求 | 5800 |
| WS_PORT | WebSocket 服务器端口,用于画布和文档的实时同步 | 5801 |
| ORIGIN | 客户端来源(即访问 Refly 应用的地址),用于 CORS 检查 | http://localhost:5700 |
| STATIC_PUBLIC_ENDPOINT | 公开可访问的静态文件端点 (无需身份验证即可访问) | http://localhost:5800/v1/misc |
| STATIC_PRIVATE_ENDPOINT | 私有静态文件端点 (需要身份验证才能访问) | http://localhost:5800/v1/misc |
凭证配置
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| OPENAI_API_KEY | OpenAI 或其他兼容供应方的 API 密钥,用于 LLM 推理和嵌入 | (未设置) |
| OPENAI_BASE_URL | OpenAI 兼容供应方的基础 URL,用于 LLM 推理和嵌入 | (未设置) |
| OPENROUTER_API_KEY | OpenRouter API 密钥,用于 LLM 推理 | (未设置) |
| JINA_API_KEY | Jina API 密钥,用于嵌入和网页解析 | (未设置) |
| FIREWORKS_API_KEY | Fireworks API 密钥,用于嵌入 | (未设置) |
| SERPER_API_KEY | Serper API 密钥,用于在线搜索 | (未设置) |
| MARKER_API_KEY | Marker API 密钥,用于 PDF 解析 | (未设置) |
中间件
Refly 依赖以下中间件来正常运行:
- Postgres:用于基本数据持久化
- Redis:用于缓存、异步任务队列和分布式环境中的协调
- Qdrant:用于通过嵌入进行语义搜索
- Elasticsearch:用于工作区内的全文搜索
- MinIO:用于画布、文档和资源数据的对象存储
Postgres
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| DATABASE_URL | PostgreSQL 连接 URL | postgresql://refly:test@localhost:5432/refly?schema=refly |
::: info
参考 Prisma 文档 了解连接 URL 的详细定义。
:::
Redis
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| REDIS_HOST | Redis 主机地址 | localhost |
| REDIS_PORT | Redis 端口 | 6379 |
| REDIS_PASSWORD | Redis 密码 | test |
Qdrant (向量存储)
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| QDRANT_HOST | Qdrant 主机地址 | localhost |
| QDRANT_PORT | Qdrant 端口 | 6333 |
| QDRANT_API_KEY | Qdrant API 密钥 | (未设置) |
| REFLY_VEC_DIM | 向量维度大小 | 768 |
Elasticsearch
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| ELASTICSEARCH_URL | Elasticsearch URL | http://localhost:9200 |
| ELASTICSEARCH_USERNAME | Elasticsearch 用户名 | (未设置) |
| ELASTICSEARCH_PASSWORD | Elasticsearch 密码 | (未设置) |
MinIO
Refly 需要两个 MinIO 实例:
- 内部:用于存储画布、资源和文档数据,通常设置为私有可见性。
- 外部:用于存储上传的文件,通常设置为公开可见性。
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| MINIO_INTERNAL_ENDPOINT | 内部数据使用的 MinIO 主机 | localhost |
| MINIO_INTERNAL_PORT | 内部数据使用的 MinIO 端口 | 9000 |
| MINIO_INTERNAL_USE_SSL | 是否使用 HTTPS 传输 | false |
| MINIO_INTERNAL_ACCESS_KEY | 内部 MinIO 访问密钥 | minioadmin |
| MINIO_INTERNAL_SECRET_KEY | 内部 MinIO 密钥 | minioadmin |
| MINIO_INTERNAL_BUCKET | 内部存储桶名称 | refly-weblink |
| MINIO_EXTERNAL_ENDPOINT | 外部数据使用的 MinIO 主机 | localhost |
| MINIO_EXTERNAL_PORT | 外部数据使用的 MinIO 端口 | 9000 |
| MINIO_EXTERNAL_USE_SSL | 是否使用 HTTPS 传输 | false |
| MINIO_EXTERNAL_ACCESS_KEY | 外部 MinIO 访问密钥 | minioadmin |
| MINIO_EXTERNAL_SECRET_KEY | 外部 MinIO 密钥 | minioadmin |
| MINIO_EXTERNAL_BUCKET | 外部存储桶名称 | refly-weblink |
认证配置
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| AUTH_SKIP_VERIFICATION | 是否跳过邮箱验证 | false |
| REFLY_COOKIE_DOMAIN | 用于签署认证令牌的 Cookie 域名 | localhost |
| LOGIN_REDIRECT_URL | OAuth 登录后的重定向 URL | (未设置) |
| JWT_SECRET | JWT 签名密钥 | test |
| JWT_EXPIRATION_TIME | JWT 访问令牌过期时间 | 1h |
| JWT_REFRESH_EXPIRATION_TIME | JWT 刷新令牌过期时间 | 7d |
| COLLAB_TOKEN_EXPIRY | 协作令牌过期时间 | 1h |
::: info
时间格式与 Vercel MS 兼容。
:::
邮箱认证
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| EMAIL_AUTH_ENABLED | 是否启用邮箱认证 | true |
| EMAIL_SENDER | 邮件发送者 | Refly <[email protected]> |
| RESEND_API_KEY | Resend API 密钥,用于发送邮件 | re_123 |
::: warning
默认的 RESEND_API_KEY 是无效的(仅作为占位符)。如果需要,请设置你自己的 API 密钥。
:::
GitHub 认证
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| GITHUB_AUTH_ENABLED | 是否启用 GitHub 认证 | false |
| GITHUB_CLIENT_ID | GitHub OAuth 客户端 ID | test |
| GITHUB_CLIENT_SECRET | GitHub OAuth 客户端密钥 | test |
| GITHUB_CALLBACK_URL | GitHub OAuth 回调 URL | test |
::: warning
默认的 OAuth 凭证是无效的(仅作为占位符)。如果需要,请设置你自己的 GitHub OAuth 凭证。
:::
::: info
你可以在 GitHub Developer 了解更多关于 GitHub OAuth 的信息。
:::
Google 认证
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| GOOGLE_AUTH_ENABLED | 是否启用 Google 认证 | false |
| GOOGLE_CLIENT_ID | Google OAuth 客户端 ID | test |
| GOOGLE_CLIENT_SECRET | Google OAuth 客户端密钥 | test |
| GOOGLE_CALLBACK_URL | Google OAuth 回调 URL | test |
::: warning
默认的 OAuth 凭证是无效的(仅作为占位符)。如果需要,请设置你自己的 Google OAuth 凭证。
:::
::: info
你可以在 Google Developer 了解更多关于 Google OAuth 的信息。
:::
解析器配置
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| PARSER_PDF | PDF 文件解析器 (可选 pdfjs 或 marker) |
pdfjs |
::: info
如果想使用 marker 作为 PDF 文件的解析器,你需要设置 MARKER_API_KEY 环境变量。
:::
嵌入配置
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| EMBEDDINGS_PROVIDER | 嵌入提供者(可选 jina、fireworks 或 openai) |
jina |
| EMBEDDINGS_MODEL_NAME | 嵌入模型名称 | jina-embeddings-v3 |
| EMBEDDINGS_DIMENSIONS | 嵌入向量维度 | 768 |
| EMBEDDINGS_BATCH_SIZE | 嵌入处理批次大小 | 512 |
::: info
默认的 EMBEDDINGS_PROVIDER 是 jina。如果你想使用其他嵌入提供者,请设置相应的环境变量。
:::
::: warningEMBEDDINGS_DIMENSIONS 必须与 Qdrant 中的 REFLY_VEC_DIM 设置为相同的值。
:::
重排序器
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| RERANKER_TOP_N | 需要重排序的顶部结果数量 | 10 |
| RERANKER_MODEL | 重排序模型名称 | jina-reranker-v2-base-multilingual |
| RERANKER_RELEVANCE_THRESHOLD | 重排序相关性阈值 | 0.5 |
::: warning
目前仅支持 Jina 重排序器。你需要设置 JINA_API_KEY 环境变量。
:::
技能执行
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| SKILL_IDLE_TIMEOUT | 技能空闲超时时间(毫秒) | 60000 |
| SKILL_EXECUTION_TIMEOUT | 技能执行超时时间(毫秒) | 180000 |
Stripe
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| STRIPE_API_KEY | Stripe API 密钥 | (未设置) |
| STRIPE_ACCOUNT_WEBHOOK_SECRET | Stripe 账户 webhook 密钥 | test |
| STRIPE_ACCOUNT_TEST_WEBHOOK_SECRET | Stripe 测试账户 webhook 密钥 | test |
| STRIPE_SESSION_SUCCESS_URL | Stripe 成功重定向 URL | (未设置) |
| STRIPE_SESSION_CANCEL_URL | Stripe 取消重定向 URL | (未设置) |
| STRIPE_PORTAL_RETURN_URL | Stripe 客户门户返回 URL | (未设置) |
配额
请求配额
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| QUOTA_T1_REQUEST | 一级请求配额 | -1 |
| QUOTA_T2_REQUEST | 二级请求配额 | -1 |
存储配额
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| QUOTA_STORAGE_FILE | 文件存储配额 | -1 |
| QUOTA_STORAGE_OBJECT | 对象存储配额 | -1 |
| QUOTA_STORAGE_VECTOR | 向量存储配额 | -1 |
Web 前端
以下是 Web 前端的详细配置说明。你可以将这些环境变量注入到 refly_web 容器中。
基本配置
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| REFLY_API_URL | Refly API 服务器 URL | http://localhost:5800 |
| COLLAB_URL | 协作端点 URL | http://localhost:5801 |
| SUBSCRIPTION_ENABLED | 是否启用订阅和计费功能 | (未设置) |
模型配置
大语言模型(LLM)配置通过 refly_db PostgreSQL 数据库中的 refly.model_infos 表进行管理。你可以通过 SQL 客户端按需调整模型。
以下是各列的说明:
name:模型的名称(ID),应为${OPENAI_BASE_URL}/v1/models返回的id值label:模型的标签,将在模型选择器中显示provider:模型的提供商,用于显示模型图标(目前支持openai、anthropic、deepseek、google、qwen、mistral和meta-llama)tier:模型的等级,目前支持t1(高级)、t2(标准)和freeenabled:是否启用模型is_default:是否为默认模型context_limit:模型的上下文限制(token 数量)max_output:模型的最大输出长度(token 数量)capabilities:模型的能力(JSON 字符串),具有以下键:vision:是否支持视觉输入(接受图片作为输入)