File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -998,13 +998,16 @@ export namespace Provider {
998998 opts . signal = combined
999999 }
10001000
1001- // Inject metadata from model .options if enableMeta is set
1001+ // Inject metadata from provider .options if enableMeta is set
10021002 if ( provider . options ?. enableMeta && opts . body && opts . method === "POST" ) {
10031003 try {
1004- options . headers [ "x-opencode-session" ] = model . options . metadata . user_id
1004+ options . headers [ "x-opencode-session" ] = model . options . metadata . user_session_id
10051005
10061006 const body = JSON . parse ( opts . body as string )
1007- body . metadata = model . options . metadata
1007+ body . metadata ||= { }
1008+ body . metadata . user_id = model . options . metadata . user_session_id
1009+ body . metadata . project_id = model . options . metadata . project_id
1010+ body . metadata . session_id = model . options . metadata . session_id
10081011 opts . body = JSON . stringify ( body )
10091012 } catch { }
10101013 }
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ export namespace LLM {
6464 ] )
6565 if ( provider . options ?. enableMeta ) {
6666 input . model . options . metadata = {
67- user_id : `user_${ Instance . project . id ?? "unknown" } _account__session_${ input . sessionID } ` ,
67+ user_session_id : `user_${ Instance . project . id ?? "unknown" } _account__session_${ input . sessionID } ` ,
6868 project_id : Instance . project . id ,
6969 session_id : input . sessionID ,
7070 }
You can’t perform that action at this time.
0 commit comments