function optimizeRobotContent(_ref) {
  var _ref$content = _ref.content,
    content = _ref$content === void 0 ? '' : _ref$content,
    _ref$maxLen = _ref.maxLen,
    maxLen = _ref$maxLen === void 0 ? 3500 : _ref$maxLen,
    _ref$concatFn = _ref.concatFn,
    concatFn = _ref$concatFn === void 0 ? function (more) {
      return "\n\n\n...\u5DF2\u7701\u7565".concat(more, "\u884C...");
    } : _ref$concatFn;
  if (content.length <= maxLen) {
    return content;
  }
  var list = content.split('\n');
  var totalLen = list.length;
  for (var i = totalLen; i >= 0; i--) {
    var newContent = list.slice(0, i).join('\n');
    var len = newContent.length;
    if (len <= maxLen) {
      var more = totalLen - i;
      var extra = '';
      if (typeof concatFn === 'function') {
        extra = concatFn(more);
      }
      return "".concat(newContent).concat(extra);
    }
  }
  return '';
}

export { optimizeRobotContent };
