yaze
0.3.2
Link to the Past ROM Editor
Loading...
Searching...
No Matches
prompt_manager.cc
Go to the documentation of this file.
1
#include "
cli/service/agent/prompt_manager.h
"
2
3
#include <fstream>
4
#include <sstream>
5
6
#include "
util/file_util.h
"
7
#include "
util/platform_paths.h
"
8
9
namespace
yaze
{
10
namespace
cli {
11
namespace
agent {
12
13
std::string
PromptManager::LoadPrompt
(
PromptMode
mode) {
14
auto
path =
util::PlatformPaths::FindAsset
(
GetPromptPath
(mode));
15
if
(!path.ok()) {
16
return
""
;
17
}
18
19
std::ifstream file(*path);
20
if
(!file)
21
return
""
;
22
23
std::ostringstream ss;
24
ss << file.rdbuf();
25
return
ss.str();
26
}
27
28
std::string
PromptManager::GetPromptPath
(
PromptMode
mode) {
29
switch
(mode) {
30
case
PromptMode::kStandard
:
31
return
"agent/system_prompt_v3.txt"
;
32
case
PromptMode::kOracleOfSecrets
:
33
return
"agent/oracle_of_secrets_guide.txt"
;
34
case
PromptMode::kCustom
:
35
return
"agent/custom_prompt.txt"
;
36
}
37
return
""
;
38
}
39
40
std::vector<PromptMode>
PromptManager::GetAvailableModes
() {
41
return
{
PromptMode::kStandard
,
PromptMode::kOracleOfSecrets
};
42
}
43
44
const
char
*
PromptManager::ModeToString
(
PromptMode
mode) {
45
switch
(mode) {
46
case
PromptMode::kStandard
:
47
return
"ALTTP Standard"
;
48
case
PromptMode::kOracleOfSecrets
:
49
return
"Oracle of Secrets"
;
50
case
PromptMode::kCustom
:
51
return
"Custom"
;
52
}
53
return
"Unknown"
;
54
}
55
56
}
// namespace agent
57
}
// namespace cli
58
}
// namespace yaze
yaze::cli::agent::PromptManager::LoadPrompt
static std::string LoadPrompt(PromptMode mode)
Definition
prompt_manager.cc:13
yaze::cli::agent::PromptManager::GetAvailableModes
static std::vector< PromptMode > GetAvailableModes()
Definition
prompt_manager.cc:40
yaze::cli::agent::PromptManager::ModeToString
static const char * ModeToString(PromptMode mode)
Definition
prompt_manager.cc:44
yaze::cli::agent::PromptManager::GetPromptPath
static std::string GetPromptPath(PromptMode mode)
Definition
prompt_manager.cc:28
yaze::util::PlatformPaths::FindAsset
static absl::StatusOr< std::filesystem::path > FindAsset(const std::string &relative_path)
Find an asset file in multiple standard locations.
Definition
platform_paths.cc:405
file_util.h
yaze::cli::agent::PromptMode
PromptMode
Definition
prompt_manager.h:11
yaze::cli::agent::PromptMode::kStandard
@ kStandard
yaze::cli::agent::PromptMode::kCustom
@ kCustom
yaze::cli::agent::PromptMode::kOracleOfSecrets
@ kOracleOfSecrets
yaze
Definition
patch_export_usage.cc:8
platform_paths.h
prompt_manager.h
src
cli
service
agent
prompt_manager.cc
Generated by
1.10.0