CSDN帐号管理规范_csdn账号怎么禁止发评论

发布时间: 2026-07-03 · 来源: 数码产品评测 · 阅读量: 4853
business image 1 digital image 2

官方数据显示,截至目前,“小团”的信息服务已覆盖全国2800多个城市,累计完成超过7亿次商家信息校验,收录用户评价超过13亿条。

问什么是桔梗_千问健康桔梗是可以宣肺止咳,利咽化痰等清热解毒的功效的。应注意合理的对症用药比较好的。

知识库不是一次性文档工程。业务会变,代码会变,指标口径会变,排查经验也会更新。知识库必须支持新增、补全、修订、拆分、合并、归档和复核。

真正的原因是容器。这个文件第一帧的 DTS 是负的(B 帧重排很常见,首帧的解码时间戳会落在 0 之前一点点)。

Reflection.Emit) 动态代理、表达式树编译受限 用 System.

在地缘政治方面,关于伊朗的头条新闻也依然令人感到厌烦且困惑——特朗普表示:谈判要么快速推进,要么免谈。

Ant Design 6.5.2 现已发布,主要更新内容如下: 修复 Button、Collapse、ColorPicker、Layout、Select、Space.

import OpenAI from 'openai'import type { LlmConfig, ChatMessage } from '../types'import { LLM_CONFIG } from '../constants'class LlmService { private openai: OpenAI | null = null private currentApiKey: string = '' private initClient(config: LlmConfig): void { if (this.currentApiKey === config.apiKey && this.openai) { return // 避免重复初始化 } const baseURL = config.baseURL || LLM_CONFIG.BASE_URL this.openai = new OpenAI({ apiKey: config.apiKey, dangerouslyAllowBrowser: true, // 允许浏览器端调用 baseURL: baseURL, // 确保使用 fetch API 支持流式 fetch: (url, init) => { console.log('LLM请求URL:', url) console.log('LLM请求配置:', { method: init?.method, headers: init?.headers, body: init?.body }) return fetch(url, init) } }) this.currentApiKey = config.apiKey } // 普通对话模式 async sendMessage(config: LlmConfig, userMessage: string): Promise { this.initClient(config) if (!this.openai) { throw new Error('LLM客户端未初始化') } const messages: ChatMessage[] = [ { role: 'system', content: LLM_CONFIG.SYSTEM_PROMPT }, { role: 'user', content: userMessage } ] try { const completion = await this.openai.chat.completions.create({ messages, model: config.model }) const response = completion.choices[0]?.message?.content return response || null } catch (error) { console.error('LLM请求失败:', error) throw error } } // 流式对话模式(核心) async sendMessageWithStream(config: LlmConfig, userMessage: string): Promise { this.initClient(config) if (!this.openai) { throw new Error('LLM客户端未初始化') } const messages: ChatMessage[] = [ { role: 'system', content: LLM_CONFIG.SYSTEM_PROMPT }, { role: 'user', content: userMessage } ] try { const stream = await this.openai.chat.completions.create({ messages, model: config.model, stream: true // 开启流式输出 }) // 返回异步迭代器,逐字输出 return (async function* () { let chunkCount = 0 for await (const part of stream) { chunkCount++ const content = part.choices[0]?.delta?.content if (content) { yield content } } })() } catch (error) { console.error('流式请求失败:', error) throw error } }}export const llmService = new LlmService()设计要点:dangerouslyAllowBrowser: true:允许在浏览器端直接调用 LLM API,适用于 Demo 场景自定义 fetch:拦截请求用于日志追踪,便于调试流式数据sendMessageWithStream 返回 AsyncIterable:调用方可通过 for await 逐字消费,实现流式播报API Key 缓存:currentApiKey 避免重复初始化 OpenAI 客户端4.5 action-manager.ts - 流式播报动作队列流式播报是灵引的核心交互机制。当 LLM 流式返回文本时,需要将文本分段发送给数字人 SDK 进行语音合成和动作驱动。ActionManager 通过队列模式管理这些播报段落,确保按顺序播放。

配图