Merge pull request #3673 from qvink/export_parse_reasoning exporting parseReasoningFromString()
Signed| @@ -1075,7 +1075,7 @@ export function removeReasoningFromString(str) { | ||
| 1075 | 1075 | * @param {boolean} [options.strict=true] Whether the reasoning block **has** to be at the beginning of the provided string (excluding whitespaces), or can be anywhere in it |
| 1076 | 1076 | * @returns {ParsedReasoning|null} Parsed reasoning block and message content |
| 1077 | 1077 | */ |
| 1078 | 1078 | export function parseReasoningFromString(str, { strict = true } = {}) { |
| 1079 | 1079 | // Both prefix and suffix must be defined |
| 1080 | 1080 | if (!power_user.reasoning.prefix || !power_user.reasoning.suffix) { |
| 1081 | 1081 | return null; |
| @@ -79,7 +79,7 @@ import { timestampToMoment, uuidv4 } from './utils.js'; | ||
| 79 | 79 | import { getGlobalVariable, getLocalVariable, setGlobalVariable, setLocalVariable } from './variables.js'; |
| 80 | 80 | import { convertCharacterBook, loadWorldInfo, saveWorldInfo, updateWorldInfoList } from './world-info.js'; |
| 81 | 81 | import { ChatCompletionService, TextCompletionService } from './custom-request.js'; |
| 82 | 82 | import { updateReasoningUI, parseReasoningFromString } from './reasoning.js'; |
| 83 | 83 | |
| 84 | 84 | export function getContext() { |
| 85 | 85 | return { |
| @@ -213,6 +213,7 @@ export function getContext() { | ||
| 213 | 213 | ChatCompletionService, |
| 214 | 214 | TextCompletionService, |
| 215 | 215 | updateReasoningUI, |
| 216 | + parseReasoningFromString, | |
| 216 | 217 | unshallowCharacter, |
| 217 | 218 | unshallowGroupMembers, |
| 218 | 219 | }; |