Apply regex to multiswipe reasoning, set reasoning_type to Parsed
| @@ -1107,8 +1107,12 @@ function parseReasoningFromString(str, { strict = true } = {}) { | ||
| 1107 | 1107 | /** |
| 1108 | 1108 | * Parse reasoning in an array of swipe strings if auto-parsing is enabled. |
| 1109 | 1109 | * @param {string[]} swipes Array of swipe strings |
| 1110 | 1110 | * @param {{extra: {reasoning: string, reasoning_duration: number}ReasoningMessageExtra}[]} swipeInfoArray Array of swipe info objects |
| 1111 | 1111 | * @param {number?} duration Duration of the reasoning |
| 1112 | + * @typedef {object} ReasoningMessageExtra Extra reasoning data | |
| 1113 | + * @property {string} reasoning Reasoning block | |
| 1114 | + * @property {number} reasoning_duration Duration of the reasoning block | |
| 1115 | + * @property {string} reasoning_type Type of reasoning block | |
| 1112 | 1116 | */ |
| 1113 | 1117 | export function parseReasoningInSwipes(swipes, swipeInfoArray, duration) { |
| 1114 | 1118 | if (!power_user.reasoning.auto_parse) { |
| @@ -1123,9 +1127,10 @@ export function parseReasoningInSwipes(swipes, swipeInfoArray, duration) { | ||
| 1123 | 1127 | for (let index = 0; index < swipes.length; index++) { |
| 1124 | 1128 | const parsedReasoning = parseReasoningFromString(swipes[index]); |
| 1125 | 1129 | if (parsedReasoning) { |
| 1126 | 1130 | swipes[index] = getRegexedString(parsedReasoning.content, regex_placement.REASONING); |
| 1127 | 1131 | swipeInfoArray[index].extra.reasoning = parsedReasoning.reasoning; |
| 1128 | 1132 | swipeInfoArray[index].extra.reasoning_duration = duration; |
| 1133 | + swipeInfoArray[index].extra.reasoning_type = ReasoningType.Parsed; | |
| 1129 | 1134 | } |
| 1130 | 1135 | } |
| 1131 | 1136 | } |