This function initiates a server for ggfigdone, which can be accessed through a web browser. The web application enables users to manage and modify ggplot figures with ease. Users have the ability to:
Update the ggplot code by adding new components.
Adjust the figure size.
Download the figure as a PDF.
Download the data used to create the figure.
fd_server(
dir,
host = getOption("ggfigdone.host", "0.0.0.0"),
port = getOption("ggfigdone.port", 8080),
llm_api_key = getOption("ggfigdone.llm_api_key", NULL),
llm_api_url = getOption("ggfigdone.llm_api_url",
"https://api.openai.com/v1/chat/completions"),
llm_model = getOption("ggfigdone.llm_model", "gpt-4o-mini"),
llm_max_tokens = getOption("ggfigdone.llm_max_tokens", 1000),
llm_temperature = getOption("ggfigdone.llm_temperature", 0.5),
token = getOption("ggfigdone.token", TRUE),
auto_open = getOption("ggfigdone.auto_open", FALSE)
)
The directory of the ggfigdone database.
Server host name or IP address; the default is "0.0.0.0".
The port on which the server will run; the default is 8080.
The API key for the large language model service; the default is NULL. When NULL, the service will not be available.
The URL for the OpenAI language model; the default is "https://api.openai.com/v1/chat/completions".
The model to use for the large language model; the default is "gpt-4o-mini".
The maximum number of tokens to generate; the default is 1000.
The temperature for the language model; the default is 0.5. The temperature is a hyperparameter that controls the randomness of the generated text. Lower temperatures will generate more predictable text, while higher temperatures will generate more random text.
A logical value indicating whether a token should be used to access the server.
A logical value indicating whether the server should be opened in a web browser; the default is TRUE.
No return value, the function is called for its side effects.
By default the function will open a web browser to access the server.
You can configure the web browser by setting the options:
options(browser = "firefox") # Set Firefox as the default