MCPcopy Create free account
hub / github.com/Rfym21/Qwen2API / writeReasoningDelta

Function writeReasoningDelta

src/controllers/chat.js:158–172  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

156 * @param {object} response - 上游响应流
157 * @param {boolean} enable_thinking - 是否启用思考模式
158 * @param {boolean} enable_web_search - 是否启用网络搜索
159 * @param {object} requestBody - 原始请求体,用于提取prompt信息
160 * @param {object} [options] - 扩展选项
161 * @param {boolean} [options.has_tools] - 是否启用工具调用解析
162 * @param {string|Object} [options.tool_choice] - OpenAI tool_choice 控制项
163 */
164/**
165 * 安全累计 stats——任何异常都吞掉,不影响响应给客户端
166 * @param {Object} account - 当前账户对象(含 email)
167 * @param {Object} usage - { prompt_tokens, completion_tokens }
168 */
169const attributeChatUsage = (account, usage) => {
170 if (!account || !account.email || !usage) return
171 try {
172 accountManager.accumulateStats(account.email, 'chat', {
173 input: Number(usage.prompt_tokens) || 0,
174 output: Number(usage.completion_tokens) || 0
175 })

Callers 1

processSSEPayloadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected