Fix: Handle 'reasoning' field from NVIDIA kimi-k2.5 model
All checks were successful
BotServer CI/CD / build (push) Successful in 3m6s
All checks were successful
BotServer CI/CD / build (push) Successful in 3m6s
This commit is contained in:
parent
47cb470c8e
commit
be3e4c4e54
2 changed files with 22 additions and 11 deletions
|
|
@ -21,9 +21,19 @@ ADD_SUGGESTION_TOOL "contato_secretaria" AS "Falar com Secretaria"
|
|||
ADD_SUGGESTION_TOOL "segunda_via" AS "Segunda Via de Boleto"
|
||||
ADD_SUGGESTION_TOOL "calendario_letivo" AS "Calendário Letivo"
|
||||
ADD_SUGGESTION_TOOL "outros" AS "Outros"
|
||||
|
||||
ADD SWITCHER "tables" AS "Tabelas"
|
||||
ADD SWITCHER "infographic" AS "Infográfico"
|
||||
ADD SWITCHER "cards" AS "Cards"
|
||||
ADD SWITCHER "list" AS "Lista"
|
||||
ADD SWITCHER "comparison" AS "Comparação"
|
||||
ADD SWITCHER "timeline" AS "Timeline"
|
||||
ADD SWITCHER "markdown" AS "Markdown"
|
||||
ADD SWITCHER "chart" AS "Gráfico"
|
||||
|
||||
REM Validar região para escolha de secretaria.
|
||||
REM Sincronizar as bases entre o Bot e a Org.
|
||||
|
||||
|
||||
TALK "Olá! Sou o assistente virtual da Escola Salesiana. Como posso ajudá-lo hoje com inscrições, visitas, informações sobre cursos, documentos ou calendário letivo?"
|
||||
TALK "Olá! Sou o assistente virtual da Escola Salesiana. Como posso ajudá-lo hoje com inscrições, visitas, informações sobre cursos, documentos ou calendário letivo? Você pode também escolher formatos de resposta acima da caixa de mensagem."
|
||||
|
||||
|
|
|
|||
|
|
@ -455,17 +455,18 @@ impl LLMProvider for OpenAIClient {
|
|||
let chunk = chunk_result?;
|
||||
let chunk_str = String::from_utf8_lossy(&chunk);
|
||||
for line in chunk_str.lines() {
|
||||
if line.starts_with("data: ") && !line.contains("[DONE]") {
|
||||
if let Ok(data) = serde_json::from_str::<Value>(&line[6..]) {
|
||||
// Handle content (standard) or reasoning_content (NVIDIA reasoning models)
|
||||
let content = data["choices"][0]["delta"]["content"].as_str()
|
||||
.or_else(|| data["choices"][0]["delta"]["reasoning_content"].as_str());
|
||||
if let Some(content) = content {
|
||||
let processed = handler.process_content(content);
|
||||
if !processed.is_empty() {
|
||||
let _ = tx.send(processed).await;
|
||||
if line.starts_with("data: ") && !line.contains("[DONE]") {
|
||||
if let Ok(data) = serde_json::from_str::<Value>(&line[6..]) {
|
||||
// Handle content (standard) or reasoning/reasoning_content (NVIDIA reasoning models)
|
||||
let content = data["choices"][0]["delta"]["content"].as_str()
|
||||
.or_else(|| data["choices"][0]["delta"]["reasoning_content"].as_str())
|
||||
.or_else(|| data["choices"][0]["delta"]["reasoning"].as_str());
|
||||
if let Some(content) = content {
|
||||
let processed = handler.process_content(content);
|
||||
if !processed.is_empty() {
|
||||
let _ = tx.send(processed).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle standard OpenAI tool_calls
|
||||
if let Some(tool_calls) = data["choices"][0]["delta"]["tool_calls"].as_array() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue