当前位置: 首页 > article >正文

企业级AI服务搭建:Xinference-v1.17.1 + SpringBoot实战经验分享

企业级AI服务搭建Xinference-v1.17.1 SpringBoot实战经验分享最近帮几个团队做AI能力集成发现一个挺普遍的现象很多公司想在自己的业务系统里加AI功能但一动手就卡住了。要么是模型部署太复杂要么是服务调用不稳定要么是跟现有微服务架构不兼容。特别是用SpringBoot的团队想找个既稳定又好用的AI推理服务还真不容易。折腾了一圈最后发现Xinference-v1.17.1这个版本跟SpringBoot简直是绝配。它不只是个模型推理工具更像是个AI服务编排平台能很好地融入微服务架构。今天我就把这段时间的实战经验整理出来从架构设计到代码实现一步步带你搞定企业级的AI服务搭建。1. 为什么选Xinference-v1.17.1先说说为什么推荐这个版本。我们之前试过好几个开源推理框架有的部署麻烦有的API不友好有的性能不稳定。Xinference-v1.17.1在1.17.0的基础上做了不少优化对企业级部署特别友好。几个让我觉得不错的地方多引擎支持更完善vLLM、Transformers、Llama.cpp这些引擎都能用你可以根据不同的模型选最合适的引擎。比如对响应速度要求高的用vLLM对内存要求低的用Llama.cpp。分布式部署更稳定支持多副本部署一个GPU上能跑多个模型副本资源利用率直接拉满。我们实测下来同样的硬件能多服务30%的请求。API兼容性特别好完全兼容OpenAI API这意味着SpringBoot集成起来特别简单现有的OpenAI客户端代码几乎不用改。模型管理很省心支持模型缓存、自动下载、版本管理运维压力小了很多。模型更新的时候新版本自动下载老版本还能继续用业务完全无感。最让我满意的是它的RESTful API设计跟微服务架构简直是天生一对。你不用关心模型怎么加载、怎么推理只管调API就行。2. 整体架构怎么设计先看看我们设计的整体架构。这个方案已经在几个生产环境跑了一段时间每天处理几十万次调用稳定性还不错。graph TB subgraph SpringBoot微服务集群 A[用户请求] -- B[API网关] B -- C[业务服务A] B -- D[业务服务B] B -- E[AI服务层] C -- E D -- E E -- F[Xinference客户端] end subgraph Xinference推理集群 F -- G[负载均衡器] G -- H[Xinference Worker 1] G -- I[Xinference Worker 2] G -- J[Xinference Worker N] H -- K[模型A] H -- L[模型B] I -- M[模型C] I -- N[模型D] J -- O[...] end subgraph 基础设施 P[Redis缓存] -- E Q[MySQL数据库] -- C Q -- D R[监控告警] -- H R -- I R -- J end这个架构的核心思想很简单服务分离AI推理服务独立部署不跟业务服务混在一起。这样AI服务挂了不影响业务业务升级也不影响AI。统一接入层所有SpringBoot服务都通过统一的AI服务层调用Xinference代码干净维护方便。弹性扩展Xinference集群可以按需扩缩容流量大了加机器流量小了减机器。故障隔离一个模型挂了不影响其他模型不同业务可以用不同的模型实例。实际用下来这种设计有几个明显的好处业务代码特别干净AI能力可以复用运维管理方便性能也容易监控。3. SpringBoot集成实战下面进入实战环节。我会分步骤讲解怎么在SpringBoot项目里集成Xinference代码都是可以直接用的。3.1 环境准备首先确保你的开发环境已经准备好# 检查Java环境 java -version # 应该输出类似openjdk version 17.0.10 # 检查Maven mvn -version # 应该输出类似Apache Maven 3.9.6 # 检查Docker用于部署Xinference docker --version # 应该输出类似Docker version 24.0.73.2 部署Xinference服务我们先用Docker快速部署一个Xinference服务。这里我推荐用官方的CUDA镜像性能更好。# 拉取镜像 docker pull xprobe/xinference:v1.17.1-cu129 # 运行容器 docker run -d \ --name xinference-server \ --gpus all \ -p 9997:9997 \ -e XINFERENCE_MODEL_SRCmodelscope \ -v /data/xinference/models:/root/.xinference/models \ xprobe/xinference:v1.17.1-cu129 \ xinference-local -H 0.0.0.0参数说明--gpus all使用所有GPU如果只有CPU就去掉这个参数-p 9997:9997暴露API端口后面SpringBoot就通过这个端口调用-e XINFERENCE_MODEL_SRCmodelscope使用ModelScope作为模型源国内访问更快-v /data/xinference/models:/root/.xinference/models挂载模型目录避免重复下载部署完成后访问http://localhost:9997应该能看到Xinference的管理界面。如果看不到检查一下防火墙和端口。3.3 SpringBoot项目配置在SpringBoot项目里我们需要添加一些依赖和配置。pom.xml依赖dependencies !-- SpringBoot基础依赖 -- dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-web/artifactId /dependency !-- HTTP客户端 -- dependency groupIdorg.apache.httpcomponents.client5/groupId artifactIdhttpclient5/artifactId version5.3.1/version /dependency !-- JSON处理 -- dependency groupIdcom.fasterxml.jackson.core/groupId artifactIdjackson-databind/artifactId /dependency !-- 配置管理 -- dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-configuration-processor/artifactId optionaltrue/optional /dependency !-- 连接池 -- dependency groupIdorg.apache.commons/groupId artifactIdcommons-pool2/artifactId /dependency /dependenciesapplication.yml配置xinference: # Xinference服务地址 endpoint: http://localhost:9997 # 连接超时毫秒 connect-timeout: 5000 # 读取超时毫秒 read-timeout: 30000 # 最大连接数 max-connections: 100 # 默认模型配置 default-models: chat: qwen2.5-instruct embedding: bge-large-zh-v1.5 image: qwen-image3.4 核心服务层实现接下来实现AI服务层。这是整个集成的核心负责跟Xinference交互。配置类Configuration ConfigurationProperties(prefix xinference) Data public class XinferenceConfig { private String endpoint; private int connectTimeout 5000; private int readTimeout 30000; private int maxConnections 100; private MapString, String defaultModels new HashMap(); Bean public CloseableHttpClient xinferenceHttpClient() { return HttpClients.custom() .setConnectionManager(new PoolingHttpClientConnectionManager()) .setDefaultRequestConfig(RequestConfig.custom() .setConnectTimeout(connectTimeout) .setSocketTimeout(readTimeout) .build()) .setMaxConnTotal(maxConnections) .build(); } }模型服务接口public interface AIModelService { /** * 文本对话 */ ChatResponse chat(ChatRequest request); /** * 生成文本嵌入 */ ListFloat createEmbedding(String text); /** * 文生图 */ byte[] textToImage(String prompt, ImageConfig config); /** * 获取模型状态 */ ModelStatus getModelStatus(String modelUid); /** * 启动模型 */ String launchModel(ModelLaunchRequest request); }Xinference服务实现Service Slf4j public class XinferenceServiceImpl implements AIModelService { Autowired private CloseableHttpClient httpClient; Value(${xinference.endpoint}) private String endpoint; Value(${xinference.default-models.chat}) private String defaultChatModel; private final ObjectMapper objectMapper new ObjectMapper(); Override public ChatResponse chat(ChatRequest request) { try { // 构建请求体 MapString, Object requestBody new HashMap(); requestBody.put(model, request.getModelUid() ! null ? request.getModelUid() : defaultChatModel); requestBody.put(messages, request.getMessages()); requestBody.put(stream, false); if (request.getMaxTokens() ! null) { requestBody.put(max_tokens, request.getMaxTokens()); } // 调用Xinference API String response post(/v1/chat/completions, requestBody); MapString, Object result objectMapper.readValue(response, Map.class); // 解析响应 ChatResponse chatResponse new ChatResponse(); ListMapString, Object choices (ListMapString, Object) result.get(choices); if (!choices.isEmpty()) { MapString, Object message (MapString, Object) choices.get(0).get(message); chatResponse.setContent((String) message.get(content)); } return chatResponse; } catch (Exception e) { log.error(调用Xinference聊天接口失败, e); throw new RuntimeException(AI服务调用失败, e); } } Override public ListFloat createEmbedding(String text) { try { MapString, Object requestBody new HashMap(); requestBody.put(input, text); String response post(/v1/embeddings, requestBody); MapString, Object result objectMapper.readValue(response, Map.class); ListMapString, Object data (ListMapString, Object) result.get(data); if (!data.isEmpty()) { return (ListFloat) data.get(0).get(embedding); } return Collections.emptyList(); } catch (Exception e) { log.error(生成文本嵌入失败, e); throw new RuntimeException(嵌入生成失败, e); } } private String post(String path, Object body) throws IOException { HttpPost httpPost new HttpPost(endpoint path); httpPost.setHeader(Content-Type, application/json); String jsonBody objectMapper.writeValueAsString(body); httpPost.setEntity(new StringEntity(jsonBody, StandardCharsets.UTF_8)); try (CloseableHttpResponse response httpClient.execute(httpPost)) { int statusCode response.getStatusLine().getStatusCode(); String responseBody EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); if (statusCode 200 statusCode 300) { return responseBody; } else { log.error(Xinference API调用失败状态码{}响应{}, statusCode, responseBody); throw new IOException(API调用失败状态码 statusCode); } } } }3.5 业务层调用示例有了AI服务层业务代码调用就很简单了。下面看几个实际场景的例子。智能客服场景RestController RequestMapping(/api/customer-service) public class CustomerServiceController { Autowired private AIModelService aiModelService; PostMapping(/chat) public ResponseEntityMapString, Object handleCustomerQuery( RequestBody CustomerQueryRequest request) { // 构建对话消息 ListMapString, Object messages new ArrayList(); messages.add(Map.of( role, system, content, 你是一个专业的客服助手请用友好、专业的态度回答用户问题。 )); messages.add(Map.of( role, user, content, request.getQuestion() )); // 调用AI服务 ChatRequest chatRequest new ChatRequest(); chatRequest.setMessages(messages); chatRequest.setMaxTokens(500); ChatResponse response aiModelService.chat(chatRequest); // 记录对话历史 saveConversationHistory(request.getUserId(), request.getQuestion(), response.getContent()); return ResponseEntity.ok(Map.of( success, true, answer, response.getContent(), timestamp, System.currentTimeMillis() )); } private void saveConversationHistory(String userId, String question, String answer) { // 保存到数据库的逻辑 log.info(保存用户对话历史用户{}, 问题{}, 回答长度{}, userId, question, answer.length()); } }内容生成场景Service public class ContentGenerationService { Autowired private AIModelService aiModelService; /** * 生成商品描述 */ public String generateProductDescription(ProductInfo product) { String prompt String.format( 请为以下商品生成一段吸引人的描述\n 商品名称%s\n 主要特点%s\n 目标人群%s\n 要求描述要生动有趣突出商品优势适合在电商平台展示。, product.getName(), String.join(、, product.getFeatures()), product.getTargetAudience() ); ListMapString, Object messages new ArrayList(); messages.add(Map.of(role, user, content, prompt)); ChatRequest request new ChatRequest(); request.setMessages(messages); request.setMaxTokens(300); ChatResponse response aiModelService.chat(request); return response.getContent(); } /** * 生成营销文案 */ public ListString generateMarketingCopy(String productName, String keySellingPoints) { ListString copies new ArrayList(); // 生成多个版本的文案 String[] tones {专业正式, 活泼有趣, 简洁直接}; for (String tone : tones) { String prompt String.format( 请以%s的风格为商品%s写一段营销文案。\n 商品卖点%s\n 文案要求吸引眼球突出价值引导购买。, tone, productName, keySellingPoints ); ListMapString, Object messages new ArrayList(); messages.add(Map.of(role, user, content, prompt)); ChatRequest request new ChatRequest(); request.setMessages(messages); request.setMaxTokens(200); ChatResponse response aiModelService.chat(request); copies.add(response.getContent()); } return copies; } }4. 高级特性与优化基础集成搞定后我们来看看怎么优化和扩展。这些都是在实际项目中踩过坑总结出来的经验。4.1 连接池与超时优化微服务环境下网络调用要特别注意性能。这里分享几个优化点Configuration public class HttpClientConfig { Bean public CloseableHttpClient xinferenceHttpClient(XinferenceConfig config) { // 连接池配置 PoolingHttpClientConnectionManager connectionManager new PoolingHttpClientConnectionManager(); connectionManager.setMaxTotal(config.getMaxConnections()); connectionManager.setDefaultMaxPerRoute(20); // 请求配置 RequestConfig requestConfig RequestConfig.custom() .setConnectTimeout(config.getConnectTimeout()) .setSocketTimeout(config.getReadTimeout()) .setConnectionRequestTimeout(3000) // 从连接池获取连接的超时 .build(); // 重试策略 HttpRequestRetryStrategy retryStrategy new DefaultHttpRequestRetryStrategy( 3, TimeValue.ofSeconds(1)); return HttpClients.custom() .setConnectionManager(connectionManager) .setDefaultRequestConfig(requestConfig) .setRetryStrategy(retryStrategy) .setKeepAliveStrategy((response, context) - 30 * 1000) // 30秒保活 .build(); } }4.2 熔断与降级AI服务可能不稳定需要做好熔断降级。我们用的是Resilience4j效果不错Service Slf4j public class ResilientAIModelService implements AIModelService { Autowired private AIModelService delegate; // 使用Resilience4j做熔断 private final CircuitBreaker circuitBreaker; private final RateLimiter rateLimiter; public ResilientAIModelService() { CircuitBreakerConfig circuitBreakerConfig CircuitBreakerConfig.custom() .failureRateThreshold(50) // 失败率阈值50% .waitDurationInOpenState(Duration.ofSeconds(30)) // 熔断30秒 .slidingWindowSize(10) // 最近10次调用 .build(); circuitBreaker CircuitBreaker.of(xinference-circuit, circuitBreakerConfig); RateLimiterConfig rateLimiterConfig RateLimiterConfig.custom() .limitForPeriod(10) // 每秒10个请求 .limitRefreshPeriod(Duration.ofSeconds(1)) .timeoutDuration(Duration.ofMillis(500)) // 等待超时500ms .build(); rateLimiter RateLimiter.of(xinference-rate, rateLimiterConfig); } Override public ChatResponse chat(ChatRequest request) { return CircuitBreaker.decorateSupplier(circuitBreaker, RateLimiter.decorateSupplier(rateLimiter, () - { try { return delegate.chat(request); } catch (Exception e) { // 降级逻辑返回默认回复 log.warn(AI服务调用失败使用降级回复, e); return getFallbackResponse(); } })).get(); } private ChatResponse getFallbackResponse() { ChatResponse response new ChatResponse(); response.setContent(抱歉AI服务暂时不可用请稍后再试。); return response; } }4.3 异步调用与批量处理对于不要求实时响应的场景可以用异步调用提升吞吐量。比如批量生成商品描述Service public class AsyncAIService { Autowired private AIModelService aiModelService; Autowired private ThreadPoolTaskExecutor taskExecutor; /** * 批量生成文本嵌入 */ public CompletableFutureListListFloat batchCreateEmbeddings(ListString texts) { ListCompletableFutureListFloat futures texts.stream() .map(text - CompletableFuture.supplyAsync( () - aiModelService.createEmbedding(text), taskExecutor )) .collect(Collectors.toList()); return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])) .thenApply(v - futures.stream() .map(CompletableFuture::join) .collect(Collectors.toList())); } /** * 并行处理多个对话请求 */ public MapString, ChatResponse parallelChat(ListChatRequest requests) { MapString, CompletableFutureChatResponse futures new HashMap(); for (ChatRequest request : requests) { String requestId UUID.randomUUID().toString(); futures.put(requestId, CompletableFuture.supplyAsync( () - aiModelService.chat(request), taskExecutor )); } // 等待所有请求完成 CompletableFuture.allOf(futures.values().toArray(new CompletableFuture[0])).join(); // 收集结果 MapString, ChatResponse results new HashMap(); futures.forEach((requestId, future) - { try { results.put(requestId, future.get()); } catch (Exception e) { log.error(处理请求失败{}, requestId, e); results.put(requestId, new ChatResponse()); } }); return results; } }4.4 监控与日志生产环境必须做好监控。这里给出一个简单的监控方案Aspect Component Slf4j public class AIMonitoringAspect { private final MeterRegistry meterRegistry; public AIMonitoringAspect(MeterRegistry meterRegistry) { this.meterRegistry meterRegistry; } Around(execution(* com.example.service.AIModelService.*(..))) public Object monitorAICalls(ProceedingJoinPoint joinPoint) throws Throwable { String methodName joinPoint.getSignature().getName(); long startTime System.currentTimeMillis(); try { Object result joinPoint.proceed(); long duration System.currentTimeMillis() - startTime; // 记录指标 meterRegistry.timer(ai.service.duration, method, methodName) .record(duration, TimeUnit.MILLISECONDS); meterRegistry.counter(ai.service.calls, method, methodName, status, success) .increment(); log.info(AI服务调用成功方法{}, 耗时{}ms, methodName, duration); return result; } catch (Exception e) { long duration System.currentTimeMillis() - startTime; meterRegistry.timer(ai.service.duration, method, methodName) .record(duration, TimeUnit.MILLISECONDS); meterRegistry.counter(ai.service.calls, method, methodName, status, error) .increment(); log.error(AI服务调用失败方法{}, 耗时{}ms, methodName, duration, e); throw e; } } }5. 生产环境部署建议最后分享一些生产环境的部署经验。这些都是从实际项目中总结出来的能帮你少走很多弯路。5.1 高可用部署架构# docker-compose.prod.yml version: 3.8 services: # Xinference集群 xinference-master: image: xprobe/xinference:v1.17.1-cu129 command: xinference-local -H 0.0.0.0 --log-level INFO ports: - 9997:9997 environment: - XINFERENCE_MODEL_SRCmodelscope - XINFERENCE_HEALTH_CHECK_INTERVAL30 volumes: - xinference-models:/root/.xinference/models - xinference-logs:/root/.xinference/logs deploy: replicas: 1 restart_policy: condition: on-failure xinference-worker-1: image: xprobe/xinference:v1.17.1-cu129 command: xinference-worker --endpoint http://xinference-master:9997 environment: - CUDA_VISIBLE_DEVICES0 deploy: replicas: 2 restart_policy: condition: on-failure xinference-worker-2: image: xprobe/xinference:v1.17.1-cu129 command: xinference-worker --endpoint http://xinference-master:9997 environment: - CUDA_VISIBLE_DEVICES1 deploy: replicas: 2 restart_policy: condition: on-failure # SpringBoot应用 springboot-app: build: . ports: - 8080:8080 environment: - XINFERENCE_ENDPOINThttp://xinference-master:9997 - SPRING_PROFILES_ACTIVEprod depends_on: - xinference-master deploy: replicas: 3 restart_policy: condition: on-failure # 监控 prometheus: image: prom/prometheus:latest ports: - 9090:9090 volumes: - ./prometheus.yml:/etc/prometheus/prometheus.yml grafana: image: grafana/grafana:latest ports: - 3000:3000 environment: - GF_SECURITY_ADMIN_PASSWORDadmin volumes: xinference-models: xinference-logs:5.2 性能调优参数Configuration public class PerformanceConfig { Bean public XinferenceConfig xinferenceConfig() { XinferenceConfig config new XinferenceConfig(); config.setEndpoint(http://xinference-master:9997); // 根据业务特点调整超时 if (isInternalNetwork()) { // 内网环境可以设置较短的超时 config.setConnectTimeout(2000); config.setReadTimeout(10000); } else { // 公网环境需要更长的超时 config.setConnectTimeout(5000); config.setReadTimeout(30000); } // 根据并发量调整连接数 int expectedConcurrentRequests 100; // 预估的并发请求数 config.setMaxConnections(Math.max(50, expectedConcurrentRequests * 2)); return config; } Bean public ThreadPoolTaskExecutor aiTaskExecutor() { ThreadPoolTaskExecutor executor new ThreadPoolTaskExecutor(); // 核心线程数 CPU核心数 * 2 int corePoolSize Runtime.getRuntime().availableProcessors() * 2; executor.setCorePoolSize(corePoolSize); // 最大线程数根据业务特点调整 executor.setMaxPoolSize(corePoolSize * 4); // 队列容量 executor.setQueueCapacity(1000); // 线程名前缀 executor.setThreadNamePrefix(ai-executor-); // 拒绝策略调用者运行 executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); executor.initialize(); return executor; } private boolean isInternalNetwork() { // 判断是否为内网环境的逻辑 return true; } }5.3 安全考虑Configuration EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { Override protected void configure(HttpSecurity http) throws Exception { http // AI API需要认证 .authorizeRequests() .antMatchers(/api/ai/**).authenticated() .anyRequest().permitAll() .and() .httpBasic() .and() .csrf().disable(); } Bean public FilterRegistrationBeanXinferenceAuthFilter xinferenceAuthFilter() { FilterRegistrationBeanXinferenceAuthFilter registration new FilterRegistrationBean(); registration.setFilter(new XinferenceAuthFilter()); registration.addUrlPatterns(/api/ai/*); registration.setOrder(1); return registration; } } Component Slf4j public class XinferenceAuthFilter extends OncePerRequestFilter { Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { // 检查API密钥 String apiKey request.getHeader(X-API-Key); if (!isValidApiKey(apiKey)) { log.warn(无效的API密钥访问{}, request.getRequestURI()); response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); response.getWriter().write({\error\: \Invalid API key\}); return; } // 检查访问频率 String clientIp request.getRemoteAddr(); if (isRateLimited(clientIp)) { log.warn(访问频率超限{}, clientIp); response.setStatus(HttpServletResponse.SC_TOO_MANY_REQUESTS); response.getWriter().write({\error\: \Rate limit exceeded\}); return; } filterChain.doFilter(request, response); } private boolean isValidApiKey(String apiKey) { // 验证API密钥的逻辑 return apiKey ! null apiKey.startsWith(sk-); } private boolean isRateLimited(String clientIp) { // 限流逻辑可以使用Redis实现 return false; } }6. 总结把Xinference-v1.17.1集成到SpringBoot微服务里技术上不算复杂但要做好确实需要一些经验。关键是要理解微服务架构的特点设计出合理的服务边界和调用方式。从实际项目经验来看这种集成方案有几个明显优势开发效率高业务团队不用关心AI底层实现只管调API就行运维方便模型服务可以独立管理升级维护不影响业务扩展性好可以根据业务需求灵活调整流量大了加机器就行成本可控按需使用模型资源利用率高当然每个企业的业务场景不同具体实现时还需要根据实际情况调整。比如有的场景对实时性要求高可能需要更短的超时设置有的场景数据量大可能需要优化批量处理逻辑有的场景对安全性要求高可能需要更严格的访问控制。整体来说Xinference-v1.17.1的稳定性和功能完整性都值得信赖跟SpringBoot的集成也很顺畅。如果你正在考虑在微服务架构里加入AI能力这个方案值得一试。从我们的实践来看这套方案能支撑日均百万级的调用量响应时间稳定在几百毫秒级别完全能满足大多数企业的需求。获取更多AI镜像想探索更多AI镜像和应用场景访问 CSDN星图镜像广场提供丰富的预置镜像覆盖大模型推理、图像生成、视频生成、模型微调等多个领域支持一键部署。

相关文章:

企业级AI服务搭建:Xinference-v1.17.1 + SpringBoot实战经验分享

企业级AI服务搭建:Xinference-v1.17.1 SpringBoot实战经验分享 最近帮几个团队做AI能力集成,发现一个挺普遍的现象:很多公司想在自己的业务系统里加AI功能,但一动手就卡住了。要么是模型部署太复杂,要么是服务调用不…...

Flutter 三方库 protect 的鸿蒙化适配指南 - 敏感数据脱敏艺术、构建鸿蒙级的隐私防护堤坝、守护 App 数据安全的最后一公里

欢迎加入开源鸿蒙跨平台社区:https://openharmonycrossplatform.csdn.net Flutter 三方库 protect 的鸿蒙化适配指南 - 敏感数据脱敏艺术、构建鸿蒙级的隐私防护堤坝、守护 App 数据安全的最后一公里 在鸿蒙(OpenHarmony)应用开发中&#x…...

Flutter 三方库 zodart 的鸿蒙化适配指南 - 模式驱动的数据校验艺术、强类型的运行时防线、打造稳如泰山的鸿蒙端数据层

欢迎加入开源鸿蒙跨平台社区:https://openharmonycrossplatform.csdn.net Flutter 三方库 zodart 的鸿蒙化适配指南 - 模式驱动的数据校验艺术、强类型的运行时防线、打造稳如泰山的鸿蒙端数据层 在鸿蒙(OpenHarmony)应用开发中&#xff0c…...

