@overmap-ai/core 1.0.48-fix-agent-errors.3 → 1.0.48-menu-improvements.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @overmap-ai/core
2
-
3
- The `core` package contains core functionality for the Overmap platform. It is a peer dependency of all other overmap
4
- packages.
1
+ # @overmap-ai/core
2
+
3
+ The `core` package contains core functionality for the Overmap platform. It is a peer dependency of all other overmap
4
+ packages.
@@ -6,4 +6,4 @@ export interface ImageCardProps extends Omit<OvermapItemProps, "children" | "lef
6
6
  error?: string;
7
7
  truncateLength?: number;
8
8
  }
9
- export declare const ImageCard: import("react").MemoExoticComponent<(props: ImageCardProps) => import("react/jsx-runtime").JSX.Element>;
9
+ export declare const ImageCard: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<ImageCardProps & import("react").RefAttributes<HTMLDivElement>>>;
@@ -4251,10 +4251,20 @@ function runMiddleware(action) {
4251
4251
  var _a2;
4252
4252
  return (_a2 = allMiddleware[0]) == null ? void 0 : _a2.run(action);
4253
4253
  }
4254
- const discardStatuses = [400, 409, 403, 404];
4254
+ const discardStatuses = [400, 409, 403, 404, 405, 500];
4255
4255
  const statusMessages = {
4256
4256
  403: { title: "Forbidden", description: "You are not authorized to perform this action.", severity: "danger" },
4257
- 404: { title: "Not found", description: "The requested resource was not found.", severity: "danger" }
4257
+ 404: { title: "Not found", description: "The requested resource was not found.", severity: "danger" },
4258
+ 405: {
4259
+ title: "Not supported",
4260
+ description: "It's not you. It's us. Sorry for the inconvenience.",
4261
+ severity: "danger"
4262
+ },
4263
+ 500: {
4264
+ title: "Server error",
4265
+ description: "Our server seems to be experiencing problems at the moment. We have been alerted and will fix the problem as soon as possible.",
4266
+ severity: "danger"
4267
+ }
4258
4268
  };
