Enrich external API failure audit metadata
This commit is contained in:
@@ -269,10 +269,10 @@ pub(crate) async fn generate_puzzle_ui_background_image(
|
||||
) -> Result<GeneratedPuzzleUiBackgroundResponse, AppError> {
|
||||
let settings = require_openai_image_settings(state.root_state())?
|
||||
.with_external_api_audit_context(
|
||||
request_context,
|
||||
Some(owner_user_id.to_string()),
|
||||
Some(session_id.to_string()),
|
||||
)
|
||||
.with_external_api_audit_request_id(Some(request_context.request_id().to_string()));
|
||||
);
|
||||
let http_client = build_openai_image_http_client(&settings)?;
|
||||
let generated = create_openai_image_generation(
|
||||
&http_client,
|
||||
@@ -311,7 +311,11 @@ pub(crate) async fn generate_puzzle_level_asset_bundle(
|
||||
puzzle_image: &PuzzleDownloadedImage,
|
||||
) -> Result<GeneratedPuzzleLevelAssetBundle, AppError> {
|
||||
let settings = require_puzzle_vector_engine_settings(state)?
|
||||
.with_external_api_audit_request_id(Some(request_context.request_id().to_string()));
|
||||
.with_external_api_audit_context(
|
||||
request_context,
|
||||
Some(owner_user_id.to_string()),
|
||||
Some(session_id.to_string()),
|
||||
);
|
||||
let http_client = build_puzzle_image_http_client(state, PuzzleImageModel::GptImage2)?;
|
||||
let puzzle_reference = build_puzzle_downloaded_image_reference(puzzle_image);
|
||||
let scene_generated = create_puzzle_vector_engine_image_generation(
|
||||
|
||||
@@ -109,13 +109,19 @@ impl PuzzleVectorEngineSettings {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn with_external_api_audit_request_id(
|
||||
pub(crate) fn with_external_api_audit_context(
|
||||
mut self,
|
||||
request_id: Option<String>,
|
||||
request_context: &RequestContext,
|
||||
user_id: Option<String>,
|
||||
profile_id: Option<String>,
|
||||
) -> Self {
|
||||
self.external_api_audit_request_id = request_id;
|
||||
self.external_api_audit_user_id = user_id;
|
||||
self.external_api_audit_profile_id = profile_id;
|
||||
self.external_api_audit_request_id =
|
||||
Some(request_context.request_id().to_string());
|
||||
self
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pub(crate) struct ParsedPuzzleImageDataUrl {
|
||||
|
||||
Reference in New Issue
Block a user