diff --git a/lua/fittencode/client.lua b/lua/fittencode/client.lua index 4ef075b5..73c6ee85 100644 --- a/lua/fittencode/client.lua +++ b/lua/fittencode/client.lua @@ -27,9 +27,23 @@ local urls = { add_files_and_directories = '/codeapi/rag/add_files_and_directories', } +local server_urls = { + ['+0800'] = 'https://fc.fittenlab.cn', +} + +setmetatable(server_urls, { + __index = function() + return 'https://fc.fittenlab.com' + end +}) + +if Config.fitten.server_url == '' then + Config.fitten.server_url = server_urls[os.date('%z')] +end + for k, v in pairs(urls) do if not v:match('^https?://') then - urls[k] = Config.fitten.api_endpoint .. v + urls[k] = Config.fitten.server_url .. v end end diff --git a/lua/fittencode/config.lua b/lua/fittencode/config.lua index 536c540c..f4ba9b9a 100644 --- a/lua/fittencode/config.lua +++ b/lua/fittencode/config.lua @@ -11,8 +11,13 @@ local defaults = { -- * 'default' -- * 'enterprise' version = 'default', - api_endpoint = 'https://fc.fittenlab.cn', - api_key = '', + -- The server URL for Fitten Code. + -- Fitten Code will detect the server URL based on your timezone automatically if it's not set. + -- You can also change it to your own server URL if you have a private server. + -- Default server URL for different regions: + -- * China: 'https://fc.fittenlab.cn' + -- * International: 'https://fc.fittenlab.com' + server_url = '', }, action = { document_code = {