mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-13 10:30:14 +01:00
Merge pull request #3535 from yokuminto/release
add reasoning display switch in custom source
This commit is contained in:
commit
3a25550f5b
@ -2000,7 +2000,7 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block" data-source="deepseek,openrouter">
|
||||
<div class="range-block" data-source="deepseek,openrouter,custom">
|
||||
<label for="openai_show_thoughts" class="checkbox_label widthFreeExpand">
|
||||
<input id="openai_show_thoughts" type="checkbox" />
|
||||
<span>
|
||||
|
@ -2167,6 +2167,14 @@ function getStreamingReply(data, state) {
|
||||
state.reasoning += (data.choices?.filter(x => x?.delta?.reasoning)?.[0]?.delta?.reasoning || '');
|
||||
}
|
||||
return data.choices?.[0]?.delta?.content ?? data.choices?.[0]?.message?.content ?? data.choices?.[0]?.text ?? '';
|
||||
} else if (oai_settings.chat_completion_source === chat_completion_sources.CUSTOM) {
|
||||
if (oai_settings.show_thoughts) {
|
||||
state.reasoning +=
|
||||
data.choices?.filter(x => x?.delta?.reasoning_content)?.[0]?.delta?.reasoning_content ??
|
||||
data.choices?.filter(x => x?.delta?.reasoning)?.[0]?.delta?.reasoning ??
|
||||
'';
|
||||
}
|
||||
return data.choices?.[0]?.delta?.content ?? data.choices?.[0]?.message?.content ?? data.choices?.[0]?.text ?? '';
|
||||
} else {
|
||||
return data.choices?.[0]?.delta?.content ?? data.choices?.[0]?.message?.content ?? data.choices?.[0]?.text ?? '';
|
||||
}
|
||||
|
@ -76,6 +76,11 @@ export function extractReasoningFromData(data) {
|
||||
return data?.choices?.[0]?.message?.reasoning ?? '';
|
||||
case chat_completion_sources.MAKERSUITE:
|
||||
return data?.responseContent?.parts?.filter(part => part.thought)?.map(part => part.text)?.join('\n\n') ?? '';
|
||||
case chat_completion_sources.CUSTOM: {
|
||||
return data?.choices?.[0]?.message?.reasoning_content
|
||||
?? data?.choices?.[0]?.message?.reasoning
|
||||
?? '';
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user