feat(assist): сбор usage-токенов и отдача в meta (время этапов уже было)
This commit is contained in:
@@ -229,6 +229,7 @@ function hasHeader(text, header) {
|
||||
* @param {string} [params.model]
|
||||
* @param {number} [params.maxTokens]
|
||||
* @param {AbortController} [params.controller]
|
||||
* @param {object} [params.usageRef]
|
||||
* @returns {Promise<{ok:true, answer:string} | {ok:false, error:string}>}
|
||||
*/
|
||||
async function stage2Generate({
|
||||
@@ -239,6 +240,7 @@ async function stage2Generate({
|
||||
model = process.env.LLM_MODEL || DEFAULT_MODEL,
|
||||
maxTokens = 2048,
|
||||
controller,
|
||||
usageRef,
|
||||
}) {
|
||||
const docsBlock = context
|
||||
.map((c, i) => `[${i + 1}] ${c.title}\n${c.text}`)
|
||||
@@ -270,6 +272,7 @@ async function stage2Generate({
|
||||
baseUrl,
|
||||
apiKey,
|
||||
model,
|
||||
usageRef,
|
||||
});
|
||||
} catch (err) {
|
||||
const code = err && err.code ? err.code : 'stage2_failed';
|
||||
|
||||
Reference in New Issue
Block a user