linux文件快速传windows

目录 先 CtrlC 停掉 scp&#xff0c;然后在 Linux 上&#xff1a; cd ~/Software/xxx_vla_train python -m http.server 8080再查一下 Linux 的 IP&#xff1a; hostname -I然后在 Windows 浏览器里输入 http://<Linux的IP>:8080&#xff0c;直接点击下载 lerobot_source…...

conda特定环境打包

目录1️⃣ conda pack2️⃣ -n lerobot3️⃣ -o ~/lerobot_env.tar.gz4️⃣ --ignore-editable-packages5️⃣ 命令整体意思6️⃣ 打包后的典型使用流程① 打包② 复制到另一台机器③ 解压④ 修复路径7️⃣ 最终使用这条命令是 把一个 Conda 环境打包成一个压缩文件&#xff0c…...

你的 OpenClaw 也在偷偷烧钱吗?用 APMPlus 把成本看明白

作为现象级的开源 AI Agent 项目&#xff0c;OpenClaw 正凭借强大的自主执行能力&#xff0c;迅速成为能操作文件、调用系统命令、控制浏览器的“数字员工”。但用得好是生产力&#xff0c;用不好可能就是个“烧钱黑洞”。 一位开发者近期分享了自己的经历&#xff1a;他配置了…...

实战应用:利用快马平台开发带登录验证的clawcode论坛爬虫

