a ia esta com erro 429 mas esta a funcionar (segundo o anti gravity)
This commit is contained in:
@@ -15,7 +15,7 @@ import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class OllamaService {
|
||||
public class Ollama {
|
||||
// Definir o modelo especificado
|
||||
private static final String MODEL_NAME = "gemma4:e2b";
|
||||
// O endpoint padrão do Ollama para geração de texto é /api/generate
|
||||
@@ -24,7 +24,7 @@ public class OllamaService {
|
||||
private final OkHttpClient client;
|
||||
private final Handler mainHandler;
|
||||
|
||||
public OllamaService() {
|
||||
public Ollama() {
|
||||
this.client = new OkHttpClient();
|
||||
this.mainHandler = new Handler(Looper.getMainLooper());
|
||||
}
|
||||
|
||||
@@ -12,12 +12,12 @@ import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.example.cuida.databinding.FragmentSns24Binding;
|
||||
import com.example.cuida.services.Gemini;
|
||||
import com.example.cuida.services.Ollama;
|
||||
|
||||
public class Sns24Fragment extends Fragment {
|
||||
|
||||
private FragmentSns24Binding binding;
|
||||
private Gemini gemini;
|
||||
private Ollama ollama;
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
@@ -25,7 +25,7 @@ public class Sns24Fragment extends Fragment {
|
||||
binding = FragmentSns24Binding.inflate(inflater, container, false);
|
||||
View root = binding.getRoot();
|
||||
|
||||
gemini = new Gemini();
|
||||
ollama = new Ollama();
|
||||
|
||||
// 1. Botão de Chamada SNS 24
|
||||
binding.buttonCallSns.setOnClickListener(v -> {
|
||||
@@ -74,7 +74,7 @@ public class Sns24Fragment extends Fragment {
|
||||
"Se os sintomas indicarem perigo de vida ou necessidade de observação urgente, OBRIGATORIAMENTE começa a tua primeira linha com a palavra [GRAVE]. " +
|
||||
"Sintomas do paciente: " + symptoms;
|
||||
|
||||
gemini.fazerPergunta(prompt, new Gemini.GeminiCallback() {
|
||||
ollama.fazerPergunta(prompt, new Ollama().OllamaCallback() {
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
if (getActivity() != null && binding != null) {
|
||||
|
||||
Reference in New Issue
Block a user