From bdf5b4da080ab9635753ae5aebc66cbc0f7cc96c Mon Sep 17 00:00:00 2001 From: projectmoon Date: Wed, 17 Jan 2024 09:28:53 +0100 Subject: [PATCH] Rename AiClient to AiGenerator --- src/ai/coherence.rs | 6 +++--- src/ai/generator.rs | 8 ++++---- src/ai/logic.rs | 7 +++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/ai/coherence.rs b/src/ai/coherence.rs index 839a243..a2dbffe 100644 --- a/src/ai/coherence.rs +++ b/src/ai/coherence.rs @@ -11,7 +11,7 @@ use crate::models::{ Content, ContentContainer, ContentRelation, }; -use super::generator::AiClient; +use super::generator::AiGenerator; const DIRECTIONS: [&str; 15] = [ "north", @@ -80,11 +80,11 @@ fn is_duplicate_recorded(failures: &[CoherenceFailure], exit: &Exit) -> bool { } pub(super) struct AiCoherence { - generator: Rc, + generator: Rc, } impl AiCoherence { - pub fn new(generator: Rc) -> AiCoherence { + pub fn new(generator: Rc) -> AiCoherence { AiCoherence { generator } } diff --git a/src/ai/generator.rs b/src/ai/generator.rs index b4589c3..2c3a754 100644 --- a/src/ai/generator.rs +++ b/src/ai/generator.rs @@ -26,16 +26,16 @@ fn find_exit_position(exits: &[Exit], exit_to_find: &Exit) -> Result { /// information via the LLM and doing basic coherence on it. Things /// like ID creation, data management, and advanced coherence are done /// at a higher level. -pub struct AiClient { +pub struct AiGenerator { parsing_convo: AiConversation, world_creation_convo: AiConversation, person_creation_convo: AiConversation, execution_convo: AiConversation, } -impl AiClient { - pub fn new(client: Rc) -> AiClient { - AiClient { +impl AiGenerator { + pub fn new(client: Rc) -> AiGenerator { + AiGenerator { parsing_convo: AiConversation::new(client.clone()), world_creation_convo: AiConversation::new(client.clone()), person_creation_convo: AiConversation::new(client.clone()), diff --git a/src/ai/logic.rs b/src/ai/logic.rs index 6a6c342..3627697 100644 --- a/src/ai/logic.rs +++ b/src/ai/logic.rs @@ -12,8 +12,7 @@ use anyhow::{bail, Result}; use itertools::Itertools; use std::rc::Rc; -use super::generator::AiClient; - +use super::generator::AiGenerator; use super::coherence::AiCoherence; /// 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 /// them in the database(?). pub struct AiLogic { - generator: Rc, + generator: Rc, coherence: AiCoherence, db: Rc, } impl AiLogic { pub fn new(api_client: Rc, db: &Rc) -> AiLogic { - let generator = Rc::new(AiClient::new(api_client)); + let generator = Rc::new(AiGenerator::new(api_client)); let coherence = AiCoherence::new(generator.clone()); AiLogic {