最近在做一个数据采集项目&#xff0c;需要从一个技术论坛抓取用户的历史发帖数据&#xff0c;用于分析社区活跃度。这个论坛需要登录才能访问个人主页&#xff0c;而且有一定的基础反爬措施。我决定用 Python 来写这个爬虫&#xff0c;并给它起了个名字叫“clawcode”。整个开…...

构建企业级QQ机器人:基于go-cqhttp的全场景解决方案

构建企业级QQ机器人&#xff1a;基于go-cqhttp的全场景解决方案 【免费下载链接】go-cqhttp cqhttp的golang实现&#xff0c;轻量、原生跨平台. 项目地址: https://gitcode.com/gh_mirrors/go/go-cqhttp go-cqhttp是一款基于Golang开发的轻量级QQ机器人框架&#xff0c;…...

STM32 SMBus超时/PEC/唤醒/中断全栈工程实践

STM32 I2C 深度解析&#xff1a;SMBus 超时机制、PEC 校验、低功耗唤醒与中断工程实践I2C&#xff08;Inter-Integrated Circuit&#xff09;作为嵌入式系统中最基础、最广泛使用的同步串行总线协议&#xff0c;其在工业控制、传感器网络、电源管理等场景中承担着关键的数据交换…...

GLM-4.7-Flash效果展示:多轮中文对话连贯性、逻辑严谨性真实案例分享

GLM-4.7-Flash效果展示&#xff1a;多轮中文对话连贯性、逻辑严谨性真实案例分享 最近&#xff0c;智谱AI推出的GLM-4.7-Flash模型在开源社区里引起了不小的讨论。大家都在说它的中文对话能力很强&#xff0c;尤其是多轮对话的连贯性和逻辑性&#xff0c;听起来很厉害。但模型…...

Jimeng LoRA惊艳效果:dreamlike quality在水墨风与数字艺术融合表现

Jimeng LoRA惊艳效果&#xff1a;dreamlike quality在水墨风与数字艺术融合表现 1. 项目简介&#xff1a;一个高效的LoRA效果测试台 如果你玩过AI绘画&#xff0c;尤其是Stable Diffusion&#xff0c;那你一定对LoRA不陌生。简单来说&#xff0c;LoRA就像是一个“风格滤镜包”…...

突破电视交互边界:TV Bro浏览器的沉浸式大屏体验

突破电视交互边界&#xff1a;TV Bro浏览器的沉浸式大屏体验 【免费下载链接】tv-bro Simple web browser for android optimized to use with TV remote 项目地址: https://gitcode.com/gh_mirrors/tv/tv-bro TV Bro是一款专为智能电视打造的开源网页浏览器&#xff0c…...

智能电视交互新标杆:TV Bro大屏浏览解决方案

智能电视交互新标杆&#xff1a;TV Bro大屏浏览解决方案 【免费下载链接】tv-bro Simple web browser for android optimized to use with TV remote 项目地址: https://gitcode.com/gh_mirrors/tv/tv-bro 当你在沙发上想查菜谱却不得不拿起手机时&#xff0c;当孩子想在…...

VibeVoice语音系统行业应用:视频配音与有声书制作方案

VibeVoice语音系统行业应用&#xff1a;视频配音与有声书制作方案 1. 引言&#xff1a;语音合成技术的实际价值 在内容创作蓬勃发展的今天&#xff0c;视频和有声内容已经成为人们获取信息和娱乐的重要方式。无论是短视频平台的快速崛起&#xff0c;还是有声书市场的持续增长…...

Z-Image-Turbo_Sugar脸部Lora部署教程:从镜像拉取、端口映射到域名反代完整指南

Z-Image-Turbo_Sugar脸部Lora部署教程&#xff1a;从镜像拉取、端口映射到域名反代完整指南 1. 教程概述 今天给大家带来一个特别实用的教程——如何快速部署Z-Image-Turbo_Sugar脸部Lora模型。这是一个专门用于生成甜美风格人像的AI模型&#xff0c;基于Z-Image-Turbo的Lora…...

