Skip to content

Commit

Permalink
Server URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
luozhiya committed Sep 27, 2024
1 parent f58b516 commit 741d06b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
16 changes: 15 additions & 1 deletion lua/fittencode/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 7 additions & 2 deletions lua/fittencode/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 741d06b

Please sign in to comment.