something isn't resetting correctly on the next generation, the first generation follows the text of prompt and lyrics but second one dosnt follow it please fix and return entire code ty.

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.Networking;

public class ACEStepRuntimeInference : MonoBehaviour
{
    [Header("Server Settings")]
    [Tooltip("Base URL of the inference server (no trailing slash)")]
    public string serverBaseUrl = "http://localhost:8000";

    [Header("Input Parameters")]

    public string checkpoint_path = "";

    public bool bf16 = true;
    public bool torch_compile = false;
    public int device_id = 0;

    [Tooltip("Ignored by server")]
    public string output_path = ""; // Kept for completeness

    public float audio_duration = 10f;

    [TextArea(2, 5)]
    public string prompt = "";

    [TextArea(2, 5)]
    public string lyrics = "";

    public int infer_step = 50;

    public float guidance_scale = 7.5f;

    public string scheduler_type = "euler";

    public string cfg_type = "apg";

    public float omega_scale = 1.0f;

    [Tooltip("Seeds for random generator")]
    public List<int> actual_seeds = new List<int> { };

    public float guidance_interval = 1.0f;

    public float guidance_interval_decay = 0.0f;

    public float min_guidance_scale = 0.0f;

    public bool use_erg_tag = false;
    public bool use_erg_lyric = false;
    public bool use_erg_diffusion = false;

    [Tooltip("OSS steps")]
    public List<int> oss_steps = new List<int> { };

    public float guidance_scale_text = 0.0f;
    public float guidance_scale_lyric = 0.0f;

    [Header("Output")]
    [Tooltip("Local folder to save downloaded audio")]
    public string localSaveFolder;

    [Header("Generation Result")]
    [Tooltip("AudioClip loaded from the generated audio file")]
    public AudioClip GenerationResult;

    [Header("Generation State")]
    [Tooltip("True when generation is in progress")]
    public bool IsGenerating = false;

    private ACEStepClient client;

    void Awake()
    {
        if (string.IsNullOrEmpty(localSaveFolder))
        {
            localSaveFolder = Path.Combine(Application.persistentDataPath, "GeneratedAudio");
        }

        if (!Directory.Exists(localSaveFolder))
        {
            Directory.CreateDirectory(localSaveFolder);
        }

        client = GetComponent<ACEStepClient>();
        if (client == null)
        {
            client = gameObject.AddComponent<ACEStepClient>();
        }
        client.serverBaseUrl = serverBaseUrl;
    }

    [ContextMenu("Start Generate Audio")]
    public void StartGenerate()
    {
        if (IsGenerating)
        {
            Debug.LogWarning("Generation is already in progress.");
            return;
        }

        IsGenerating = true;
        var input = BuildACEStepInput();
        client.GenerateAudio(input, OnGenerateSuccess, OnGenerateError);
    }

    private ACEStepInput BuildACEStepInput()
    {
        return new ACEStepInput()
        {
            checkpoint_path = checkpoint_path,
            bf16 = bf16,
            torch_compile = torch_compile,
            device_id = device_id,
            output_path = output_path,
            audio_duration = audio_duration,
            prompt = prompt,
            lyrics = lyrics,
            infer_step = infer_step,
            guidance_scale = guidance_scale,
            scheduler_type = scheduler_type,
            cfg_type = cfg_type,
            omega_scale = omega_scale,
            actual_seeds = new List<int>(actual_seeds),
            guidance_interval = guidance_interval,
            guidance_interval_decay = guidance_interval_decay,
            min_guidance_scale = min_guidance_scale,
            use_erg_tag = use_erg_tag,
            use_erg_lyric = use_erg_lyric,
            use_erg_diffusion = use_erg_diffusion,
            oss_steps = new List<int>(oss_steps),
            guidance_scale_text = guidance_scale_text,
            guidance_scale_lyric = guidance_scale_lyric,
        };
    }

    private void OnGenerateSuccess(ACEStepOutput output)
    {
        Debug.Log("Generation success! Server returned output path: " + output.output_path);

        if (string.IsNullOrEmpty(output.output_path))
        {
            Debug.LogWarning("Output path from server is empty");
            SetFilePathText("No output file returned from server");
            IsGenerating = false;
            return;
        }

        // Start download coroutine with the filename returned by the server
        StartCoroutine(DownloadAndSaveAudio(output.output_path));
    }

