Warning
- 🚨 This is an unofficial project. LangGenius does not provide any support for this module.
- 🚨 It uses undocumented APIs of Dify, which means it may break with future updates to Dify.
- 🚨 The Enterprise Edition of Dify (multi-workspace environments) is not supported.
- 🚨 Currently, the focus is on "making it work." This means error handling and documentation are incomplete, and it does not strictly follow PowerShell best practices.
PSDify is a PowerShell module designed to enable workspace management for Dify from the command line.
Here are some examples of what you can do with PSDify:
- ✨ Export and import apps
- ✨ Create knowledge and upload files
- ✨ Manage members: retrieve, invite, remove, and change roles
- ✨ Add models and update system models
- ✨ Initialize instances for the Community Edition
For a full list of available cmdlets, refer to the 📚Documentation.
Version | Dify (Community) |
Dify (Cloud) |
---|---|---|
0.12.1 | ✅ PSDify 0.1.0 | ✅ PSDify 0.1.0 |
0.11.2 | ✅ PSDify 0.0.1 | ✅ PSDify 0.0.1 |
Note
This module has been tested with Windows PowerShell (PowerShell 5.1) and PowerShell 7.4. The Enterprise Edition of Dify (multi-workspace environments) is not supported.
For a full list of available cmdlets, refer to the 📚Documentation.
Install-Module -Name PSDify
# Authenticate with a password (for Community Edition)
Connect-Dify -AuthMethod "Password" -Server "https://dify.example.com" -Email "[email protected]"
# Authenticate with a code (for Cloud Edition)
Connect-Dify -AuthMethod "Code" -Server "https://dify.example.com" -Email "[email protected]"
# Retrieve apps
Get-DifyApp
# Export apps (as .\DSLs\*.yml)
Get-DifyApp | Export-DifyApp
# Import apps
Get-Item -Path "DSLs/*.yml" | Import-DifyApp
# Retrieve knowledge
Get-DifyKnowledge
# Create knowledge
New-DifyKnowledge -Name "My New Knowledge"
# Upload files to knowledge
$Knowledge = Get-DifyKnowledge -Name "My New Knowledge"
Get-Item -Path "Docs/*.md" | Add-DifyDocument -Knowledge $Knowledge
# Wait for indexing to complete after uploading
Get-Item -Path "Docs/*.md" | Add-DifyDocument -Knowledge $Knowledge -Wait
# Retrieve members
Get-DifyMember
# Invite a new member
New-DifyMember -Email "[email protected]" -Role "normal"
# Change a member's role
Get-DifyMember -Email "[email protected]" | Set-DifyMemberRole -Role "editor"
# Retrieve models
Get-DifyModel
# Add a predefined model
New-DifyModel -Provider "openai" -From "predefined" `
-Credential @{
"openai_api_key" = "sk-proj-****************"
}
# Add a customizable model
New-DifyModel -Provider "openai" -From "customizable" `
-Type "llm" -Name "gpt-4o-mini" `
-Credential @{
"openai_api_key" = "sk-proj-****************"
}
# Update the system model
Set-DifySystemModel -Type "llm" -Provider "openai" -Name "gpt-4o-mini"
Initialize-Dify -Server "https://dify.example.com" -Email "[email protected]" -Name "Dify"