AI_Agent first commit
This commit is contained in:
48
scripts/ai_agent/pnc/pnc.py
Normal file
48
scripts/ai_agent/pnc/pnc.py
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from atexit import register
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
|
||||
import asyncio
|
||||
from langchain.memory import ConversationBufferWindowMemory
|
||||
from langchain_mcp_adapters.client import MultiServerMCPClient
|
||||
from langgraph.prebuilt import create_react_agent
|
||||
from langchain_openai import ChatOpenAI
|
||||
from langchain_core.messages import HumanMessage, SystemMessage
|
||||
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
||||
from pydantic import SecretStr
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
# 获取当前脚本的路径(Path 对象)
|
||||
current_script = Path(__file__).resolve()
|
||||
# 向上两级找到项目根目录(根据实际结构调整层级)
|
||||
project_root = current_script.parents[1] # parents[0] 是当前目录,parents[1] 是父目录,以此类推
|
||||
|
||||
print("project_root: ",project_root)
|
||||
|
||||
#添加到搜索路径
|
||||
sys.path.append(str(project_root))
|
||||
|
||||
#查看系统环境
|
||||
print("sys path:",sys.path)
|
||||
|
||||
from tools.core.common_functions import read_json_file
|
||||
# 配置日志记录器
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format="%(asctime)s - %(levelname)s - %(message)s"
|
||||
)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PNC:
|
||||
def __init__(self):
|
||||
print("PNC 初始化完成")
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user