Skip to content

Commit

Permalink
fix: remove link_load_options usage, handled server side
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanorosanelli committed Nov 26, 2024
1 parent 6713996 commit b9349cc
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions components/Form/ChatbotLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ if (props.item.cmetadata) {
const statesStore = useStatesStore();
const collectionUuid = statesStore.collection?.uuid || '';
const metadataDefaults = statesStore.collection?.cmetadata?.metadata_defaults?.links || {};
const linkLoadOptions = statesStore.collection?.cmetadata?.link_load_options || [];
const integration = useIntegration();
const indexingResult = ref<'Indexed' | 'Not Indexed' | 'None'>('None');
Expand Down Expand Up @@ -138,7 +137,6 @@ const create = async () => {
link: url.value,
collection_id: collectionUuid,
metadata: { ...metadata, ...metadataDefaults },
options: linkOptions(url.value),
},
});
} catch (err) {
Expand All @@ -147,32 +145,6 @@ const create = async () => {
}
};
const linkOptions = (url: string): Record<string, any> => {
const uniqueKeys = new Set<string>();
linkLoadOptions.forEach((option: any) => {
Object.keys(option).forEach((key) => {
if (key !== 'url') {
uniqueKeys.add(key);
}
});
});
const options: Record<string, any> = {};
uniqueKeys.forEach((key) => {
options[key] = linkOptionsProperty(url, key);
});
return options;
};
const linkOptionsProperty = (url: string, property: string) => {
const option = linkLoadOptions.find((o: any) => o.url === url)?.[property];
if (option) {
return option;
}
return linkLoadOptions.find((o: any) => url.startsWith(o.url))?.[property];
};
const deleteLink = async () => {
isDeleting.value = true;
try {
Expand All @@ -199,7 +171,6 @@ const reindexLink = async (item: Record<string, any>, collection: string | undef
link: url,
collection_id: collection,
metadata: metadata,
options: linkOptions(url),
document_id: document_id,
},
});
Expand Down

0 comments on commit b9349cc

Please sign in to comment.