feat: Initial commit with full deployment architecture and scripts
This commit is contained in:
commit
abb3efe114
96 files changed
+16789
No files matched your search
@@ -0,0 +1,55 @@
|
||||
|
||||
from app import create_app, db
|
||||
from app.models import Agent
|
||||
import uuid
|
||||
|
||||
app = create_app()
|
||||
|
||||
with app.app_context():
|
||||
# 1. 方式一:嵌入到网站中 (Iframe)
|
||||
# <iframe src=" http://192.168.100.230:8882/chatbot/imrmbYyasJUHjXQg " style="width: 100%; height: 100%; min-height: 700px" frameborder="0" allow="microphone"> </iframe>
|
||||
|
||||
agent_iframe = Agent.query.filter_by(name='人事规章(网页版)').first()
|
||||
if not agent_iframe:
|
||||
agent_iframe = Agent(
|
||||
name='人事规章(网页版)',
|
||||
description='嵌入式人事规章助手',
|
||||
dify_app_id=str(uuid.uuid4()), # Placeholder unique ID
|
||||
dify_api_key='placeholder',
|
||||
type='iframe',
|
||||
extra_config={'iframe_url': 'http://192.168.100.230:8882/chatbot/imrmbYyasJUHjXQg'},
|
||||
icon_url='ri-article-line'
|
||||
)
|
||||
db.session.add(agent_iframe)
|
||||
print("Added Iframe Agent")
|
||||
else:
|
||||
agent_iframe.type = 'iframe'
|
||||
agent_iframe.extra_config = {'iframe_url': 'http://192.168.100.230:8882/chatbot/imrmbYyasJUHjXQg'}
|
||||
agent_iframe.icon_url = 'ri-article-line'
|
||||
print("Updated Iframe Agent")
|
||||
|
||||
# 2. 方式二:API
|
||||
# 基础URL: http://127.0.0.1:5001/v1
|
||||
# API密钥:app-xdiejQibWQy8ZQWXcdxJjS9I
|
||||
|
||||
agent_api = Agent.query.filter_by(name='人事规章(API版)').first()
|
||||
if not agent_api:
|
||||
agent_api = Agent(
|
||||
name='人事规章(API版)',
|
||||
description='API调用人事规章助手',
|
||||
dify_app_id=str(uuid.uuid4()), # Placeholder unique ID
|
||||
dify_api_key='app-xdiejQibWQy8ZQWXcdxJjS9I',
|
||||
type='api',
|
||||
api_base_url='http://127.0.0.1:5001/v1',
|
||||
icon_url='ri-robot-line'
|
||||
)
|
||||
db.session.add(agent_api)
|
||||
print("Added API Agent")
|
||||
else:
|
||||
agent_api.type = 'api'
|
||||
agent_api.dify_api_key = 'app-xdiejQibWQy8ZQWXcdxJjS9I'
|
||||
agent_api.api_base_url = 'http://127.0.0.1:5001/v1'
|
||||
agent_api.icon_url = 'ri-robot-line'
|
||||
print("Updated API Agent")
|
||||
|
||||
db.session.commit()
|
||||
Reference in new issue
Block a user