    private void OnGenerateError(string error)
    {
        Debug.LogError("Generation failed: " + error);
        SetFilePathText("Generation failed: " + error);
        IsGenerating = false;
    }

    private IEnumerator DownloadAndSaveAudio(string filename)
    {
        if (string.IsNullOrEmpty(filename))
        {
            Debug.LogError("No filename received from server to download.");
            IsGenerating = false;
            yield break;
        }

        string downloadUrl = $"{serverBaseUrl.TrimEnd('/')}/files/{filename}";

        using (UnityWebRequest www = UnityWebRequest.Get(downloadUrl))
        {
            yield return www.SendWebRequest();

#if UNITY_2020_1_OR_NEWER
            bool error = www.result == UnityWebRequest.Result.ConnectionError || www.result == UnityWebRequest.Result.ProtocolError;
#else
            bool error = www.isNetworkError || www.isHttpError;
#endif
            if (error)
            {
                Debug.LogError($"Failed to download generated audio: {www.error}");
                SetFilePathText("Download failed: " + www.error);
                IsGenerating = false;
                yield break;
            }

            byte[] audioBytes = www.downloadHandler.data;

            if (!Directory.Exists(localSaveFolder))
            {
                try
                {
                    Directory.CreateDirectory(localSaveFolder);
                }
                catch (Exception e)
                {
                    Debug.LogError($"Failed to create local save directory: {e.Message}");
                    SetFilePathText("Failed to create save folder: " + e.Message);
                    IsGenerating = false;
                    yield break;
                }
            }

            string localPath = Path.Combine(localSaveFolder, filename);

            try
            {
                File.WriteAllBytes(localPath, audioBytes);
                Debug.Log($"Saved audio file locally at: {localPath}");
            }
            catch (Exception e)
            {
                Debug.LogError($"Error saving audio file: {e.Message}");
                SetFilePathText("Error saving audio file: " + e.Message);
                IsGenerating = false;
                yield break;
            }

            SetFilePathText(localPath);
            IsGenerating = false;
        }
    }

    private void SetFilePathText(string pathOrMessage)
    {
        // If pathOrMessage is a valid existing file path, try to load it as an AudioClip via file:// URI
        if (!string.IsNullOrEmpty(pathOrMessage) && File.Exists(pathOrMessage))
        {
            StartCoroutine(LoadAudioClipFromFile(pathOrMessage));
        }
        else
        {
            // Probably an error message or invalid path - clear clip
            Debug.LogWarning(pathOrMessage);
            GenerationResult = null;
        }
    }

    private IEnumerator LoadAudioClipFromFile(string filePath)
    {
        if (!File.Exists(filePath))
        {
            Debug.LogError($"Audio file not found on disk: {filePath}");
            GenerationResult = null;
            yield break;
        }

        string uri = "file://" + filePath;

        AudioType audioType = GetAudioTypeFromFileExtension(filePath);

        using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(uri, audioType))
        {
            yield return www.SendWebRequest();

#if UNITY_2020_1_OR_NEWER
            bool isError = www.result == UnityWebRequest.Result.ConnectionError || www.result == UnityWebRequest.Result.ProtocolError;
#else
            bool isError = www.isNetworkError || www.isHttpError;
#endif
            if (isError)
            {
                Debug.LogError($"Failed to load audio clip from file: {www.error}");
                GenerationResult = null;
            }
            else
            {
                var clip = DownloadHandlerAudioClip.GetContent(www);
                if (clip == null)
                {
                    Debug.LogError("Loaded AudioClip is null");
                    GenerationResult = null;
                }
                else
                {
                    Debug.Log($"AudioClip loaded successfully from {filePath}");
                    GenerationResult = clip;
                    output_path = filePath;
                }
            }
        }
    }

    private AudioType GetAudioTypeFromFileExtension(string filePath)
    {
        string ext = Path.GetExtension(filePath).ToLowerInvariant();
        switch (ext)
        {
            case ".wav": return AudioType.WAV;
            case ".mp3": return AudioType.MPEG;
            case ".ogg": return AudioType.OGGVORBIS;
            case ".aiff": return AudioType.AIFF;
            case ".mod": return AudioType.MOD;
            case ".xm": return AudioType.XM;
            case ".it": return AudioType.IT;
            case ".s3m": return AudioType.S3M;
            default:
                Debug.LogWarning($"Unknown audio extension '{ext}', defaulting to WAV");
                return AudioType.WAV;
        }
    }
}