Skip to content

Bug: native mode filepath bas path is not populating #514

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

Closed
nerdalert opened this issue Jan 28, 2025 · 4 comments · Fixed by #558
Closed

Bug: native mode filepath bas path is not populating #514

nerdalert opened this issue Jan 28, 2025 · 4 comments · Fixed by #558
Labels
help wanted Extra attention is needed
Milestone

Comments

@nerdalert
Copy link
Member

/undefined/knowledgefiles/foo.md

Needs to use the NEXT_PUBLIC_TAXONOMY_ROOT_DIR as the base.

@nerdalert nerdalert added bug help wanted Extra attention is needed labels Jan 28, 2025
@vishnoianil vishnoianil added this to UI Jan 29, 2025
@vishnoianil vishnoianil moved this to Ready in UI Jan 29, 2025
@vishnoianil vishnoianil added this to the release-1.1 milestone Jan 29, 2025
@elkielki
Copy link
Collaborator

elkielki commented Feb 6, 2025

@nerdalert Hi, I would like to work on this. Can I get some more info on it? How can I replicate this bug?

@nerdalert
Copy link
Member Author

nerdalert commented Feb 7, 2025

@nerdalert Hi, I would like to work on this. Can I get some more info on it? How can I replicate this bug?

Hi @elkielki apologies for the slow replay, was open pto. There is a bug in uploading, once that is fixed I will shoot over where to change the code.

I * think * it will look something like this but can't verify until the file upload is patched:

$ git diff
diff --git a/src/components/Contribute/Knowledge/Native/index.tsx b/src/components/Contribute/Knowledge/Native/index.tsx
index b8bddd2..deaeae4 100644
--- a/src/components/Contribute/Knowledge/Native/index.tsx
+++ b/src/components/Contribute/Knowledge/Native/index.tsx
@@ -73,6 +73,7 @@ export const KnowledgeFormNative: React.FunctionComponent<KnowledgeFormProps> =
   const [filePath, setFilePath] = useState<string>('');
 
   // Document Information (using fields from KnowledgeFormData)
+  const LOCAL_TAXONOMY_ROOT_DIR = process.env.NEXT_PUBLIC_LOCAL_TAXONOMY_ROOT_DIR || `${process.env.HOME}/.instructlab-ui`;
   const [knowledgeDocumentRepositoryUrl, setKnowledgeDocumentRepositoryUrl] = useState<string>('');
   const [knowledgeDocumentCommit, setKnowledgeDocumentCommit] = useState<string>('');
   const [documentName, setDocumentName] = useState<string>(''); // store as comma-separated
@@ -390,7 +391,7 @@ export const KnowledgeFormNative: React.FunctionComponent<KnowledgeFormProps> =
 
       // Set repositoryUrl if not set
       if (!knowledgeDocumentRepositoryUrl) {
-        const baseUrl = repoUrl.replace(/\/[^/]+$/, '');
+        const baseUrl = `${LOCAL_TAXONOMY_ROOT_DIR}/taxonomy-knowledge-docs`;
         setKnowledgeDocumentRepositoryUrl(baseUrl);
         devLog(`Set knowledgeDocumentRepositoryUrl to: ${baseUrl}`);
       }
@@ -463,7 +464,7 @@ export const KnowledgeFormNative: React.FunctionComponent<KnowledgeFormProps> =
     setDocumentOutline(autoFillKnowledgeFields.documentOutline);
     setSubmissionSummary(autoFillKnowledgeFields.submissionSummary);
     setDomain(autoFillKnowledgeFields.domain);
-    setKnowledgeDocumentRepositoryUrl('~/.instructlab-ui/taxonomy-knowledge-docs');
+    setKnowledgeDocumentRepositoryUrl(`${LOCAL_TAXONOMY_ROOT_DIR}/taxonomy-knowledge-docs`);
     setKnowledgeDocumentCommit(autoFillKnowledgeFields.knowledgeDocumentCommit);
     setDocumentName(autoFillKnowledgeFields.documentName);
     setFilePath(autoFillKnowledgeFields.filePath);

Ty ty

@vishnoianil
Copy link
Member

While fixing the document upload issue, i fixed this issue as well through the following PR : #557

sorry for the inconvenience @elkielki . If you wan to pick up another issue, these two are good candidate,

#465
#454

or anything that's tagged with help wanted or good first issue

@elkielki
Copy link
Collaborator

elkielki commented Feb 8, 2025

@vishnoianil @nerdalert No problem :) I'll check those issues out instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
Status: Done
3 participants