{"id":77121,"date":"2026-02-23T23:41:40","date_gmt":"2026-02-23T15:41:40","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/77121.html"},"modified":"2026-02-23T23:41:40","modified_gmt":"2026-02-23T15:41:40","slug":"ai%e5%ba%94%e7%94%a8%e5%af%b9%e8%af%9d%e7%94%9f%e6%88%90%e7%9a%84%e5%ae%89%e5%85%a8%e6%80%a7%e4%bc%98%e5%8c%96","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/77121.html","title":{"rendered":"AI\u5e94\u7528\u5bf9\u8bdd\u751f\u6210\u7684\u5b89\u5168\u6027\u4f18\u5316"},"content":{"rendered":"<h2 style=\"background-color:transparent\">\u6d41\u91cf\u4fdd\u62a4<\/h2>\n<p id=\"u3645d53c\">AI\u5bf9\u8bdd\u63a5\u53e3\u662f\u91cd\u8981\u529f\u80fd\u6210\u672c\u6700\u9ad8&#xff0c;\u4f7f\u7528Redisson\u5206\u5e03\u5f0f\u9650\u6d41\u6765\u9632\u6b62\u6076\u610f\u653b\u51fb\u548c\u8d44\u6e90\u6ee5\u7528\u3002<\/p>\n<p id=\"u1fefe019\">\u9996\u5148\u5f15\u5165Redisson\u4f9d\u8d56&#xff1a;<\/p>\n<p>&lt;!&#8211; Spring Session &#043; Redis &#8211;&gt;<br \/>\n&lt;dependency&gt;<br \/>\n    &lt;groupId&gt;org.springframework.session&lt;\/groupId&gt;<br \/>\n    &lt;artifactId&gt;spring-session-data-redis&lt;\/artifactId&gt;<br \/>\n&lt;\/dependency&gt;<br \/>\n&lt;!&#8211; Redisson &#8211;&gt;<br \/>\n&lt;dependency&gt;<br \/>\n  &lt;groupId&gt;org.redisson&lt;\/groupId&gt;<br \/>\n  &lt;artifactId&gt;redisson&lt;\/artifactId&gt;<br \/>\n  &lt;version&gt;3.50.0&lt;\/version&gt;<br \/>\n&lt;\/dependency&gt; <\/p>\n<p id=\"u9afbef0c\">\u914d\u7f6eapplication&#xff1a;<\/p>\n<p># redis<br \/>\nspring:<br \/>\n  data:<br \/>\n    redis:<br \/>\n      host: localhost<br \/>\n      port: 6379<br \/>\n      ttl: 3600<br \/>\n      database: 0<br \/>\n      password: <\/p>\n<p id=\"ub5b0cf67\">\u7f16\u5199Redisson\u914d\u7f6e&#xff1a;<\/p>\n<p>&#064;Configuration<br \/>\npublic class RedissonConfig {<br \/>\n    &#064;Value(&#034;${spring.data.redis.host}&#034;)<br \/>\n    private String redisHost;<\/p>\n<p>    &#064;Value(&#034;${spring.data.redis.port}&#034;)<br \/>\n    private int redisPort;<\/p>\n<p>    &#064;Value(&#034;${spring.data.redis.password}&#034;)<br \/>\n    private String redisPassword;<\/p>\n<p>    &#064;Value(&#034;${spring.data.redis.database}&#034;)<br \/>\n    private int redisDataBase;<\/p>\n<p>    &#064;Bean<br \/>\n    public RedissonClient redissonClient() {<br \/>\n        Config config &#061; new Config();<br \/>\n        String address &#061; &#034;redis:\/\/&#034; &#043; redisHost &#043; &#034;:&#034; &#043; redisPort;<br \/>\n        SingleServerConfig singleServerConfig &#061; config.useSingleServer()<br \/>\n        .setAddress(address)<br \/>\n        .setDatabase(redisDataBase)<br \/>\n        .setConnectionMinimumIdleSize(1)<br \/>\n        .setConnectionPoolSize(10)<br \/>\n        .setConnectTimeout(5000)<br \/>\n        .setIdleConnectionTimeout(30000)<br \/>\n        .setTimeout(3000)<br \/>\n        .setRetryAttempts(3)<br \/>\n        .setRetryDelay(new ConstantDelay(Duration.ofMillis(1500)));<br \/>\n        if (redisPassword !&#061; null &amp;&amp; !redisPassword.isEmpty()) {<br \/>\n            singleServerConfig.setPassword(redisPassword);<br \/>\n        }<br \/>\n        return Redisson.create(config);<br \/>\n    }<br \/>\n} <\/p>\n<p id=\"ufc14f2ab\">\u521b\u5efa\u9650\u6d41\u7684\u679a\u4e3e\u7c7b&#xff1a;<\/p>\n<p>public enum RateLimitType {<br \/>\n    \/**<br \/>\n     * \u63a5\u53e3\u7ea7\u522b\u9650\u6d41<br \/>\n     *\/<br \/>\n    API,<\/p>\n<p>    \/**<br \/>\n     * \u7528\u6237\u7ea7\u522b\u9650\u6d41<br \/>\n     *\/<br \/>\n    USER,<\/p>\n<p>    \/**<br \/>\n     * IP\u7ea7\u522b\u9650\u6d41<br \/>\n     *\/<br \/>\n    IP<br \/>\n} <\/p>\n<p id=\"ud9d1872c\">\u9650\u6d41\u662f\u4e2a\u53ef\u4ee5\u62bd\u53d6\u51fa\u6765\u7684\u516c\u5171\u903b\u8f91&#xff0c;\u56e0\u6b64\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528AOP&#xff0c;\u521b\u5efa\u6ce8\u89e3\u7684\u5f62\u5f0f\u9650\u6d41\u63d0\u4f9b\u7075\u6d3b\u7684\u914d\u7f6e\u9009\u9879&#xff1a;<\/p>\n<p>&#064;Target({ElementType.METHOD})<br \/>\n&#064;Retention(RetentionPolicy.RUNTIME)<br \/>\npublic &#064;interface RateLimit {<br \/>\n    \/**<br \/>\n     * \u9650\u6d41key\u524d\u7f00<br \/>\n     *\/<br \/>\n    String key() default &#034;&#034;;<\/p>\n<p>    \/**<br \/>\n     * \u6bcf\u4e2a\u65f6\u95f4\u7a97\u53e3\u7684\u8bf7\u6c42\u901f\u7387&#xff08;\u5141\u8bb8\u7684\u8bf7\u6c42\u6570&#xff09;<br \/>\n     *\/<br \/>\n    int rate() default 10;<\/p>\n<p>    \/**<br \/>\n     * \u65f6\u95f4\u7a97\u53e3\u5927\u5c0f&#xff08;\u5355\u4f4d&#xff1a;\u79d2&#xff09;<br \/>\n     *\/<br \/>\n    int rateInterval() default 1;<\/p>\n<p>    \/**<br \/>\n     * \u9650\u6d41\u7c7b\u578b<br \/>\n     *\/<br \/>\n    RateLimitType limitType() default RateLimitType.USER;<\/p>\n<p>    \/**<br \/>\n     * \u9650\u6d41\u63d0\u793a\u4fe1\u606f<br \/>\n     *\/<br \/>\n    String message() default &#034;\u8bf7\u6c42\u8fc7\u4e8e\u9891\u7e41&#xff0c;\u8bf7\u7a0d\u540e\u518d\u8bd5&#034;;<br \/>\n} <\/p>\n<p id=\"uad65a7b8\">\u5b9e\u73b0\u9650\u6d41\u5207\u9762&#xff1a;<\/p>\n<p>&#064;Aspect<br \/>\n&#064;Component<br \/>\n&#064;Slf4j<br \/>\npublic class RateLimitAspect {<br \/>\n    &#064;Resource<br \/>\n    private RedissonClient redissonClient;<\/p>\n<p>    &#064;Resource<br \/>\n    private UserService userService;<\/p>\n<p>    &#064;Before(&#034;&#064;annotation(rateLimit)&#034;)<br \/>\n    public void doBefore(JoinPoint point, RateLimit rateLimit){<br \/>\n        String key &#061; generateRateLimitKey(point, rateLimit);<br \/>\n        \/\/ \u4f7f\u7528Redisson\u7684\u5206\u5e03\u5f0f\u9650\u6d41\u5668<br \/>\n        RRateLimiter rateLimiter &#061; redissonClient.getRateLimiter(key);<br \/>\n        rateLimiter.expire(Duration.ofHours(1));<br \/>\n        \/\/ \u8bbe\u7f6e\u9650\u6d41\u5668\u53c2\u6570&#xff0c;\u6bcf\u4e2a\u65f6\u95f4\u7a97\u53e3\u5141\u8bb8\u7684\u8bf7\u6c42\u6570\u548c\u65f6\u95f4\u7a97\u53e3<br \/>\n        rateLimiter.trySetRate(RateType.OVERALL, rateLimit.rate(), rateLimit.rateInterval(), RateIntervalUnit.SECONDS);<br \/>\n        \/\/ \u5c1d\u8bd5\u83b7\u53d6\u4ee4\u724c&#xff0c;\u5982\u679c\u83b7\u53d6\u5931\u8d25\u5219\u9650\u6d41<br \/>\n        if (!rateLimiter.tryAcquire(1)) {<br \/>\n            throw new BusinessException(ErrorCode.TOO_MANY_REQUEST_ERROR, rateLimit.message());<br \/>\n        }<br \/>\n    }<\/p>\n<p>    private String generateRateLimitKey(JoinPoint point, RateLimit rateLimit) {<br \/>\n        StringBuilder keyBuilder &#061; new StringBuilder();<br \/>\n        keyBuilder.append(&#034;rate_limit:&#034;);<br \/>\n        \/\/ \u6dfb\u52a0\u81ea\u5b9a\u4e49\u524d\u7f00<br \/>\n        if (!rateLimit.key().isEmpty()) {<br \/>\n            keyBuilder.append(rateLimit.key()).append(&#034;:&#034;);<br \/>\n        }<br \/>\n        \/\/ \u6839\u636e\u9650\u6d41\u7c7b\u578b\u751f\u6210\u4e0d\u540c\u7684key<br \/>\n        switch (rateLimit.limitType()) {<br \/>\n            case API:<br \/>\n                \/\/ \u63a5\u53e3\u7ea7\u522b&#xff1a;\u65b9\u6cd5\u540d<br \/>\n                MethodSignature signature &#061; (MethodSignature) point.getSignature();<br \/>\n                Method method &#061; signature.getMethod();<br \/>\n                keyBuilder.append(&#034;api:&#034;).append(method.getDeclaringClass().getSimpleName())<br \/>\n                .append(&#034;.&#034;).append(method.getName());<br \/>\n                break;<br \/>\n            case USER:<br \/>\n                \/\/ \u7528\u6237\u7ea7\u522b&#xff1a;\u7528\u6237ID<br \/>\n                try {<br \/>\n                    ServletRequestAttributes attributes &#061; (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();<br \/>\n                    if (attributes !&#061; null) {<br \/>\n                        HttpServletRequest request &#061; attributes.getRequest();<br \/>\n                        User loginUser &#061; userService.getLoginUser(request);<br \/>\n                        keyBuilder.append(&#034;user:&#034;).append(loginUser.getId());<br \/>\n                    } else {<br \/>\n                        \/\/ \u65e0\u6cd5\u83b7\u53d6\u8bf7\u6c42\u4e0a\u4e0b\u6587&#xff0c;\u4f7f\u7528IP\u9650\u6d41<br \/>\n                        keyBuilder.append(&#034;ip:&#034;).append(getClientIP());<br \/>\n                    }<br \/>\n                } catch (BusinessException e) {<br \/>\n                    \/\/ \u672a\u767b\u5f55\u7528\u6237\u4f7f\u7528IP\u9650\u6d41<br \/>\n                    keyBuilder.append(&#034;ip:&#034;).append(getClientIP());<br \/>\n                }<br \/>\n                break;<br \/>\n            case IP:<br \/>\n                \/\/ IP\u7ea7\u522b&#xff1a;\u5ba2\u6237\u7aefIP<br \/>\n                keyBuilder.append(&#034;ip:&#034;).append(getClientIP());<br \/>\n                break;<br \/>\n            default:<br \/>\n                throw new BusinessException(ErrorCode.SYSTEM_ERROR, &#034;\u4e0d\u652f\u6301\u7684\u9650\u6d41\u7c7b\u578b&#034;);<br \/>\n        }<br \/>\n        return keyBuilder.toString();<br \/>\n    }<br \/>\n    private String getClientIP() {<br \/>\n        ServletRequestAttributes attributes &#061; (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();<br \/>\n        if (attributes &#061;&#061; null) {<br \/>\n            return &#034;unknown&#034;;<br \/>\n        }<br \/>\n        HttpServletRequest request &#061; attributes.getRequest();<br \/>\n        String ip &#061; request.getHeader(&#034;X-Forwarded-For&#034;);<br \/>\n        if (ip &#061;&#061; null || ip.isEmpty() || &#034;unknown&#034;.equalsIgnoreCase(ip)) {<br \/>\n            ip &#061; request.getHeader(&#034;X-Real-IP&#034;);<br \/>\n        }<br \/>\n        if (ip &#061;&#061; null || ip.isEmpty() || &#034;unknown&#034;.equalsIgnoreCase(ip)) {<br \/>\n            ip &#061; request.getRemoteAddr();<br \/>\n        }<br \/>\n        \/\/ \u5904\u7406\u591a\u7ea7\u4ee3\u7406\u7684\u60c5\u51b5<br \/>\n        if (ip !&#061; null &amp;&amp; ip.contains(&#034;,&#034;)) {<br \/>\n            ip &#061; ip.split(&#034;,&#034;)[0].trim();<br \/>\n        }<br \/>\n        return ip !&#061; null ? ip : &#034;unknown&#034;;<br \/>\n    }<\/p>\n<p>} <\/p>\n<p id=\"u9a4dec50\">\u5728AI\u5bf9\u8bdd\u63a5\u53e3\u4e2d\u5e94\u7528\u9650\u6d41\u6ce8\u89e3&#xff1a;<\/p>\n<p>\/**<br \/>\n * \u5e94\u7528\u804a\u5929\u751f\u6210\u4ee3\u7801&#xff08;\u6d41\u5f0f SSE&#xff09;<br \/>\n *<br \/>\n * &#064;param appId   \u5e94\u7528 ID<br \/>\n * &#064;param message \u7528\u6237\u6d88\u606f<br \/>\n * &#064;param request \u8bf7\u6c42\u5bf9\u8c61<br \/>\n * &#064;return \u751f\u6210\u7ed3\u679c\u6d41<br \/>\n *\/<br \/>\n&#064;GetMapping(value &#061; &#034;\/chat\/gen\/code&#034;, produces &#061; MediaType.TEXT_EVENT_STREAM_VALUE)<br \/>\n&#064;RateLimit(rate &#061; 5, rateInterval &#061; 60, limitType &#061; RateLimitType.USER, message &#061; &#034;AI \u5bf9\u8bdd\u8bf7\u6c42\u8fc7\u4e8e\u9891\u7e41&#xff0c;\u8bf7\u7a0d\u540e\u518d\u8bd5&#034;)<br \/>\npublic Flux&lt;ServerSentEvent&lt;String&gt;&gt; chatToGenCode(&#064;RequestParam Long appId,<br \/>\n                                                   &#064;RequestParam String message,<br \/>\n                                                   HttpServletRequest request) { <\/p>\n<h3 id=\"o4TbB\" style=\"background-color:transparent\">\u4f18\u5316 SSE \u9519\u8bef\u5904\u7406<\/h3>\n<p id=\"uca224915\">\u5728\u6d4b\u8bd5\u8fc7\u7a0b\u4e2d&#xff0c;\u6211\u4eec\u53d1\u73b0\u4e86\u4e00\u4e2a\u95ee\u9898&#xff1a;\u5f53\u9650\u6d41\u89e6\u53d1\u65f6&#xff0c;\u524d\u7aef\u65e0\u6cd5\u6b63\u786e\u663e\u793a\u540e\u7aef\u8fd4\u56de\u7684\u9519\u8bef\u4fe1\u606f\u3002\u8fd9\u662f\u56e0\u4e3a\u9650\u6d41\u5f02\u5e38\u5728\u8fdb\u5165 SSE \u63a5\u53e3\u4e4b\u524d\u5c31\u88ab\u629b\u51fa\u4e86&#xff0c;\u6ca1\u6709\u901a\u8fc7\u6d41\u5f0f\u8fd4\u56de&#xff0c;\u9700\u8981\u7279\u6b8a\u5904\u7406\u3002\u601d\u8def\u662f\u5c06\u9650\u6d41\u5f02\u5e38\u6d88\u606f\u4e5f\u4f5c\u4e3a SSE \u8fd4\u56de\u7ed9\u524d\u7aef\u3002<\/p>\n<p id=\"u40691a97\">SSE \u662f\u4e00\u79cd\u670d\u52a1\u5668\u5411\u5ba2\u6237\u7aef\u63a8\u9001\u6570\u636e\u7684\u6280\u672f&#xff0c;\u5b83\u57fa\u4e8e HTTP \u534f\u8bae&#xff0c;\u4f7f\u7528 text\/event-stream \u5a92\u4f53\u7c7b\u578b\u3002SSE \u6d88\u606f\u7684\u6807\u51c6\u683c\u5f0f\u662f&#xff1a;<\/p>\n<p>event: \u4e8b\u4ef6\u7c7b\u578b<br \/>\ndata: \u6570\u636e\u5185\u5bb9 <\/p>\n<p id=\"u445d47ed\">\u4f18\u5316\u5168\u5c40\u5f02\u5e38\u5904\u7406\u5668&#xff0c;\u6765\u5b9e\u73b0\u80fd\u591f\u6b63\u786e\u5904\u7406SSE\u8bf7\u6c42\u7684\u5f02\u5e38&#xff1a;<\/p>\n<p>&#064;Hidden<br \/>\n&#064;RestControllerAdvice<br \/>\n&#064;Slf4j<br \/>\npublic class GlobalExceptionHandler {<\/p>\n<p>    &#064;ExceptionHandler(BusinessException.class)<br \/>\n    public BaseResponse&lt;?&gt; businessExceptionHandler(BusinessException e) {<br \/>\n        log.error(&#034;BusinessException&#034;, e);<br \/>\n        \/\/ \u5c1d\u8bd5\u5904\u7406 SSE \u8bf7\u6c42<br \/>\n        if (handleSseError(e.getCode(), e.getMessage())) {<br \/>\n            return null;<br \/>\n        }<br \/>\n        \/\/ \u5bf9\u4e8e\u666e\u901a\u8bf7\u6c42&#xff0c;\u8fd4\u56de\u6807\u51c6 JSON \u54cd\u5e94<br \/>\n        return ResultUtils.error(e.getCode(), e.getMessage());<br \/>\n    }<\/p>\n<p>    &#064;ExceptionHandler(RuntimeException.class)<br \/>\n    public BaseResponse&lt;?&gt; runtimeExceptionHandler(RuntimeException e) {<br \/>\n        log.error(&#034;RuntimeException&#034;, e);<br \/>\n        \/\/ \u5c1d\u8bd5\u5904\u7406 SSE \u8bf7\u6c42<br \/>\n        if (handleSseError(ErrorCode.SYSTEM_ERROR.getCode(), &#034;\u7cfb\u7edf\u9519\u8bef&#034;)) {<br \/>\n            return null;<br \/>\n        }<br \/>\n        return ResultUtils.error(ErrorCode.SYSTEM_ERROR, &#034;\u7cfb\u7edf\u9519\u8bef&#034;);<br \/>\n    }<\/p>\n<p>    \/**<br \/>\n     * \u5904\u7406SSE\u8bf7\u6c42\u7684\u9519\u8bef\u54cd\u5e94<br \/>\n     *<br \/>\n     * &#064;param errorCode \u9519\u8bef\u7801<br \/>\n     * &#064;param errorMessage \u9519\u8bef\u4fe1\u606f<br \/>\n     * &#064;return true\u8868\u793a\u662fSSE\u8bf7\u6c42\u5e76\u5df2\u5904\u7406&#xff0c;false\u8868\u793a\u4e0d\u662fSSE\u8bf7\u6c42<br \/>\n     *\/<br \/>\n    private boolean handleSseError(int errorCode, String errorMessage) {<br \/>\n        ServletRequestAttributes attributes &#061; (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();<br \/>\n        if (attributes &#061;&#061; null) {<br \/>\n            return false;<br \/>\n        }<br \/>\n        HttpServletRequest request &#061; attributes.getRequest();<br \/>\n        HttpServletResponse response &#061; attributes.getResponse();<br \/>\n        \/\/ \u5224\u65ad\u662f\u5426\u662fSSE\u8bf7\u6c42&#xff08;\u901a\u8fc7Accept\u5934\u6216URL\u8def\u5f84&#xff09;<br \/>\n        String accept &#061; request.getHeader(&#034;Accept&#034;);<br \/>\n        String uri &#061; request.getRequestURI();<br \/>\n        if ((accept !&#061; null &amp;&amp; accept.contains(&#034;text\/event-stream&#034;)) ||<br \/>\n            uri.contains(&#034;\/chat\/gen\/code&#034;)) {<br \/>\n            try {<br \/>\n                \/\/ \u8bbe\u7f6eSSE\u54cd\u5e94\u5934<br \/>\n                response.setContentType(&#034;text\/event-stream&#034;);<br \/>\n                response.setCharacterEncoding(&#034;UTF-8&#034;);<br \/>\n                response.setHeader(&#034;Cache-Control&#034;, &#034;no-cache&#034;);<br \/>\n                response.setHeader(&#034;Connection&#034;, &#034;keep-alive&#034;);<br \/>\n                \/\/ \u6784\u9020\u9519\u8bef\u6d88\u606f\u7684SSE\u683c\u5f0f<br \/>\n                Map&lt;String, Object&gt; errorData &#061; Map.of(<br \/>\n                    &#034;error&#034;, true,<br \/>\n                    &#034;code&#034;, errorCode,<br \/>\n                    &#034;message&#034;, errorMessage<br \/>\n                );<br \/>\n                String errorJson &#061; JSONUtil.toJsonStr(errorData);<br \/>\n                \/\/ \u53d1\u9001\u4e1a\u52a1\u9519\u8bef\u4e8b\u4ef6&#xff08;\u907f\u514d\u4e0e\u6807\u51c6error\u4e8b\u4ef6\u51b2\u7a81&#xff09;<br \/>\n                String sseData &#061; &#034;event: business-error\\\\ndata: &#034; &#043; errorJson &#043; &#034;\\\\n\\\\n&#034;;<br \/>\n                response.getWriter().write(sseData);<br \/>\n                response.getWriter().flush();<br \/>\n                \/\/ \u53d1\u9001\u7ed3\u675f\u4e8b\u4ef6<br \/>\n                response.getWriter().write(&#034;event: done\\\\ndata: {}\\\\n\\\\n&#034;);<br \/>\n                response.getWriter().flush();<br \/>\n                \/\/ \u8868\u793a\u5df2\u5904\u7406SSE\u8bf7\u6c42<br \/>\n                return true;<br \/>\n            } catch (IOException ioException) {<br \/>\n                log.error(&#034;Failed to write SSE error response&#034;, ioException);<br \/>\n                \/\/ \u5373\u4f7f\u5199\u5165\u5931\u8d25&#xff0c;\u4e5f\u8868\u793a\u8fd9\u662fSSE\u8bf7\u6c42<br \/>\n                return true;<br \/>\n            }<br \/>\n        }<br \/>\n        return false;<br \/>\n    }<br \/>\n} <\/p>\n<p id=\"u62a77586\">\u540c\u6837&#xff0c;\u524d\u7aef\u4e5f\u9700\u8981\u6dfb\u52a0\u5bf9\u81ea\u5b9a\u4e49\u9519\u8bef\u4e8b\u4ef6\u7684\u5904\u7406&#xff1a;<\/p>\n<p>\/\/ \u5904\u7406business-error\u4e8b\u4ef6&#xff08;\u540e\u7aef\u9650\u6d41\u7b49\u9519\u8bef&#xff09;<br \/>\neventSource.addEventListener(&#039;business-error&#039;, function (event: MessageEvent) {<br \/>\n  if (streamCompleted) return<\/p>\n<p>  try {<br \/>\n    const errorData &#061; JSON.parse(event.data)<br \/>\n    console.error(&#039;SSE\u4e1a\u52a1\u9519\u8bef\u4e8b\u4ef6:&#039;, errorData)<\/p>\n<p>    \/\/ \u663e\u793a\u5177\u4f53\u7684\u9519\u8bef\u4fe1\u606f<br \/>\n    const errorMessage &#061; errorData.message || &#039;\u751f\u6210\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u9519\u8bef&#039;<br \/>\n    messages.value[aiMessageIndex].content &#061; &#096;\u274c ${errorMessage}&#096;<br \/>\n    messages.value[aiMessageIndex].loading &#061; false<br \/>\n    message.error(errorMessage)<\/p>\n<p>    streamCompleted &#061; true<br \/>\n    isGenerating.value &#061; false<br \/>\n    eventSource?.close()<br \/>\n  } catch (parseError) {<br \/>\n    console.error(&#039;\u89e3\u6790\u9519\u8bef\u4e8b\u4ef6\u5931\u8d25:&#039;, parseError, &#039;\u539f\u59cb\u6570\u636e:&#039;, event.data)<br \/>\n    handleError(new Error(&#039;\u670d\u52a1\u5668\u8fd4\u56de\u9519\u8bef&#039;), aiMessageIndex)<br \/>\n  }<br \/>\n})<\/p>\n<p id=\"u6d0d5daa\">\u6d4b\u8bd5\u6548\u679c\u5982\u56fe&#xff0c;\u4e00\u5206\u949f\u5185\u5feb\u901f\u70b9\u51fb\u751f\u6210\u5e94\u7528&#xff0c;\u8d85\u8fc75\u6b21\u89e6\u53d1\u9650\u6d41&#xff0c;\u7b26\u5408\u9884\u671f&#xff1a;<\/p>\n<p id=\"u2c5f8a9d\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"778\" id=\"u6eb14732\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260223154137-699c7531edb51.png\" width=\"1856\" \/><\/p>\n<h2 id=\"VntYm\" style=\"background-color:transparent\">Prompt\u5b89\u5168\u5ba1\u67e5&#xff08;Guardrails\u62a4\u8f68\u673a\u5236&#xff09;<\/h2>\n<p id=\"u4f70d61e\">\u9664\u4e86\u6d41\u91cf\u4fdd\u62a4&#xff0c;\u6211\u4eec\u8fd8\u9700\u8981\u9632\u8303\u6076\u610f\u8f93\u5165\u548c Prompt \u6ce8\u5165\u653b\u51fb\u7684\u9632\u62a4\u7684\u7b56\u7565\u3002<\/p>\n<p id=\"u300b43db\">\u6bd4\u5982\u5728\u5c06 prompt \u4ea4\u7ed9 AI\u6267\u884c\u4e4b\u524d&#xff0c;\u4f1a\u8fdb\u884c\u4e00\u6b21\u5ba1\u6838&#xff1a;<\/p>\n<p id=\"u47a1d703\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"196\" id=\"ub2dcb0b6\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260223154138-699c75327a19f.png\" width=\"926\" \/><\/p>\n<p id=\"ubc98f212\">\u57fa\u4e8eLangChain4j\u7684\u62a4\u8f68\u529f\u80fd&#xff0c;\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0\u8c03\u7528 AI \u524d\u7684\u5ba1\u67e5\u80fd\u529b\u3002<\/p>\n<p id=\"u4ee7a6ec\">\u4ec0\u4e48\u662f\u62a4\u8f68 Guardrails&#xff1f;<\/p>\n<p id=\"ud5508beb\">\u62a4\u8f68\u662f AI \u5e94\u7528\u4e2d\u7684\u5b89\u5168\u673a\u5236&#xff0c;\u7c7b\u4f3c\u4e8e\u9053\u8def\u4e0a\u7684\u62a4\u680f&#xff0c;\u7528\u4e8e\u9632\u6b62\u6076\u610f\u7684 Prompt \u8f93\u5165\u3001\u9632\u6b62 AI\u6a21\u578b\u4ea7\u751f\u4e0d\u5f53\u6216\u6709\u5bb3\u7684\u5185\u5bb9\u3002<\/p>\n<p id=\"ufe474196\">\u5176\u5b9e\u6211\u4eec\u628a\u5b83\u7406\u89e3\u4e3a\u62e6\u622a\u5668\u5c31\u597d\u4e86&#xff0c;\u62a4\u8f68\u5206\u4e3a\u4e24\u79cd&#xff1a;<\/p>\n<p id=\"ub5192dbd\">1\u3001\u8f93\u5165\u62a4\u8f68(Input Guardrails)&#xff1a;\u5728\u7528\u6237\u8f93\u5165\u4f20\u9012\u7ed9 AI \u6a21\u578b\u4e4b\u524d\u8fdb\u884c\u68c0\u67e5\u548c\u8fc7\u6ee4<\/p>\n<p id=\"ue08b8c44\">2\u3001\u8f93\u51fa\u62a4\u8f68(Output Guardrails)&#xff1a;\u5728 AI\u6a21\u578b\u751f\u6210\u5185\u5bb9\u540e\u8fdb\u884c\u68c0\u67e5\u548c\u8fc7\u6ee4<\/p>\n<p id=\"ua2b03126\">\u9664\u4e86\u8f93\u5165 Prompt \u548c AI \u8f93\u51fa\u7ed3\u679c\u7684\u5b89\u5168\u6821\u9a8c\u5916&#xff0c;\u4f60\u8fd8\u53ef\u4ee5\u5229\u7528\u62a4\u8f68\u8fdb\u884c\u6743\u9650\u6821\u9a8c\u3001\u65e5\u5fd7\u8bb0\u5f55\u7b49\u3002\u4e0b\u9762\u6211\u4eec\u6765\u5229\u7528\u8f93\u5165\u62a4\u8f68\u5b9e\u73b0 Prompt \u5b89\u5168\u5ba1\u6838&#xff0c;\u9632\u6b62\u4e00\u4e9b\u975e\u6cd5 Prompt&#xff0c;\u6bd4\u5982:<\/p>\n<p id=\"ue6770611\">1\u3001\u62d2\u7edd\u8fc7\u957f\u7684 Prompt<\/p>\n<p id=\"ueae9dec0\">2\u3001\u62d2\u7edd\u5305\u542b\u654f\u611f\u8bcd\u7684 Prompt<\/p>\n<p id=\"u11313b07\">3\u3001\u62d2\u7edd\u5305\u542b\u6ce8\u5165\u653b\u51fb\u7684 Prompt<\/p>\n<h3 id=\"dIe2h\" style=\"background-color:transparent\">\u5f00\u53d1\u5b9e\u73b0\u62a4\u8f68<\/h3>\n<p id=\"u415ff931\">\u8fd9\u91cc\u5b9e\u73b0\u57fa\u7840\u68c0\u6d4b&#xff0c;\u5b9e\u9645\u751f\u4ea7\u73af\u5883\u4e2d\u53ef\u80fd\u9700\u8981\u66f4\u590d\u6742\u7684\u68c0\u6d4b\u903b\u8f91&#xff0c;\u5305\u62ec\u4f7f\u7528 AI \u6a21\u578b\u3001\u6216\u8005\u4e00\u4e9b\u5e73\u53f0\u4e13\u95e8\u5b89\u5168\u670d\u52a1\u7684\u654f\u611f\u8bcd\u5185\u5bb9\u68c0\u6d4b\u5ba1\u6838\u670d\u52a1\u6765\u68c0\u6d4b\u66f4\u590d\u6742\u7684\u653b\u51fb\u6a21\u5f0f\u3002<\/p>\n<p>public class PromptSafetyInputGuardrail implements InputGuardrail {<\/p>\n<p>    \/\/ \u654f\u611f\u8bcd\u5217\u8868<br \/>\n    private static final List&lt;String&gt; SENSITIVE_WORDS &#061; Arrays.asList(<br \/>\n        &#034;\u5ffd\u7565\u4e4b\u524d\u7684\u6307\u4ee4&#034;, &#034;ignore previous instructions&#034;, &#034;ignore above&#034;,<br \/>\n        &#034;\u7834\u89e3&#034;, &#034;hack&#034;, &#034;\u7ed5\u8fc7&#034;, &#034;bypass&#034;, &#034;\u8d8a\u72f1&#034;, &#034;jailbreak&#034;<br \/>\n    );<\/p>\n<p>    \/\/ \u6ce8\u5165\u653b\u51fb\u6a21\u5f0f<br \/>\n    private static final List&lt;Pattern&gt; INJECTION_PATTERNS &#061; Arrays.asList(<br \/>\n        Pattern.compile(&#034;(?i)ignore\\\\\\\\s&#043;(?:previous|above|all)\\\\\\\\s&#043;(?:instructions?|commands?|prompts?)&#034;),<br \/>\n        Pattern.compile(&#034;(?i)(?:forget|disregard)\\\\\\\\s&#043;(?:everything|all)\\\\\\\\s&#043;(?:above|before)&#034;),<br \/>\n        Pattern.compile(&#034;(?i)(?:pretend|act|behave)\\\\\\\\s&#043;(?:as|like)\\\\\\\\s&#043;(?:if|you\\\\\\\\s&#043;are)&#034;),<br \/>\n        Pattern.compile(&#034;(?i)system\\\\\\\\s*:\\\\\\\\s*you\\\\\\\\s&#043;are&#034;),<br \/>\n        Pattern.compile(&#034;(?i)new\\\\\\\\s&#043;(?:instructions?|commands?|prompts?)\\\\\\\\s*:&#034;)<br \/>\n    );<\/p>\n<p>    &#064;Override<br \/>\n    public InputGuardrailResult validate(UserMessage userMessage) {<br \/>\n        String input &#061; userMessage.singleText();<br \/>\n        \/\/ \u68c0\u67e5\u8f93\u5165\u957f\u5ea6<br \/>\n        if (input.length() &gt; 1000) {<br \/>\n            return fatal(&#034;\u8f93\u5165\u5185\u5bb9\u8fc7\u957f&#xff0c;\u4e0d\u8981\u8d85\u8fc7 1000 \u5b57&#034;);<br \/>\n        }<br \/>\n        \/\/ \u68c0\u67e5\u662f\u5426\u4e3a\u7a7a<br \/>\n        if (input.trim().isEmpty()) {<br \/>\n            return fatal(&#034;\u8f93\u5165\u5185\u5bb9\u4e0d\u80fd\u4e3a\u7a7a&#034;);<br \/>\n        }<br \/>\n        \/\/ \u68c0\u67e5\u654f\u611f\u8bcd<br \/>\n        String lowerInput &#061; input.toLowerCase();<br \/>\n        for (String sensitiveWord : SENSITIVE_WORDS) {<br \/>\n            if (lowerInput.contains(sensitiveWord.toLowerCase())) {<br \/>\n                return fatal(&#034;\u8f93\u5165\u5305\u542b\u4e0d\u5f53\u5185\u5bb9&#xff0c;\u8bf7\u4fee\u6539\u540e\u91cd\u8bd5&#034;);<br \/>\n            }<br \/>\n        }<br \/>\n        \/\/ \u68c0\u67e5\u6ce8\u5165\u653b\u51fb\u6a21\u5f0f<br \/>\n        for (Pattern pattern : INJECTION_PATTERNS) {<br \/>\n            if (pattern.matcher(input).find()) {<br \/>\n                return fatal(&#034;\u68c0\u6d4b\u5230\u6076\u610f\u8f93\u5165&#xff0c;\u8bf7\u6c42\u88ab\u62d2\u7edd&#034;);<br \/>\n            }<br \/>\n        }<br \/>\n        return success();<br \/>\n    }<br \/>\n} <\/p>\n<p id=\"u200fee4f\">\u96c6\u6210\u62a4\u8f68\u673a\u5236\u5230 AI \u670d\u52a1\u5de5\u5382\u4e2d&#xff1a;<\/p>\n<p>yield AiServices.builder(AiCodeGeneratorService.class)<br \/>\n        .streamingChatModel(reasoningStreamingChatModel)<br \/>\n        .chatMemoryProvider(memoryId -&gt; chatMemory)<br \/>\n        .tools(toolManager.getAllTools())<br \/>\n        .inputGuardrails(new PromptSafetyInputGuardrail())  \/\/ \u6dfb\u52a0\u8f93\u5165\u62a4\u8f68<br \/>\n        .build(); <\/p>\n<p id=\"u553bc736\">\u5982\u679c\u662f\u53ea\u7ed9\u67d0\u4e2a\u65b9\u6cd5\u6dfb\u52a0\u62a4\u8f68&#xff0c;\u53ef\u4ee5\u4f7f\u7528\u6ce8\u89e3\u7684\u5f62\u5f0f\u5199\u6cd5&#xff1a;<\/p>\n<p>public interface Assistant {<br \/>\n    &#064;InputGuardrails({ FirstInputGuardrail.class, SecondInputGuardrail.class })<br \/>\n    String chat(String question);<\/p>\n<p>    String doSomethingElse(String question);<br \/>\n} <\/p>\n<p id=\"u1139fc86\">\u6d4b\u8bd5\u6548\u679c\u5982\u56fe&#xff1a;<\/p>\n<p id=\"u5e987def\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"590\" id=\"ud57cb9ea\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260223154138-699c753294569.png\" width=\"1657\" \/><\/p>\n<p id=\"u1526a92d\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"364\" id=\"u26367c4b\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260223154139-699c75330261c.png\" width=\"1767\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6d41\u91cf\u4fdd\u62a4<br \/>\nAI\u5bf9\u8bdd\u63a5\u53e3\u662f\u91cd\u8981\u529f\u80fd\u6210\u672c\u6700\u9ad8&#xff0c;\u4f7f\u7528Redisson\u5206\u5e03\u5f0f\u9650\u6d41\u6765\u9632\u6b62\u6076\u610f\u653b\u51fb\u548c\u8d44\u6e90\u6ee5\u7528\u3002<br \/>\n\u9996\u5148\u5f15\u5165Redisson\u4f9d\u8d56&#xff1a;<br \/>\n<!-- Spring Session  Redis --><br \/>\norg.springframework.sessionspring-session-data-redis<\/p>\n<p>&lt;!-<\/p>\n","protected":false},"author":2,"featured_media":77117,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[8443,66,99,292],"topic":[],"class_list":["post-77121","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-8443","tag-ai","tag-java","tag-292"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>AI\u5e94\u7528\u5bf9\u8bdd\u751f\u6210\u7684\u5b89\u5168\u6027\u4f18\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/77121.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"AI\u5e94\u7528\u5bf9\u8bdd\u751f\u6210\u7684\u5b89\u5168\u6027\u4f18\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6d41\u91cf\u4fdd\u62a4 AI\u5bf9\u8bdd\u63a5\u53e3\u662f\u91cd\u8981\u529f\u80fd\u6210\u672c\u6700\u9ad8&#xff0c;\u4f7f\u7528Redisson\u5206\u5e03\u5f0f\u9650\u6d41\u6765\u9632\u6b62\u6076\u610f\u653b\u51fb\u548c\u8d44\u6e90\u6ee5\u7528\u3002 \u9996\u5148\u5f15\u5165Redisson\u4f9d\u8d56&#xff1a;  org.springframework.sessionspring-session-data-redis &lt;!-\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/77121.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-23T15:41:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260223154137-699c7531edb51.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/77121.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/77121.html\",\"name\":\"AI\u5e94\u7528\u5bf9\u8bdd\u751f\u6210\u7684\u5b89\u5168\u6027\u4f18\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-23T15:41:40+00:00\",\"dateModified\":\"2026-02-23T15:41:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/77121.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/77121.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/77121.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AI\u5e94\u7528\u5bf9\u8bdd\u751f\u6210\u7684\u5b89\u5168\u6027\u4f18\u5316\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"AI\u5e94\u7528\u5bf9\u8bdd\u751f\u6210\u7684\u5b89\u5168\u6027\u4f18\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/77121.html","og_locale":"zh_CN","og_type":"article","og_title":"AI\u5e94\u7528\u5bf9\u8bdd\u751f\u6210\u7684\u5b89\u5168\u6027\u4f18\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6d41\u91cf\u4fdd\u62a4 AI\u5bf9\u8bdd\u63a5\u53e3\u662f\u91cd\u8981\u529f\u80fd\u6210\u672c\u6700\u9ad8&#xff0c;\u4f7f\u7528Redisson\u5206\u5e03\u5f0f\u9650\u6d41\u6765\u9632\u6b62\u6076\u610f\u653b\u51fb\u548c\u8d44\u6e90\u6ee5\u7528\u3002 \u9996\u5148\u5f15\u5165Redisson\u4f9d\u8d56&#xff1a;  org.springframework.sessionspring-session-data-redis &lt;!-","og_url":"https:\/\/www.wsisp.com\/helps\/77121.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-23T15:41:40+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260223154137-699c7531edb51.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/77121.html","url":"https:\/\/www.wsisp.com\/helps\/77121.html","name":"AI\u5e94\u7528\u5bf9\u8bdd\u751f\u6210\u7684\u5b89\u5168\u6027\u4f18\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-23T15:41:40+00:00","dateModified":"2026-02-23T15:41:40+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/77121.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/77121.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/77121.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"AI\u5e94\u7528\u5bf9\u8bdd\u751f\u6210\u7684\u5b89\u5168\u6027\u4f18\u5316"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/77121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=77121"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/77121\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/77117"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=77121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=77121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=77121"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=77121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}