collavre_completion_api 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0766b36abd1a87f89283ed02a814e37d11c74cbda7fc4d4d8d3e22725bcd571
4
- data.tar.gz: 3e020fecc799cd736ca0ed1b53d65347ddc6fab30992f942c751d492c1669c42
3
+ metadata.gz: c722b5ce20cb6dceec074e389ac7d88a973caa0855212c9a9f553c2eee495ae1
4
+ data.tar.gz: b04400dd54db5ffe107d88eceb7f79ae4cb0c23b0f67749a175e9a770c892da5
5
5
  SHA512:
6
- metadata.gz: 98a13c15455b1881b8b758868768a9e9aa1a7331f659c6e9b469dfcf68a89bc0d9f8c455e0518a988ea2cbeee625637f44b16df28b73de9ce1a60288f74fdf33
7
- data.tar.gz: dcade7f6d2f1d3d0c2c258228c0a0c1ff358cccf628d6342bbd8155af8380b53afb7216fbb2e0759a28ed09637d875641a919dfa867f5d6ba509c55421a91b66
6
+ metadata.gz: f1329384805d5ec00be758352969e1e45cc93bbfd5674b757eb2f9d6acce1f2b3f08f610cfd8e2b025c96465de13b1f692afd83995fc1501c176feb6c413ef3a
7
+ data.tar.gz: 7fe0bb705db919ce3e44615ce20fbb1d30ddc6f3754dee2a001078f8fe18eb37b36728de42db257ec0a9bed02add44ac0d76ab8e1cb57fddbd2d79362d04af5b
data/README.md CHANGED
@@ -32,6 +32,13 @@ Pass optional headers to inject Collavre context into AI prompts:
32
32
  - `X-Collavre-Creative: <creative_id>` — Include creative context
33
33
  - `X-Collavre-Topic: <topic_id>` — Filter context to specific topic
34
34
 
35
+ ## Session Tracking
36
+
37
+ When both `X-Collavre-Creative` and `X-Collavre-Topic` headers are present, the
38
+ completion API forwards an `X-Session-Id` header (`creative_{id}_topic_{id}`) to
39
+ the upstream LLM provider. This allows the gateway to group requests by
40
+ creative/topic pair.
41
+
35
42
  ## Installation
36
43
 
37
44
  Add to your host app's `Gemfile`:
@@ -36,7 +36,8 @@ module CollavreCompletionApi
36
36
  model: agent.llm_model,
37
37
  system_prompt: system_prompt,
38
38
  llm_api_key: api_key,
39
- context: { creative: collavre_creative, user: current_user }
39
+ gateway_url: agent.respond_to?(:gateway_url) ? agent.gateway_url : nil,
40
+ context: { creative: collavre_creative, user: current_user, topic_id: collavre_topic&.id }
40
41
  )
41
42
 
42
43
  model_name = params[:model] || agent_model_id(agent)
@@ -79,7 +80,7 @@ module CollavreCompletionApi
79
80
  end
80
81
 
81
82
  scope = collavre_creative.comments
82
- .where(private: false)
83
+ .public_only
83
84
  .order(created_at: :desc)
84
85
  scope = scope.where(topic_id: collavre_topic.id) if collavre_topic
85
86
  recent_comments = scope.limit(CREATIVE_CONTEXT_COMMENT_LIMIT)
@@ -1,3 +1,3 @@
1
1
  module CollavreCompletionApi
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: collavre_completion_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Collavre