11package com .ke .bella .openapi .protocol .completion ;
22
3+ import com .ke .bella .openapi .EndpointContext ;
34import org .apache .commons .collections4 .CollectionUtils ;
45import org .apache .commons .collections4 .MapUtils ;
56import org .apache .commons .lang3 .StringUtils ;
@@ -31,6 +32,9 @@ public class OpenAIAdaptor implements CompletionAdaptorDelegator<OpenAIProperty>
3132@ Override
3233public CompletionResponse completion (CompletionRequest request ,String url ,OpenAIProperty property ,Callbacks .HttpDelegator delegator ) {
3334CompletionResponse response ;
35+ if (request .getPrompt_cache_key () ==null ) {
36+ request .setPrompt_cache_key (EndpointContext .getProcessData ().getAkCode ());
37+ }
3438if (delegator ==null ) {
3539Request httpRequest =buildRequest (request ,url ,property );
3640
@@ -49,6 +53,9 @@ public CompletionResponse completion(CompletionRequest request, String url, Open
4953@ Override
5054public void streamCompletion (CompletionRequest request ,String url ,OpenAIProperty property ,StreamCompletionCallback callback ,
5155Callbacks .StreamDelegator delegator ) {
56+ if (request .getPrompt_cache_key () ==null ) {
57+ request .setPrompt_cache_key (EndpointContext .getProcessData ().getAkCode ());
58+ }
5259CompletionSseListener listener =new CompletionSseListener (callback ,sseConverter );
5360if (delegator ==null ) {
5461Request httpRequest =buildRequest (request ,url ,property );