diff --git a/docs/self-hosting/advanced/settings-url-share.mdx b/docs/self-hosting/advanced/settings-url-share.mdx new file mode 100644 index 000000000000..179cdb516a2b --- /dev/null +++ b/docs/self-hosting/advanced/settings-url-share.mdx @@ -0,0 +1,100 @@ +# Share settings via URL + +LobeChat support import settings from external URL to quickly set up LobeChat configuration. + +The currently supported settings are: + +- `languageModel`: Language model settings + +## Import from URL + +Use the following URL format to import settings parameters from an external URL: + +```plaintext +https://lobehub.com/?settings= +https://lobehub.com/?settings={"languageModel":{"openai":{"apiKey":"user-key","endpoint":"https://lobehub.com/v1"}}} +``` + +Example of settings in JSON format: + +```json +{ + "languageModel": { + "openai": { + "apiKey": "user-key" + } + } +} +``` + +## Export settings to URL + +```ts +// Generate settings to export to URL +const settings = { + languageModel: { + openai: { + apiKey: 'user-key', + endpoint: 'https://lobehub.com/v1' + }, +}}; +// Convert settings to a JSON formatted string +const url = `/?settings=${JSON.stringify(settings)}`; +console.log(url); +// /?settings={"languageModel":{"openai":{"apiKey":"user-key","endpoint":"https://lobehub.com/v1"}}} +``` + + + LobeChat does not verify the correctness of the settings parameters in the URL, nor provide encryption or decryption methods. Please use with caution. + + +## Parameter schema + +### languageModel + +- Property name and type + +| Property name | Type | +|---------------|--------------------------------| +| anthropic | GeneralModelProviderConfig | +| azure | AzureOpenAIConfig | +| bedrock | AWSBedrockConfig | +| google | GeneralModelProviderConfig | +| groq | GeneralModelProviderConfig | +| minimax | GeneralModelProviderConfig | +| mistral | GeneralModelProviderConfig | +| moonshot | GeneralModelProviderConfig | +| ollama | GeneralModelProviderConfig | +| openai | GeneralModelProviderConfig | +| openrouter | GeneralModelProviderConfig | +| perplexity | GeneralModelProviderConfig | +| togetherai | GeneralModelProviderConfig | +| zeroone | GeneralModelProviderConfig | +| zhipu | GeneralModelProviderConfig | + +- Type `GeneralModelProviderConfig` + +| Property name | Type | Description | +|-----------------------|--------------------------|-----------------------------------------------------------------------------| +| apiKey | string | The API key for the model provider. | +| autoFetchModelLists | boolean | Whether to automatically fetch model lists. | +| enabled | boolean | Whether the model provider is enabled. | +| enabledModels | string[] | null | The IDs of the enabled models. | +| endpoint | string | The endpoint for the model provider. | +| fetchOnClient | boolean | Whether to fetch on the client. | + +- Type `AzureOpenAIConfig` +> Inherits the fields from `GeneralModelProviderConfig` + +| Property name | Type | Description | +|-----------------------|--------------------------|-----------------------------------------------------------------------------| +| apiVersion | string | The API version for Azure OpenAI. | + +- Type `AWSBedrockConfig` +> Inherits all fields from `GeneralModelProviderConfig` except `apiKey, endpoint` + +| Property name | Type | Description | +| accessKeyId | string | The access key ID for AWS Bedrock. | +| region | string | The region for AWS Bedrock. | +| secretAccessKey | string | The secret access key for AWS Bedrock. | + diff --git a/docs/self-hosting/advanced/settings-url-share.zh-CN.mdx b/docs/self-hosting/advanced/settings-url-share.zh-CN.mdx new file mode 100644 index 000000000000..269c687cbc65 --- /dev/null +++ b/docs/self-hosting/advanced/settings-url-share.zh-CN.mdx @@ -0,0 +1,100 @@ +# URL 分享设置参数 + +LobeChat 支持从外部 URL 导入设置参数,以便于快速设置 LobeChat 的配置。 + +目前支持的设置项有: + +- `languageModel`:语言模型设置 + +## 从 URL 中导入 + +使用以下 URL 格式,可以从外部 URL 导入设置参数: + +```plaintext +https://lobehub.com/?settings= +https://lobehub.com/?settings={"languageModel":{"openai":{"apiKey":"user-key","endpoint":"https://lobehub.com/v1"}}} +``` + +JSON格式的设置示例: + +```json +{ + "languageModel": { + "openai": { + "apiKey": "user-key" + } + } +} +``` + +## 将设置导出到 URL + +```ts +// 生成要导出到 URL 的设置 +const settings = { + languageModel: { + openai: { + apiKey: 'user-key', + endpoint: 'https://lobehub.com/v1' + }, +}}; +// 将设置转为 JSON 格式的字符串 +const url = `/?settings=${JSON.stringify(settings)}`; +console.log(url); +// /?settings={"languageModel":{"openai":{"apiKey":"user-key","endpoint":"https://lobehub.com/v1"}}} +``` + + + LobeChat 不对 URL 中的设置参数进行正确性校验,也不提供加密、解密方法,请谨慎使用。 + + +## 参数格式 + +### languageModel + +- 参数及其类型 + +| 参数名称 | 类型 | +|---------------|--------------------------------| +| anthropic | GeneralModelProviderConfig | +| azure | AzureOpenAIConfig | +| bedrock | AWSBedrockConfig | +| google | GeneralModelProviderConfig | +| groq | GeneralModelProviderConfig | +| minimax | GeneralModelProviderConfig | +| mistral | GeneralModelProviderConfig | +| moonshot | GeneralModelProviderConfig | +| ollama | GeneralModelProviderConfig | +| openai | GeneralModelProviderConfig | +| openrouter | GeneralModelProviderConfig | +| perplexity | GeneralModelProviderConfig | +| togetherai | GeneralModelProviderConfig | +| zeroone | GeneralModelProviderConfig | +| zhipu | GeneralModelProviderConfig | + +- 类型 `GeneralModelProviderConfig` + +| 参数 | TS 类型 | 描述 | +|-----------------------|--------------------------|-----------------------------------------------------------------------------| +| apiKey | string | 模型的 API 密钥。 | +| autoFetchModelLists | boolean | 是否自动获取模型列表。 | +| enabled | boolean | 是否启用该模型。 | +| enabledModels | string[] | 启用的模型的 ID。 | +| endpoint | string | 模型API端点。 | +| fetchOnClient | boolean | 是否在客户端发起请求,默认在服务端发起请求。 | + +- 类型 `AzureOpenAIConfig` +> 继承 `GeneralModelProviderConfig` 中的字段 + +| 参数 | TS 类型 | 描述 | +|-----------------------|--------------------------|-----------------------------------------------------------------------------| +| apiVersion | string | Azure OpenAI 的 API 版本。 | + +- 类型 `AWSBedrockConfig` +> 继承 `GeneralModelProviderConfig` 中除 `apiKey, endpoint` 外的所有字段 + +| 参数 | TS 类型 | 描述 | +|-----------------------|--------------------------|-----------------------------------------------------------------------------| +| accessKeyId | string | AWS Bedrock 的访问密钥 ID。 | +| region | string | AWS Bedrock 的区域。 | +| secretAccessKey | string | AWS Bedrock 的访问密钥。 |