Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] zhipu-ai:JSON parsing exception caused by security risk monitoring alerts. #49

Open
cuiwei4j opened this issue Jan 10, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@cuiwei4j
Copy link

cuiwei4j commented Jan 10, 2025

Describe the bug

JSON parsing exception caused by security risk monitoring alerts.

Content security

Log and Stack trace

Minimal Example to Reproduce

"contentFilter":[{"level":1,"role":"user"}],"error":{"code":"1301","message":"系统检测到输入或生成内容可能包含不安全或敏感内容,请您避免输入易产生敏感内容的提示语,感谢您的配合。"}

Expected behavior

Please complete the following information:

  • LangChain4j Community version: 1.0.0-alpha1
  • LangChain4j Community Component you used (e.g. langchain4j-community-zhipu-ai):
  • Java version: 21
  • Spring Boot version (if applicable): 3.3.7
@cuiwei4j cuiwei4j added the bug Something isn't working label Jan 10, 2025
cuiwei4j added a commit to cuiwei4j/langchain4j-community that referenced this issue Jan 10, 2025
@cuiwei4j
Copy link
Author

fix:

@JsonInclude(NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class ErrorResponse {
    private List<SensitiveFilter> contentFilter;
    private Map<String, String> error;

    public Map<String, String> getError() {
        return error;
    }

    public void setError(Map<String, String> error) {
        this.error = error;
    }

    public List<SensitiveFilter> getContentFilter() {
        return contentFilter;
    }

    public void setContentFilter(List<SensitiveFilter> contentFilter) {
        this.contentFilter = contentFilter;
    }
}


public class SensitiveFilter {
    private String role;
    private Integer level;

    public String getRole() {
        return role;
    }

    public void setRole(final String role) {
        this.role = role;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(final Integer level) {
        this.level = level;
    }
}

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant