Skip to content

Autocomplete 404 (while Chat works fine) #491

@MagicJinn

Description

@MagicJinn

Describe the bug
Whenever I type into my VSCode, no completions appear. When checking logs, I see a 404 error. However, the same does not happen when using the chat window with the same model. It's ONLY a problem with AutoComplete.

Logging

[INFO] ***Twinny Stream Debug***
    Streaming response from 0.0.0.0:11434.
    Request body:
    {
  "model": "codellama:7b-code",
  "prompt": "<PRE> \n\n/* Language: C# (csharp) */\n/* File uri: file:///c%3A/Users/MagicJinn/Documents/GitHub/This-Trip/Assets/Scripts/Terrain/Landmark.cs (csharp) */\nusing UnityEngine;\r\n\r\npublic class Landmark : Thing\r\n{\r\n    [Header(\"Flattening Settings\")]\r\n    [Tooltip(\"Whether the landmark should flatten area under the landmark or not.\")]\r\n    public bool ShouldFlatten = true;\r\n    [Tooltip(\"Radius around the landmark which will be flattened.\")]\r\n    [SerializeField] private float FlattenRadius = 10f;\r\n    [Tooltip(\"How much the terrain will be flattened. 0 is no flattening, 1 is full flattening.\")]\r\n    [SerializeField] private float FlattenStrength = 1f;\r\n    [Tooltip(\"Terrain height difference threshold for landmark placement viability.\")]\r\n    [SerializeField] private float HeightDifferenceThreshold = 7f;\r\n\r\n    //Ray length for terrain height check under the landmark.\r\n    private static readonly float RayLength = 500;\r\n\r\n    [Tooltip(\"Resolution of the raycast grid. Amount of rays per unit square.\")]\r\n    [SerializeField] private float RaysPerUnit = 0.15f;\r\n <SUF> \r\n    private GameObject _terrainClearanceChecker;\r\n    private MeshFilter _terrainClearanceCheckerMeshFilter;\r\n    public Chunk ChunkImIn;\r\n\r\n    // Rigidbody misbehaves if there's a mesh thing attached, so we have to mark it Kinematic\r\n    private Rigidbody _rigidbody;\r\n    private bool _hasRigidbody;\r\n\r\n    private void Awake()\r\n    {\r\n        // Mark Rigidbody kinematic to prevent issues\r\n        _hasRigidbody = TryGetComponent(out _rigidbody);\r\n\r\n        if (_hasRigidbody)\r\n        {\r\n            _rigidbody.isKinematic = true;\r\n        }\r\n\r\n        _terrainClearanceChecker = transform.Find(\"TerrainClearanceChecker\").gameObject;\r\n\r\n        if (_terrainClearanceChecker == null)\r\n        {\r\n            Debug.LogWarning($\"TerrainClearanceChecker not found in the hierarchy of {gameObject.name}\");\r\n            gameObject.SetActive(false);\r\n            return;\r\n        }\r\n\r\n        _terrainClearanceCheckerMeshFilter = _terrainClearanceChecker.GetComponent<MeshFilter>();\r\n    }\r\n\r\n    private void Start()\r\n    {\r\n        Waiter.Instance.AddSaveDoneAction(() =>\r\n        {\r\n            var thingData = SaveManager.Instance.GetYourThings(this);\r\n            if (thingData == null) // $TODO this will 10000000000% come to bite me in the ass\r\n            {\r\n                Benchmarker.StartBenchmark(nameof(PositionOnTerrainAndFlatten), gameObject.GetInstanceID());\r\n                PositionOnTerrainAndFlatten();\r\n                Benchmarker.StopBenchmark(nameof(PositionOnTerrainAndFlatten), gameObject.GetInstanceID());\r\n            }\r\n            else\r\n            {\r\n                ApplyThingData(thingData);\r\n            }\r\n            _terrainClearanceChecker.SetActive(false); // Disable the checker  \r\n\r\n            // Make rigidbody non-kinematic again\r\n            if (_hasRigidbody)\r\n            {\r\n                if (!IsFrozen) // Other scripts might freeze the landmark, so we need to check\r\n                {\r\n                    _rigidbody.isKinematic = false;\r\n                }\r\n            }\r\n        });\r\n    }\r\n\r\n    public Vector2 HowWideAmI()\r\n    {\r\n        var bounds = _terrainClearanceChecker.GetComponent<Renderer>().bounds;\r\n        return new Vector2(bounds.size.x, bounds.size.z) + (new Vector2(FlattenRadius, FlattenRadius) * 2); // 2x to account for both sides\r\n    }\r\n\r\n    public float HowTallAmI()\r\n    {\r\n        return GetComponent<Renderer>().bounds.size.y;\r\n    }\r\n\r\n    private void PositionOnTerrainAndFlatten()\r\n    {\r\n        Collider clearanceCollider = _terrainClearanceChecker.GetComponent<Collider>();\r\n        if (clearanceCollider == null) Debug.LogWarning(\"Clearance Checker not found in \" + gameObject.name);\r\n\r\n        Vector3 boundsSize = clearanceCollider.bounds.size;\r\n        Vector3 checkerPosition = _terrainClearanceChecker.transform.position;\r\n\r\n        float highest = float.MinValue;\r\n        float lowest = float.MaxValue;\r\n        // bool hitSomething = false;\r\n <MID>",
  "stream": true,
  "keep_alive": "5m",
  "options": {
    "temperature": 0.2,
    "num_predict": 512
  }
}

    Request options:
    {
  "hostname": "0.0.0.0",
  "port": 11434,
  "path": "/api/generate",
  "protocol": "http",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "Authorization": ""
  }
}

    Number characters in all messages = 0
[ERROR_error] Fetch error
  Error Type: Error
  Error Message: Server responded with status code: 404

API Provider
Ollama

Chat or Auto Complete?
Auto Complete

Model Name
codellama:7b-code or any others.

Desktop (please complete the following information):
Windows 10

Additional notes:
Fresh install of Twinny, no settings changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions