File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 11const API_URL = process . env . REACT_APP_API_URL || "http://localhost:5000/api/v1" ;
22
3+ const getQwenTemperature = ( modelName : string ) : number => {
4+ if ( modelName . includes ( "next" ) || modelName . includes ( "fast" ) ) return 0.4 ;
5+ if ( modelName . includes ( "careful" ) || modelName . includes ( "think" ) ) return 0.15 ;
6+ return 0.3 ;
7+ } ;
8+
39export const OllamaService = {
410 chat : async (
511 model : string ,
612 messages : { role : string ; content : string } [ ]
713 ) : Promise < any > => {
14+ const temperature = getQwenTemperature ( model ) ;
815 const response = await fetch ( `${ API_URL } /ollama/chat` , {
916 method : "POST" ,
1017 headers : { "Content-Type" : "application/json" } ,
11- body : JSON . stringify ( { model, messages, stream : false } ) ,
18+ body : JSON . stringify ( {
19+ model,
20+ messages,
21+ stream : false ,
22+ options : {
23+ temperature, // ← pass to Ollama
24+ } ,
25+ } ) ,
1226 } ) ;
1327
1428 const data = await response . json ( ) ;
You can’t perform that action at this time.
0 commit comments