Update app.py
Browse files
app.py
CHANGED
|
@@ -48,8 +48,8 @@ MODEL_IDS = {
|
|
| 48 |
"9. Imagem (Flux 2 Pro)": "black-forest-labs/flux.2-pro",
|
| 49 |
"11. Bibliotecário (Qwen Embed)": "qwen/qwen3-embedding-8b",
|
| 50 |
"12. Arquivista (Mistral Nemo)": "mistralai/mistral-nemo",
|
| 51 |
-
"13. Formatador (
|
| 52 |
-
"14.
|
| 53 |
"16. Vídeo (Kling V1.5)": "kling/kling-v1.5"
|
| 54 |
}
|
| 55 |
|
|
@@ -166,7 +166,7 @@ if prompt := st.chat_input("Peça à Yukina..."):
|
|
| 166 |
elif "[IMAGEM]" in tag_decisao: motor_real = "9. Imagem (Flux 2 Pro)"
|
| 167 |
elif "[VIDEO]" in tag_decisao: motor_real = "16. Vídeo (Kling V1.5)"
|
| 168 |
elif "[VISAO]" in tag_decisao or (upload_file is not None and upload_file.name.endswith(('.png', '.jpg', '.jpeg'))): motor_real = "7. Visão Omni (MiMo V2)"
|
| 169 |
-
elif "[CODIGO]" in tag_decisao: motor_real = "14.
|
| 170 |
elif "[ARQUIVISTA]" in tag_decisao: motor_real = "12. Arquivista (Mistral Nemo)"
|
| 171 |
elif "[PESQUISA]" in tag_decisao: motor_real = "2. Pesquisa (Groq Llama 3.3)"
|
| 172 |
else: motor_real = "5. Narrador Líder (Euryale)"
|
|
@@ -227,19 +227,17 @@ if prompt := st.chat_input("Peça à Yukina..."):
|
|
| 227 |
ans = res['choices'][0]['message']['content']; st.markdown(ans); st.session_state.db[st.session_state.current_chat]["messages"].append({"role": "assistant", "content": ans})
|
| 228 |
except Exception as e: st.error(f"Erro visão: {e}")
|
| 229 |
|
| 230 |
-
# 5.
|
| 231 |
else:
|
| 232 |
sys_prompt_ativo = SYSTEM_PROMPT
|
| 233 |
|
| 234 |
if "Arquivista" in motor_real:
|
| 235 |
sys_prompt_ativo = "Você é o Arquivista da Yukina. Sua função é ler dados e documentos, extrair e organizar as informações solicitadas de forma analítica e clara."
|
| 236 |
-
elif "
|
| 237 |
-
sys_prompt_ativo = "Você é o
|
| 238 |
|
| 239 |
-
# A CORREÇÃO MESTRA: Prepara um histórico "puro" sem a duplicidade da UI
|
| 240 |
historico = [{"role": m["role"], "content": m["content"]} for m in mensagens if "image_url" not in m and "video_url" not in m]
|
| 241 |
|
| 242 |
-
# Se houver um documento de texto longo, injeta ele discretamente na última mensagem do usuário na API
|
| 243 |
if conteudo_arquivo and len(historico) > 0:
|
| 244 |
historico[-1]["content"] = f"DOCUMENTO PARA ANÁLISE:\n{conteudo_arquivo}\n\nO QUE FAZER COM ELE:\n{prompt}"
|
| 245 |
|
|
|
|
| 48 |
"9. Imagem (Flux 2 Pro)": "black-forest-labs/flux.2-pro",
|
| 49 |
"11. Bibliotecário (Qwen Embed)": "qwen/qwen3-embedding-8b",
|
| 50 |
"12. Arquivista (Mistral Nemo)": "mistralai/mistral-nemo",
|
| 51 |
+
"13. Formatador (DeepSeek V4)": "deepseek/deepseek-v4-pro:online",
|
| 52 |
+
"14. Engenheiro Sênior (DeepSeek V4)": "deepseek/deepseek-v4-pro:online",
|
| 53 |
"16. Vídeo (Kling V1.5)": "kling/kling-v1.5"
|
| 54 |
}
|
| 55 |
|
|
|
|
| 166 |
elif "[IMAGEM]" in tag_decisao: motor_real = "9. Imagem (Flux 2 Pro)"
|
| 167 |
elif "[VIDEO]" in tag_decisao: motor_real = "16. Vídeo (Kling V1.5)"
|
| 168 |
elif "[VISAO]" in tag_decisao or (upload_file is not None and upload_file.name.endswith(('.png', '.jpg', '.jpeg'))): motor_real = "7. Visão Omni (MiMo V2)"
|
| 169 |
+
elif "[CODIGO]" in tag_decisao: motor_real = "14. Engenheiro Sênior (DeepSeek V4)"
|
| 170 |
elif "[ARQUIVISTA]" in tag_decisao: motor_real = "12. Arquivista (Mistral Nemo)"
|
| 171 |
elif "[PESQUISA]" in tag_decisao: motor_real = "2. Pesquisa (Groq Llama 3.3)"
|
| 172 |
else: motor_real = "5. Narrador Líder (Euryale)"
|
|
|
|
| 227 |
ans = res['choices'][0]['message']['content']; st.markdown(ans); st.session_state.db[st.session_state.current_chat]["messages"].append({"role": "assistant", "content": ans})
|
| 228 |
except Exception as e: st.error(f"Erro visão: {e}")
|
| 229 |
|
| 230 |
+
# 5. Engenheiro Sênior, Arquivista e Narradores (Streaming de Texto)
|
| 231 |
else:
|
| 232 |
sys_prompt_ativo = SYSTEM_PROMPT
|
| 233 |
|
| 234 |
if "Arquivista" in motor_real:
|
| 235 |
sys_prompt_ativo = "Você é o Arquivista da Yukina. Sua função é ler dados e documentos, extrair e organizar as informações solicitadas de forma analítica e clara."
|
| 236 |
+
elif "Engenheiro Sênior" in motor_real:
|
| 237 |
+
sys_prompt_ativo = "Você é o Engenheiro de Software Sênior da Yukina. Sua função é escrever códigos impecáveis de nível de produção (principalmente Python). Explique a lógica de forma elegante e não deixe o código pela metade."
|
| 238 |
|
|
|
|
| 239 |
historico = [{"role": m["role"], "content": m["content"]} for m in mensagens if "image_url" not in m and "video_url" not in m]
|
| 240 |
|
|
|
|
| 241 |
if conteudo_arquivo and len(historico) > 0:
|
| 242 |
historico[-1]["content"] = f"DOCUMENTO PARA ANÁLISE:\n{conteudo_arquivo}\n\nO QUE FAZER COM ELE:\n{prompt}"
|
| 243 |
|