ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
|
||||
from browser_use.browser import BrowserProfile
|
||||
from browser_use.llm import ChatGoogle
|
||||
from examples.integrations.slack.slack_api import SlackBot, app
|
||||
|
||||
# load credentials from environment variables
|
||||
bot_token = os.getenv('SLACK_BOT_TOKEN')
|
||||
if not bot_token:
|
||||
raise ValueError('Slack bot token not found in .env file.')
|
||||
|
||||
signing_secret = os.getenv('SLACK_SIGNING_SECRET')
|
||||
if not signing_secret:
|
||||
raise ValueError('Slack signing secret not found in .env file.')
|
||||
|
||||
api_key = os.getenv('GOOGLE_API_KEY')
|
||||
if not api_key:
|
||||
raise ValueError('GOOGLE_API_KEY is not set')
|
||||
|
||||
llm = ChatGoogle(model='gemini-2.0-flash-exp', api_key=api_key)
|
||||
|
||||
slack_bot = SlackBot(
|
||||
llm=llm, # required; instance of BaseChatModel
|
||||
bot_token=bot_token, # required; Slack bot token
|
||||
signing_secret=signing_secret, # required; Slack signing secret
|
||||
ack=True, # optional; whether to acknowledge task receipt with a message, defaults to False
|
||||
browser_profile=BrowserProfile(
|
||||
headless=True
|
||||
), # optional; useful for changing headless mode or other browser configs, defaults to headless mode
|
||||
)
|
||||
|
||||
app.dependency_overrides[SlackBot] = lambda: slack_bot
|
||||
|
||||
if __name__ == '__main__':
|
||||
import uvicorn
|
||||
|
||||
uvicorn.run('integrations.slack.slack_api:app', host='0.0.0.0', port=3000)
|
||||
Reference in New Issue
Block a user