4259
4269
  function discard(reason, action, retries = 0) {
4260
4270
  var _a2;
@@ -7499,7 +7509,7 @@ class AgentService extends BaseApiService {
7499
7509
  * @param request The message to prompt the agent with.
7500
7510
  * @param conversationId If continuing an existing message, the UUID of that conversation.
7501
7511
  */
7502
- prompt(request2, conversationId) {
7512
+ async prompt(request2, conversationId) {
7503
7513
  const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
7504
7514
  return this.enqueueRequest({
7505
7515
  description: "Prompt agent",
@@ -7514,6 +7524,16 @@ class AgentService extends BaseApiService {
7514
7524
  queryParams: conversationId ? { conversation_id: conversationId } : {}
7515
7525
  });
7516
7526
  }
7527
+ async rate(responseId, rating) {
7528
+ return this.enqueueRequest({
7529
+ description: "Rate agent response",
7530
+ method: HttpMethod.PUT,
7531
+ url: `/agents/responses/${responseId}/rate/`,
7532
+ payload: { rating },
7533
+ blockers: ["rate"],
7534
+ blocks: ["rate"]
7535
+ });
7536
+ }
7517
7537
  }
7518
7538
  class OvermapSDK {
7519
7539
  constructor(apiUrl, store) {
@@ -13002,52 +13022,54 @@ const styles$4 = {
13002
13022
  Footer,
13003
13023
  Loading
13004
13024
  };
13005
- const ImageCard = memo((props) => {
13006
- const { file, alt, error: error2, size, rightSlot, className, truncateLength, ...rest } = props;
13007
- const fileCardRef = useRef(null);
13008
- const imageInsetRef = useRef(null);
13009
- const fileCardSize = useSize(fileCardRef);
13010
- useLayoutEffect(() => {
13011
- if (!imageInsetRef.current || !fileCardSize)
13012
- return;
13013
- imageInsetRef.current.style.height = `${fileCardSize.height * 4}px`;
13014
- }, [fileCardSize]);
13015
- const fileName2 = useMemo(() => {
13016
- if (!file)
13017
- return;
13018
- return truncateLength !== void 0 ? truncate(file.name, truncateLength) : file.name;
13019
- }, [file, truncateLength]);
13020
- return /* @__PURE__ */ jsxs(
13021
- Flex,
13022
- {
13023
- className: classNames$1(className, styles$4.ImageCard),
13024
- width: "100%",
13025
- direction: "column",
13026
- position: "relative",
13027
- height: "max-content",
13028
- gap: "0",
13029
- ...rest,
13030
- children: [
13031
- !file && !error2 && /* @__PURE__ */ jsx(Flex, { width: "100%", height: "100%", align: "center", justify: "center", position: "absolute", children: /* @__PURE__ */ jsx(Spinner, {}) }),
13032
- /* @__PURE__ */ jsx(Inset, { className: styles$4.ImageInset, ref: imageInsetRef, clip: "padding-box", side: "y", pb: "0", children: file && !error2 && /* @__PURE__ */ jsx("img", { className: styles$4.Image, src: URL.createObjectURL(file), alt: alt ?? file.name }) }),
13033
- /* @__PURE__ */ jsx(
13034
- OvermapItem,
13035
- {
13036
- className: classNames$1(styles$4.Footer, {
13037
- [styles$4.Loading]: !file
13038
- }),
13039
- size,
13040
- ref: fileCardRef,
13041
- leftSlot: error2 ? /* @__PURE__ */ jsx(RiIcon, { icon: "RiFileWarningLine" }) : file && /* @__PURE__ */ jsx(FileIcon, { fileType: file.type }),
13042
- rightSlot,
13043
- children: error2 ?? fileName2
13044
- }
13045
- )
13046
- ]
13047
- }
13048
- );
13049
- });
13050
- ImageCard.displayName = "ImageCard";
13025
+ const ImageCard = memo(
13026
+ forwardRef((props, forwardedRef) => {
13027
+ const { file, alt, error: error2, size, rightSlot, className, truncateLength, ...rest } = props;
13028
+ const fileCardRef = useRef(null);
13029
+ const imageInsetRef = useRef(null);
13030
+ const fileCardSize = useSize(fileCardRef);
13031
+ useLayoutEffect(() => {
13032
+ if (!imageInsetRef.current || !fileCardSize)
13033
+ return;
13034
+ imageInsetRef.current.style.height = `${fileCardSize.height * 4}px`;
13035
+ }, [fileCardSize]);
13036
+ const fileName2 = useMemo(() => {
13037
+ if (!file)
13038
+ return;
13039
+ return truncateLength !== void 0 ? truncate(file.name, truncateLength) : file.name;
13040
+ }, [file, truncateLength]);
13041
+ return /* @__PURE__ */ jsxs(
13042
+ Flex,
13043
+ {
13044
+ className: classNames$1(className, styles$4.ImageCard),
13045
+ width: "100%",
13046
+ direction: "column",
13047
+ position: "relative",
13048
+ height: "max-content",
13049
+ gap: "0",
13050
+ ref: forwardedRef,
13051
+ ...rest,
13052
+ children: [
13053
+ !file && !error2 && /* @__PURE__ */ jsx(Flex, { width: "100%", height: "100%", align: "center", justify: "center", position: "absolute", children: /* @__PURE__ */ jsx(Spinner, {}) }),
13054
+ /* @__PURE__ */ jsx(Inset, { className: styles$4.ImageInset, ref: imageInsetRef, clip: "padding-box", side: "y", pb: "0", children: file && !error2 && /* @__PURE__ */ jsx("img", { className: styles$4.Image, src: URL.createObjectURL(file), alt: alt ?? file.name }) }),
13055
+ /* @__PURE__ */ jsx(
13056
+ OvermapItem,
13057
+ {
13058
+ className: classNames$1(styles$4.Footer, {
13059
+ [styles$4.Loading]: !file
13060
+ }),
13061
+ size,
13062
+ ref: fileCardRef,
13063
+ leftSlot: error2 ? /* @__PURE__ */ jsx(RiIcon, { icon: "RiFileWarningLine" }) : file && /* @__PURE__ */ jsx(FileIcon, { fileType: file.type }),
13064
+ rightSlot,
13065
+ children: error2 ?? fileName2
13066
+ }
13067
+ )
13068
+ ]
13069
+ }
13070
+ );
13071
+ })
13072
+ );
13051
13073
  const UploadInput = memo((props) => {
13052
13074
  var _a2;
13053
13075
  const [{ inputId, labelId, size, severity, helpText, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);