Continue AI features and improve protocol support
This commit is contained in:
@@ -1,14 +1,7 @@
|
||||
import asyncio
|
||||
import json
|
||||
import random
|
||||
|
||||
from asgiref.sync import sync_to_async
|
||||
from django.utils import timezone
|
||||
from openai import AsyncOpenAI
|
||||
|
||||
from core.lib.prompts import bases
|
||||
from core.models import AI, ChatSession, Manipulation, Message, Person
|
||||
from core.util import logs
|
||||
from core.models import AI, Manipulation, Person
|
||||
|
||||
|
||||
def generate_prompt(msg: dict, person: Person, manip: Manipulation, chat_history: str):
|
||||
@@ -62,7 +55,7 @@ async def run_context_prompt(
|
||||
):
|
||||
cast = {"api_key": ai.api_key}
|
||||
if ai.base_url is not None:
|
||||
cast["api_key"] = ai.base_url
|
||||
cast["base_url"] = ai.base_url
|
||||
client = AsyncOpenAI(**cast)
|
||||
response = await client.chat.completions.create(
|
||||
model=ai.model,
|
||||
|
||||
Reference in New Issue
Block a user