main
HuangHai 2 weeks ago
parent 95f88f867b
commit 0e3f2e77f0

@ -1,8 +1,9 @@
from Util.MySQLUtil import init_mysql_pool
from openai import OpenAI from openai import OpenAI
from Config.Config import LLM_API_KEY, LLM_BASE_URL, LLM_MODEL_NAME from Config.Config import LLM_API_KEY, LLM_BASE_URL, LLM_MODEL_NAME
import asyncio import asyncio
from Util.PostgreSQLUtil import init_postgres_pool
class QuestionMatcher: class QuestionMatcher:
def __init__(self): def __init__(self):
@ -29,15 +30,12 @@ class QuestionMatcher:
async def main(): async def main():
mysql_pool = await init_mysql_pool() pg_pool = await init_postgres_pool()
matcher = QuestionMatcher() matcher = QuestionMatcher()
async with mysql_pool.acquire() as conn: async with pg_pool.acquire() as conn:
await conn.ping() # 执行查询
async with conn.cursor() as cur: knowledge_points = await conn.fetch('SELECT id, title,is_leaf FROM knowledge_points where is_leaf=1')
await cur.execute("SELECT id, title,is_leaf FROM knowledge_points where is_leaf=1")
knowledge_points = await cur.fetchall()
questions = [ questions = [
"小明有3个苹果又买了5个现在有多少个苹果", "小明有3个苹果又买了5个现在有多少个苹果",
"一个长方形的长是5cm宽是3cm面积是多少", "一个长方形的长是5cm宽是3cm面积是多少",

Loading…
Cancel
Save