Rename AiClient to AiGenerator

This commit is contained in:
projectmoon 2024-01-17 09:28:53 +01:00
parent 336a4231a0
commit bdf5b4da08
3 changed files with 10 additions and 11 deletions

View File

@ -11,7 +11,7 @@ use crate::models::{
Content, ContentContainer, ContentRelation, Content, ContentContainer, ContentRelation,
}; };
use super::generator::AiClient; use super::generator::AiGenerator;
const DIRECTIONS: [&str; 15] = [ const DIRECTIONS: [&str; 15] = [
"north", "north",
@ -80,11 +80,11 @@ fn is_duplicate_recorded(failures: &[CoherenceFailure], exit: &Exit) -> bool {
} }
pub(super) struct AiCoherence { pub(super) struct AiCoherence {
generator: Rc<AiClient>, generator: Rc<AiGenerator>,
} }
impl AiCoherence { impl AiCoherence {
pub fn new(generator: Rc<AiClient>) -> AiCoherence { pub fn new(generator: Rc<AiGenerator>) -> AiCoherence {
AiCoherence { generator } AiCoherence { generator }
} }

View File

@ -26,16 +26,16 @@ fn find_exit_position(exits: &[Exit], exit_to_find: &Exit) -> Result<usize> {
/// information via the LLM and doing basic coherence on it. Things /// information via the LLM and doing basic coherence on it. Things
/// like ID creation, data management, and advanced coherence are done /// like ID creation, data management, and advanced coherence are done
/// at a higher level. /// at a higher level.
pub struct AiClient { pub struct AiGenerator {
parsing_convo: AiConversation, parsing_convo: AiConversation,
world_creation_convo: AiConversation, world_creation_convo: AiConversation,
person_creation_convo: AiConversation, person_creation_convo: AiConversation,
execution_convo: AiConversation, execution_convo: AiConversation,
} }
impl AiClient { impl AiGenerator {
pub fn new(client: Rc<KoboldClient>) -> AiClient { pub fn new(client: Rc<KoboldClient>) -> AiGenerator {
AiClient { AiGenerator {
parsing_convo: AiConversation::new(client.clone()), parsing_convo: AiConversation::new(client.clone()),
world_creation_convo: AiConversation::new(client.clone()), world_creation_convo: AiConversation::new(client.clone()),
person_creation_convo: AiConversation::new(client.clone()), person_creation_convo: AiConversation::new(client.clone()),

View File

@ -12,8 +12,7 @@ use anyhow::{bail, Result};
use itertools::Itertools; use itertools::Itertools;
use std::rc::Rc; use std::rc::Rc;
use super::generator::AiClient; use super::generator::AiGenerator;
use super::coherence::AiCoherence; use super::coherence::AiCoherence;
/// Highest-level AI/LLM construct, which returns fully converted game /// Highest-level AI/LLM construct, which returns fully converted game
@ -22,14 +21,14 @@ use super::coherence::AiCoherence;
/// entities from their seeds. Then, stick a DB ID on them and put /// entities from their seeds. Then, stick a DB ID on them and put
/// them in the database(?). /// them in the database(?).
pub struct AiLogic { pub struct AiLogic {
generator: Rc<AiClient>, generator: Rc<AiGenerator>,
coherence: AiCoherence, coherence: AiCoherence,
db: Rc<Database>, db: Rc<Database>,
} }
impl AiLogic { impl AiLogic {
pub fn new(api_client: Rc<KoboldClient>, db: &Rc<Database>) -> AiLogic { pub fn new(api_client: Rc<KoboldClient>, db: &Rc<Database>) -> AiLogic {
let generator = Rc::new(AiClient::new(api_client)); let generator = Rc::new(AiGenerator::new(api_client));
let coherence = AiCoherence::new(generator.clone()); let coherence = AiCoherence::new(generator.clone());
AiLogic { AiLogic {