载入中...
搜索中...
未找到
ConversationToolchain.cpp
浏览该文件的文档.
10void rewriteNodeReference(std::string& reference, const std::string& oldId, const std::string& newId) {
51 if (std::none_of(target->parameters.begin(), target->parameters.end(), [&](const auto& parameter) {
64 std::none_of(diagnostics.begin() + static_cast<std::ptrdiff_t>(diagnosticsBegin), diagnostics.end(),
69 const std::string message = diagnostics.size() > diagnosticsBegin ? diagnostics[diagnosticsBegin].message
77eve::Result<void> renameConversationAsset(std::vector<eve::dnut::SequenceAsset>& assets, const std::string& oldId,
80 eve::DiagnosticCode::InvalidArgument, "conversation IDs must not be empty", oldId, {}, "dialogue.rename"));
81 auto source = std::find_if(assets.begin(), assets.end(), [&](const auto& asset) { return asset.id == oldId; });
83 eve::DiagnosticCode::InvalidArgument, "conversation not found: " + oldId, oldId, {}, "dialogue.rename"));
84 if (std::any_of(assets.begin(), assets.end(), [&](const auto& asset) { return asset.id == newId; }))
86 eve::DiagnosticCode::InvalidArgument, "conversation already exists: " + newId, newId, {}, "dialogue.rename"));
96eve::Result<void> renameConversationNode(std::vector<eve::dnut::SequenceAsset>& assets, const std::string& assetId,
99 eve::DiagnosticCode::InvalidArgument, "node IDs must not be empty", assetId, {}, "dialogue.rename"));
100 auto asset = std::find_if(assets.begin(), assets.end(), [&](const auto& item) { return item.id == assetId; });
102 eve::DiagnosticCode::InvalidArgument, "conversation not found: " + assetId, assetId, {}, "dialogue.rename"));
104 std::find_if(asset->nodes.begin(), asset->nodes.end(), [&](const auto& item) { return item.id == oldId; });
106 eve::DiagnosticCode::InvalidArgument, "node not found: " + oldId, assetId + "/" + oldId, {}, "dialogue.rename"));
108 eve::DiagnosticCode::InvalidArgument, "node already exists: " + newId, assetId + "/" + newId, {}, "dialogue.rename"));
Dialogue payload codecs for L1 sequence assets.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
std::vector< std::string > keys() const
Return object member names in deterministic order.
Definition Value.cpp:138
static Value string(std::string value)
Compatibility factory for a string value.
Definition Value.h:110
Value * find(const std::string &key) noexcept
Return an object member, or nullptr when absent.
Definition Value.cpp:124
Definition ConversationAuthoring.cpp:12
eve::Result< void > renameConversationNode(std::vector< eve::dnut::SequenceAsset > &assets, const std::string &assetId, const std::string &oldId, const std::string &newId)
Rename one stable node and rewrite all references inside its asset.
Definition ConversationToolchain.cpp:96
eve::Result< void > lintConversations(const std::vector< eve::dnut::SequenceAsset > &assets, const std::string &path, std::vector< ConversationDiagnostic > &diagnostics)
Validate references and report unreachable nodes.
Definition ConversationCompiler.cpp:36
eve::Result< void > lintConversationWorkspace(const std::vector< eve::dnut::SequenceAsset > &assets, const std::string &label, std::vector< ConversationDiagnostic > &diagnostics)
Lint a complete multi-file registry, including cross-asset call targets.
Definition ConversationToolchain.cpp:16
std::string sequencePayloadString(const eve::dnut::SequenceNode &node, std::string_view key)
Read an optional string from a node payload; missing or ill-typed values yield empty.
Definition DialogueSequence.cpp:108
eve::Result< void > renameConversationAsset(std::vector< eve::dnut::SequenceAsset > &assets, const std::string &oldId, const std::string &newId)
Rename an asset and rewrite every cross-asset call target.
Definition ConversationToolchain.cpp:77
@ InvalidArgument