|
|
|
@ -43,20 +43,20 @@ impl AiClient {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn reset_commands(&mut self) {
|
|
|
|
|
pub fn reset_commands(&self) {
|
|
|
|
|
self.parsing_convo.reset();
|
|
|
|
|
self.execution_convo.reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn reset_world_creation(&mut self) {
|
|
|
|
|
pub fn reset_world_creation(&self) {
|
|
|
|
|
self.world_creation_convo.reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn reset_person_creation(&mut self) {
|
|
|
|
|
pub fn reset_person_creation(&self) {
|
|
|
|
|
self.person_creation_convo.reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub async fn parse(&mut self, cmd: &str) -> Result<Commands> {
|
|
|
|
|
pub async fn parse(&self, cmd: &str) -> Result<Commands> {
|
|
|
|
|
// If convo so far is empty, add the instruction header,
|
|
|
|
|
// otherwise only append to existing convo.
|
|
|
|
|
let prompt = match self.parsing_convo.is_empty() {
|
|
|
|
@ -70,7 +70,7 @@ impl AiClient {
|
|
|
|
|
Ok(cmds)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async fn find_verbs(&mut self, cmd: &str) -> Result<Vec<String>> {
|
|
|
|
|
async fn find_verbs(&self, cmd: &str) -> Result<Vec<String>> {
|
|
|
|
|
let prompt = parsing_prompts::find_verbs_prompt(cmd);
|
|
|
|
|
let verbs: VerbsResponse = self.parsing_convo.execute(&prompt).await?;
|
|
|
|
|
|
|
|
|
@ -83,7 +83,7 @@ impl AiClient {
|
|
|
|
|
.collect())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async fn check_coherence(&mut self, verbs: &[String], commands: &mut Commands) -> Result<()> {
|
|
|
|
|
async fn check_coherence(&self, verbs: &[String], commands: &mut Commands) -> Result<()> {
|
|
|
|
|
// let coherence_prompt = parsing_prompts::coherence_prompt();
|
|
|
|
|
// let mut commands: Commands = self.parsing_convo.execute(&coherence_prompt).await?;
|
|
|
|
|
|
|
|
|
@ -102,18 +102,14 @@ impl AiClient {
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub async fn execute_raw(
|
|
|
|
|
&mut self,
|
|
|
|
|
stage: &Stage,
|
|
|
|
|
cmd: &Command,
|
|
|
|
|
) -> Result<RawCommandExecution> {
|
|
|
|
|
pub async fn execute_raw(&self, stage: &Stage, cmd: &Command) -> Result<RawCommandExecution> {
|
|
|
|
|
let prompt = execution_prompts::execution_prompt(stage, &cmd);
|
|
|
|
|
let raw_exec: RawCommandExecution = self.execution_convo.execute(&prompt).await?;
|
|
|
|
|
Ok(raw_exec)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub async fn create_scene_seed(
|
|
|
|
|
&mut self,
|
|
|
|
|
&self,
|
|
|
|
|
scene_type: &str,
|
|
|
|
|
fantasticalness: &str,
|
|
|
|
|
) -> Result<SceneSeed> {
|
|
|
|
@ -123,7 +119,7 @@ impl AiClient {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub async fn create_scene_seed_from_stub(
|
|
|
|
|
&mut self,
|
|
|
|
|
&self,
|
|
|
|
|
stub: &SceneStub,
|
|
|
|
|
connected_scene: &Scene,
|
|
|
|
|
) -> Result<SceneSeed> {
|
|
|
|
@ -133,7 +129,7 @@ impl AiClient {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub async fn create_person_details(
|
|
|
|
|
&mut self,
|
|
|
|
|
&self,
|
|
|
|
|
scene: &SceneSeed,
|
|
|
|
|
seed: &PersonSeed,
|
|
|
|
|
) -> Result<PersonDetails> {
|
|
|
|
@ -143,7 +139,7 @@ impl AiClient {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub async fn create_item_details(
|
|
|
|
|
&mut self,
|
|
|
|
|
&self,
|
|
|
|
|
scene: &SceneSeed,
|
|
|
|
|
seed: &ItemSeed,
|
|
|
|
|
) -> Result<ItemDetails> {
|
|
|
|
@ -157,7 +153,7 @@ impl AiClient {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub(super) async fn fix_scene<'a>(
|
|
|
|
|
&mut self,
|
|
|
|
|
&self,
|
|
|
|
|
scene: &Scene,
|
|
|
|
|
failures: Vec<CoherenceFailure<'a>>,
|
|
|
|
|
) -> Result<Vec<SceneFix>> {
|
|
|
|
|