这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@shatfield4
Copy link
Collaborator

resolves #338

Check if hostname is a hosted instance and disables uploading of exported anythingllm data to prevent users from corrupting their db schema on older versions.

@shatfield4 shatfield4 linked an issue Nov 6, 2023 that may be closed by this pull request
@review-agent-prime
Copy link

frontend/src/pages/GeneralSettings/ExportImport/index.jsx

Extracting the logic to check if the instance is hosted into a separate function will make the code more readable and maintainable. This function can be reused in other parts of the code if needed.
Create Issue

    const isHostedInstance = () => {
      const hostname = window.location.hostname;
      return hostname.includes(".useanything.com");
    }

    // Then use it in your component
    const isHosted = isHostedInstance();

By using the useCallback hook, you can prevent unnecessary re-renders of the component when the handleUpload function is not changed. This can improve the performance of your application.
Create Issue

    const handleUpload = useCallback(async (e) => {
      setLoading(true);
      e.preventDefault();
      setFile(null);
      setResult(null);

      const file = e.target.files?.[0];
      if (!file) {
        showToast("Invalid file upload", "error");
        return false;
      }

      setFile(file);
      setLoading(true);
      const formData = new FormData();
      formData.append("file", file, file.name);
      const { success, error } = await System.importData(formData);
      if (!success) {
        showToast(`Failed to import data: ${error}`, "error");
      } else {
        setResult(true);
        showToast(`Successfully imported ${file.name}`, "success");
      }

      setLoading(false);
      setFile(null);
    }, []);

Comment on lines 51 to 52
const hostname = window.location.hostname;
const isHosted = hostname.includes(".useanything.com");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted the logic to check if the instance is hosted into a separate function to improve code readability and maintainability.

Suggested change
const hostname = window.location.hostname;
const isHosted = hostname.includes(".useanything.com");
const isHostedInstance = () => {
const hostname = window.location.hostname;
return hostname.includes('.useanything.com');
}
const isHosted = isHostedInstance();

@timothycarambat timothycarambat merged commit 5673dc5 into master Nov 6, 2023
@timothycarambat timothycarambat deleted the 338-hide-importexport-on-hosted branch November 6, 2023 21:23
franzbischoff referenced this pull request in franzbischoff/anything-llm Nov 7, 2023
* disable import on hosted instances

* Update UI on disabled import/export

---------

Co-authored-by: timothycarambat <rambat1010@gmail.com>
franzbischoff referenced this pull request in franzbischoff/anything-llm Nov 7, 2023
* disable import on hosted instances

* Update UI on disabled import/export

---------

Co-authored-by: timothycarambat <rambat1010@gmail.com>
timothycarambat added a commit that referenced this pull request Nov 9, 2023
* Using OpenAI API locally

* Infinite prompt input and compression implementation (#332)

* WIP on continuous prompt window summary

* wip

* Move chat out of VDB
simplify chat interface
normalize LLM model interface
have compression abstraction
Cleanup compressor
TODO: Anthropic stuff

* Implement compression for Anythropic
Fix lancedb sources

* cleanup vectorDBs and check that lance, chroma, and pinecone are returning valid metadata sources

* Resolve Weaviate citation sources not working with schema

* comment cleanup

* disable import on hosted instances (#339)

* disable import on hosted instances

* Update UI on disabled import/export

---------

Co-authored-by: timothycarambat <rambat1010@gmail.com>

* Add support for gpt-4-turbo 128K model (#340)

resolves #336
Add support for gpt-4-turbo 128K model

* 315 show citations based on relevancy score (#316)

* settings for similarity score threshold and prisma schema updated

* prisma schema migration for adding similarityScore setting

* WIP

* Min score default change

* added similarityThreshold checking for all vectordb providers

* linting

---------

Co-authored-by: shatfield4 <seanhatfield5@gmail.com>

* rename localai to lmstudio

* forgot files that were renamed

* normalize model interface

* add model and context window limits

* update LMStudio tagline

* Fully working LMStudio integration

---------
Co-authored-by: Francisco Bischoff <984592+franzbischoff@users.noreply.github.com>
Co-authored-by: Timothy Carambat <rambat1010@gmail.com>
Co-authored-by: Sean Hatfield <seanhatfield5@gmail.com>
cabwds pushed a commit to cabwds/anything-llm that referenced this pull request Jul 3, 2025
* disable import on hosted instances

* Update UI on disabled import/export

---------

Co-authored-by: timothycarambat <rambat1010@gmail.com>
cabwds pushed a commit to cabwds/anything-llm that referenced this pull request Jul 3, 2025
* Using OpenAI API locally

* Infinite prompt input and compression implementation (Mintplex-Labs#332)

* WIP on continuous prompt window summary

* wip

* Move chat out of VDB
simplify chat interface
normalize LLM model interface
have compression abstraction
Cleanup compressor
TODO: Anthropic stuff

* Implement compression for Anythropic
Fix lancedb sources

* cleanup vectorDBs and check that lance, chroma, and pinecone are returning valid metadata sources

* Resolve Weaviate citation sources not working with schema

* comment cleanup

* disable import on hosted instances (Mintplex-Labs#339)

* disable import on hosted instances

* Update UI on disabled import/export

---------

Co-authored-by: timothycarambat <rambat1010@gmail.com>

* Add support for gpt-4-turbo 128K model (Mintplex-Labs#340)

resolves Mintplex-Labs#336
Add support for gpt-4-turbo 128K model

* 315 show citations based on relevancy score (Mintplex-Labs#316)

* settings for similarity score threshold and prisma schema updated

* prisma schema migration for adding similarityScore setting

* WIP

* Min score default change

* added similarityThreshold checking for all vectordb providers

* linting

---------

Co-authored-by: shatfield4 <seanhatfield5@gmail.com>

* rename localai to lmstudio

* forgot files that were renamed

* normalize model interface

* add model and context window limits

* update LMStudio tagline

* Fully working LMStudio integration

---------
Co-authored-by: Francisco Bischoff <984592+franzbischoff@users.noreply.github.com>
Co-authored-by: Timothy Carambat <rambat1010@gmail.com>
Co-authored-by: Sean Hatfield <seanhatfield5@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hide import/export on hosted

3 participants