Anything to RealCharacters 2.5D引擎在C语言基础教学中的应用

Anything to RealCharacters 2.5D引擎在C语言基础教学中的应用 1. 引言&#xff1a;当编程教学遇上AI图像引擎 记得我刚开始学C语言的时候&#xff0c;最头疼的就是那些抽象的概念和枯燥的代码练习。指针、内存管理、数据结构……这些概念对初学者来说就像天书一样难懂。但现…...

OFA-SNLI-VE模型效果展示:‘there are’与‘there is’语法敏感性

OFA-SNLI-VE模型效果展示&#xff1a;‘there are’与‘there is’语法敏感性 1. 模型效果惊艳展示 OFA-SNLI-VE模型在视觉蕴含任务中展现出了令人印象深刻的语言理解能力&#xff0c;特别是在英语语法细节的敏感性方面。这个基于阿里巴巴达摩院OFA架构的模型&#xff0c;不仅…...

CSDN技术博客配图自动化:丹青幻境根据文章内容智能生成头图

CSDN技术博客配图自动化&#xff1a;丹青幻境根据文章内容智能生成头图 每次写完一篇技术博客&#xff0c;你是不是也卡在了最后一步——找一张合适的封面图&#xff1f; 要么是图库里的图片太普通&#xff0c;和文章内容不搭&#xff1b;要么是好看的图片版权不明&#xff0…...

NST1001温度传感器实战:从硬件连接到温度计算全解析

1. 认识NST1001&#xff1a;一个“会说话”的温度计 大家好&#xff0c;我是老张&#xff0c;在嵌入式这行摸爬滚打十几年了&#xff0c;玩过的传感器少说也有上百种。今天想和大家聊聊一个特别有意思的小玩意儿——NST1001温度传感器。你可能听说过DS18B20&#xff0c;也用过D…...

CosyVoice语音生成大模型-300M-25Hz环境清理:C盘空间优化与依赖管理

CosyVoice语音生成大模型-300M-25Hz环境清理&#xff1a;C盘空间优化与依赖管理 你是不是也遇到过这种情况&#xff1f;兴致勃勃地在Windows电脑上部署了CosyVoice语音生成模型&#xff0c;准备大展身手&#xff0c;结果没玩几天&#xff0c;C盘就亮起了刺眼的红色警告&#x…...

