前后端更新
This commit is contained in:
1 parent
a0c8721fbb
commit
24da604727
33 files changed
+1951
-580
No files matched your search
@@ -0,0 +1,30 @@
|
||||
from app import create_app, db
|
||||
from app.models import Agent, User
|
||||
|
||||
app = create_app('development')
|
||||
|
||||
with app.app_context():
|
||||
# 1. Fix Agent URL
|
||||
agent = Agent.query.get(2)
|
||||
if agent:
|
||||
print(f"Updating Agent {agent.name}...")
|
||||
# Remove trailing /chat-messages if present
|
||||
if '/chat-messages' in agent.api_base_url:
|
||||
new_url = agent.api_base_url.replace('/chat-messages', '')
|
||||
agent.api_base_url = new_url
|
||||
print(f"Updated URL to: {new_url}")
|
||||
|
||||
# Ensure Key is correct (it seemed correct but good to be sure)
|
||||
agent.dify_api_key = 'app-xdiejQibWQy8ZQWXcdxJjS9I'
|
||||
|
||||
# 2. Grant permissions to non-admin users
|
||||
users = User.query.filter(User.role != 'admin').all()
|
||||
for u in users:
|
||||
if agent not in u.agents:
|
||||
u.agents.append(agent)
|
||||
print(f"Granted permission to user: {u.username}")
|
||||
|
||||
db.session.commit()
|
||||
print("Done.")
|
||||
else:
|
||||
print("Agent 2 not found.")
|
||||
Reference in new issue
Block a user