001/* 002 * Copyright (c) 2023-2026, Agents-Flex (fuhai999@gmail.com). 003 * <p> 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * <p> 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * <p> 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package com.agentsflex.core.model.client; 017 018import java.util.Map; 019 020public class ChatRequestSpec { 021 private String url; 022 private Map<String, String> headers; 023 private String body; // JSON 字符串 024 private int retryCount; 025 private int retryInitialDelayMs; 026 027 public ChatRequestSpec() { 028 } 029 030 public ChatRequestSpec(String url, Map<String, String> headers, String body, int retryCount, int retryInitialDelayMs) { 031 this.url = url; 032 this.headers = headers; 033 this.body = body; 034 this.retryCount = retryCount; 035 this.retryInitialDelayMs = retryInitialDelayMs; 036 } 037 038 public String getUrl() { 039 return url; 040 } 041 042 public void setUrl(String url) { 043 this.url = url; 044 } 045 046 public Map<String, String> getHeaders() { 047 return headers; 048 } 049 050 public void setHeaders(Map<String, String> headers) { 051 this.headers = headers; 052 } 053 054 public void addHeader(String key, String value) { 055 if (this.headers == null) { 056 this.headers = new java.util.HashMap<>(); 057 } 058 this.headers.put(key, value); 059 } 060 061 public void addHeaders(Map<String, String> headers) { 062 if (this.headers == null) { 063 this.headers = new java.util.HashMap<>(); 064 } 065 this.headers.putAll(headers); 066 } 067 068 public String getBody() { 069 return body; 070 } 071 072 public void setBody(String body) { 073 this.body = body; 074 } 075 076 public int getRetryCount() { 077 return retryCount; 078 } 079 080 public void setRetryCount(int retryCount) { 081 this.retryCount = retryCount; 082 } 083 084 public int getRetryInitialDelayMs() { 085 return retryInitialDelayMs; 086 } 087 088 public void setRetryInitialDelayMs(int retryInitialDelayMs) { 089 this.retryInitialDelayMs = retryInitialDelayMs; 090 } 091}