Commit 156cf5f 1 parent 30bbe61 commit 156cf5f Copy full SHA for 156cf5f
File tree 1 file changed +14
-6
lines changed
src/libs/agent-runtime/perplexity
1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -9,13 +9,21 @@ export const LobePerplexityAI = LobeOpenAICompatibleFactory({
9
9
chatCompletion : {
10
10
handlePayload : ( payload : ChatStreamPayload ) => {
11
11
// Set a default frequency penalty value greater than 0
12
- const defaultFrequencyPenalty = 1 ;
12
+ const { presence_penalty , frequency_penalty , ... res } = payload ;
13
13
14
- return {
15
- ...payload ,
16
- frequency_penalty : payload . frequency_penalty || defaultFrequencyPenalty ,
17
- stream : true ,
18
- } as OpenAI . ChatCompletionCreateParamsStreaming ;
14
+ let param ;
15
+
16
+ // Ensure we are only have one frequency_penalty or frequency_penalty
17
+ if ( presence_penalty !== 0 ) {
18
+ param = { presence_penalty } ;
19
+ } else {
20
+ const defaultFrequencyPenalty = 1 ;
21
+
22
+ param = { frequency_penalty : frequency_penalty || defaultFrequencyPenalty } ;
23
+ }
24
+
25
+ console . log ( param ) ;
26
+ return { ...res , ...param } as OpenAI . ChatCompletionCreateParamsStreaming ;
19
27
} ,
20
28
} ,
21
29
debug : {
You can’t perform that action at this time.
0 commit comments