FEATURE: support topic_id and post_id logging in ai audit log (#274)

This makes it easier to track who is responsible for a completion
in logs

Note: ai helper and summarization are not yet implemented
This commit is contained in:
Sam
2023-11-01 08:41:31 +11:00
committed by GitHub
parent c6d5c56033
commit fc65404896
8 changed files with 38 additions and 5 deletions
@@ -14,6 +14,7 @@ module ::DiscourseAi
max_tokens: nil,
user_id: nil,
stop_sequences: nil,
post: nil,
&blk
)
# HACK to get around the fact that they have different APIs
@@ -78,6 +79,8 @@ module ::DiscourseAi
provider_id: AiApiAuditLog::Provider::Anthropic,
raw_request_payload: request_body,
user_id: user_id,
post_id: post&.id,
topic_id: post&.topic_id,
)
if !block_given?
@@ -20,6 +20,7 @@ module ::DiscourseAi
user_id: nil,
retries: DEFAULT_RETRIES,
retry_timeout: DEFAULT_RETRY_TIMEOUT_SECONDS,
post: nil,
&blk
)
log = nil
@@ -103,6 +104,8 @@ module ::DiscourseAi
provider_id: AiApiAuditLog::Provider::OpenAI,
raw_request_payload: request_body,
user_id: user_id,
post_id: post&.id,
topic_id: post&.topic_id,
)
if !blk