
phi4chatbot
Create client-side Minecraft mod: use local Ollama phi4 model to answer chat; on chat message starting with !phi4 [question], post playerName: [answer]....
00—FreefabricClient1.21.1mod
phi4chatbot client mod
- Listens to all incoming chat and server/system messages on the client; triggers when a message starts with
!phi4. - Forwards the question to a local Ollama instance at
http://localhost:11434/api/generateusing thephi4model, stream disabled, temperature 1.0, max ~300 tokens, and system prompt “You are a helpful assistant.” - Sends the reply back to the server as
playerName: <answer>, so everyone sees it; whitespace in replies is flattened to a single line. - Only one request runs at a time; new triggers while busy show “phi4 busy; request ignored.”
- Failures or timeouts show a short client-side chat error (e.g.,
phi4 error: ...). - 60s timeout per request; requires the local Ollama server to be reachable on that URL.