Switch to AI server, better UX for when server down

main
parent ecf5308389
commit 54f61b11b3

@ -52,7 +52,10 @@
<ConfigProperties>
<ConfigAndPlatform>
<Name>Debug:x64</Name>
<Defines></Defines>
<Defines>
<Define>DESKTOP</Define>
<Define>DEVTOOLS</Define>
</Defines>
<ForceIncludes></ForceIncludes>
</ConfigAndPlatform>
<Config>

@ -1889,7 +1889,7 @@ bool perform_action(Entity *from, Action a)
if(a.speech_length == 0 && a.kind == ACT_none)
{
proceed_propagating = false; // did nothing
proceed_propagating = false; // didn't say anything
}
if(proceed_propagating)
@ -3915,6 +3915,8 @@ bool profiling;
const bool show_devtools = false;
#endif
bool having_errors = false;
// @Place(temporary trailer shit to force gameplay things)
bool dance_anim = false;
bool nervous_anim = false;
@ -5982,6 +5984,7 @@ ISANERROR("Don't know how to do this stuff on this platform.")
{
if (status == 1)
{
having_errors = false;
// done! we can get the string
char sentence_cstr[MAX_SENTENCE_LENGTH] = { 0 };
#ifdef WEB
@ -6029,6 +6032,8 @@ ISANERROR("Don't know how to do this stuff on this platform.")
else if (status == 2)
{
Log("Failed to generate dialog! Fuck!\n");
having_errors = true;
// need somethin better here. Maybe each sentence has to know if it's player or NPC, that way I can remove the player's dialog
Action to_perform = {0};
MD_String8 speech_mdstring = MD_S8Lit("I'm not sure...");
@ -6528,6 +6533,8 @@ ISANERROR("Don't know how to do this stuff on this platform.")
#endif
bool succeeded = true; // couldn't get AI response if false
if(mocking_the_ai_response)
{
if (it->memories_last->context.talking_to_kind == it->npc_kind)
{
const char *action = "none";
//if(it->standing != STANDING_JOINED) action = "joins_player";
@ -6551,6 +6558,11 @@ ISANERROR("Don't know how to do this stuff on this platform.")
#endif
}
else
{
ai_response = MD_S8Fmt(frame_arena, "{who_i_am: \"%s\", talking_to: nobody, action: none, speech: \"I heard that...\", thoughts: \"I'm thinking...\", mood: Happy}", characters[it->npc_kind].name);
}
}
else
{
MD_String8 post_request_body = FmtWithLint(scratch.arena, "|%.*s", MD_S8VArg(prompt_str));
it->gen_request_id = make_generation_request(post_request_body);
@ -6909,6 +6921,13 @@ ISANERROR("Don't know how to do this stuff on this platform.")
}
}
if (having_errors)
{
Vec2 text_center = V2(screen_size().x / 2.0f, screen_size().y*0.8f);
draw_quad((DrawParams){centered_quad(text_center, V2(screen_size().x*0.8f, screen_size().y*0.1f)), IMG(image_white_square), blendalpha(BLACK, 0.5f), .layer = LAYER_UI_FG});
draw_centered_text((TextParams){false, MD_S8Lit("The AI server is having technical difficulties..."), text_center, WHITE, 1.0f });
}
if(false)
PROFILE_SCOPE("dialog menu") // big dialog panel draw big dialog panel
{

@ -21,7 +21,7 @@
#ifdef DEVTOOLS
// server url cannot have trailing slash
#define MOCK_AI_RESPONSE
//#define MOCK_AI_RESPONSE
#define SERVER_DOMAIN "localhost"
#define SERVER_PORT 8090
#define IS_SERVER_SECURE 0

Loading…
Cancel
Save