11using Newtonsoft . Json ;
22using System ;
3- using System . Collections . Generic ;
4- using System . Linq ;
53using System . Net . Http ;
64using System . Text ;
75using System . Threading ;
86using System . Threading . Tasks ;
9- using Windows . UI . Popups ;
10- using static System . Net . Mime . MediaTypeNames ;
117
128namespace MORT . TransAPI
139{
@@ -63,26 +59,30 @@ private async Task<string> InternalTranslateTextAsync(string requestText, bool s
6359 }
6460 string apiEndpoint = $ "{ ApiEndpointBase } { modelName } :generateContent";
6561
62+
6663 var requestBody = new
6764 {
6865 contents = new [ ]
6966 {
7067 new { role = "user" , parts = new [ ] { new { text = requestText } } }
7168 } ,
72-
73- // generationConfig 객체를 추가하여 모델 생성 설정을 합니다.
69+
7470 generationConfig = new
7571 {
72+ //추론기능 - 0은 끈 상태
73+ thinkingConfig = new
74+ {
75+ thinkingBudget = 0
76+ } ,
7677 temperature = 0.2f // float 값으로 설정 (0.0f ~ 1.0f 사이)
77- // 번역에는 보통 0.0f (가장 일관적) 또는 0.1f, 0.2f 와 같이 낮은 값을 권장
7878 }
7979 } ;
8080
8181 var jsonRequest = JsonConvert . SerializeObject ( requestBody ) ;
8282 var content = new StringContent ( jsonRequest , Encoding . UTF8 , "application/json" ) ;
8383
8484 // API 호출
85- using ( var cts = new CancellationTokenSource ( TimeSpan . FromSeconds ( 10 ) ) )
85+ using ( var cts = new CancellationTokenSource ( TimeSpan . FromSeconds ( 300 ) ) )
8686 {
8787 try
8888 {
@@ -106,7 +106,7 @@ private async Task<string> InternalTranslateTextAsync(string requestText, bool s
106106 catch ( Exception ex )
107107 {
108108 return $ "Error: 예기치 않은 오류가 발생했습니다. { ex . Message } ";
109- }
109+ }
110110
111111 }
112112 }
@@ -129,8 +129,8 @@ private void InitializeCommand()
129129 }
130130 _resultCommand += $ "{ _defaultCommand } ";
131131 }
132-
133-
132+
133+
134134 _inited = true ;
135135 }
136136
@@ -145,7 +145,7 @@ private string CombineText(string text)
145145 }
146146
147147 public async Task < string > TranslateTextAsync ( string text )
148- {
148+ {
149149 if ( ! _inited )
150150 {
151151 InitializeCommand ( ) ;
0 commit comments