AIVideo实战教程:AI自动为长视频添加关键帧标记与章节导航菜单

AIVideo实战教程&#xff1a;AI自动为长视频添加关键帧标记与章节导航菜单 1. 引言&#xff1a;为什么需要智能视频标记功能&#xff1f; 你有没有遇到过这样的情况&#xff1a;制作了一个精彩的长视频&#xff0c;观众却因为找不到重点内容而流失&#xff1f;或者想要回看某…...

SmallThinker-3B-Preview一键部署与GitHub源码管理联动实践

SmallThinker-3B-Preview一键部署与GitHub源码管理联动实践 最近在星图GPU平台上部署了SmallThinker-3B-Preview模型&#xff0c;整个过程确实挺顺畅的&#xff0c;一键部署的体验没得说。但用了一段时间后&#xff0c;我发现了一个小麻烦&#xff1a;每次想调整一下启动参数&…...

深入解析iperf:从基础命令到高级网络性能测试

1. 从零认识iperf&#xff1a;你的网络“听诊器” 如果你曾经遇到过网络卡顿、视频会议断断续续&#xff0c;或者文件传输慢得像蜗牛&#xff0c;心里肯定犯嘀咕&#xff1a;到底是我的网线不行&#xff0c;还是路由器该换了&#xff0c;或者是运营商在“偷懒”&#xff1f;这时…...

Cesium海量点数据渲染实战:从数据格式到性能调优的完整指南

1. 海量点数据渲染&#xff1a;从“卡死”到“丝滑”的必经之路 刚接触Cesium那会儿&#xff0c;我接过一个智慧园区项目&#xff0c;需要在三维地图上展示所有摄像头、消防栓、停车位的位置。数据量不大&#xff0c;也就几千个点&#xff0c;我二话不说&#xff0c;直接上Enti…...

【CISCN 2024 AWDP】从源码泄露到WAF绕过:实战剖析三道典型Web赛题攻防思路

1. 从源码泄露到逻辑漏洞&#xff1a;实战复盘“粗心的程序员” 大家好&#xff0c;我是老张&#xff0c;一个在安全圈摸爬滚打了十来年的老兵。刚打完今年的CISCN区域赛AWDP场&#xff0c;趁着记忆还热乎&#xff0c;想和大家聊聊几道印象深刻的Web题。AWDP这赛制&#xff0c;…...

Pixai.art:探索AI绘画与漫画生成的多语言创意之旅

1. 从“词不达意”到“心想事成”&#xff1a;Pixai.art如何用多语言解锁你的创意 不知道你有没有过这样的经历&#xff1f;脑子里有一个绝妙的画面&#xff0c;但当你试图用文字描述给朋友&#xff0c;或者输入到某个AI绘画工具时&#xff0c;却发现怎么都说不清楚。尤其是当你…...

6 个 Linux 基础指令的硬核拆解,原理 + 实操一次吃透!

一. pwd&#xff1a;Linux里的 "定位神器"我们刚打开Linux终端时&#xff0c;是不是常常回困惑"当前在哪里&#xff1f;"pwd就是来解决这个问题的--它的核心作用就是显示你当前所在的绝对路径。代码语言&#xff1a;javascriptAI代码解释[rootVM-4-4-cento…...

Local AI MusicGen一键部署教程:3步搭建Linux本地音乐生成环境

Local AI MusicGen一键部署教程&#xff1a;3步搭建Linux本地音乐生成环境 1. 为什么你需要本地运行MusicGen 你有没有试过在网页上点几下就生成一段背景音乐&#xff0c;结果等了两分钟&#xff0c;出来的音频还带着水印&#xff1f;或者想给游戏项目配个专属BGM&#xff0c…...

亚洲美女-造相Z-Turbo镜像合规认证:通过ISO/IEC 27001信息安全管理初步评估要点

亚洲美女-造相Z-Turbo镜像合规认证&#xff1a;通过ISO/IEC 27001信息安全管理初步评估要点 1. 镜像概述与部署说明 亚洲美女-造相Z-Turbo是基于Z-Image-Turbo模型的LoRA版本&#xff0c;专门针对生成亚洲风格美女图片进行了优化训练。该镜像通过Xinference框架进行部署&…...

动态中枢识别技术突破:解决缠论分析效率瓶颈的实战指南

动态中枢识别技术突破&#xff1a;解决缠论分析效率瓶颈的实战指南 【免费下载链接】Indicator 通达信缠论可视化分析插件 项目地址: https://gitcode.com/gh_mirrors/ind/Indicator 一、解构行业痛点&#xff1a;传统缠论分析的技术瓶颈何在&#xff1f; 剖析人工分析…...