Wondering why the code generation has stopped working all of a sudden

Seems the code generation is failing 100%

Anyone have any suggestions? Backend issues like this normal where code does not get produced only paragraph text?

Thanks!

6 Likes

Is this ChatGPT? API?

What’s your prompt?

1 Like

Any prompt that I ask for code right now will not produce any body code.

gpt4

I even accessed s secondary workspace and ran into the same issue.

2 Likes

Have you tried starting a new thread?

If it still doesn’t work in a fresh thread, I’d try back. There were some reports on ChatGPT on status.openai.com today, I believe…

1 Like

Yeah fresh thread, Cracked open my secondary account, fresh thread… All no go.

Yeah… time will tell. Funny how it spits out only one line of code… it has been working great for the most part since I had my account open.

1 Like

Could be you’re asking too much. I’ve noticed it does that (you can fill the rest yourself here) if it doesn’t “think” it has enough tokens because you’re request is huge. Can you try breaking it down to a simpler prompt asking for one thing at once? What is the OG prompt?

well I think it is working again. :slight_smile:

1 Like

well I have narrowed it down to I think this pathdata haha

really jams things up.

1 Like

Nope. Still no go.

Fresh thread. Doesn’t like what I am doing right now.

1 Like

You could try to ask it to give you only code and no explanation. Or find a model better suited for code. There’s quite a few now.

1 Like

wowzers. Now it is working.

ok. LFG!

2 Likes

I am experiencing this as well. Fresh conversations, cookies cleared, across multiple different models. Seems to be freezing

2 Likes

It’s having trouble specifically with generating XML files right now, regular code is no problem though.

See for yourself, ask it to generate a sample XML for use in android studio, if it works for you right now I’d be surprised.

2 Likes

Same here. I am asking questions about Javascript and it keeps going into an infinite loop. I did not ask for an example of that topic.

3 Likes

yeah you can see where it tried to do the Step 2: twice.

So far it seems the xml generation is causing issues while the .java was generated pretty fast.

2 Likes

yeah the xml generation is a little nuked right now.

2 Likes

SOLVED: :rofl: :rofl:

Here’s the non-XML breakdown:

  • Create a declare-styleable named GearButtonView.
  • Add an attribute named shape inside the GearButtonView styleable.
  • Define an enum for shape with values:
    • 0 for circle
    • 1 for rectangle
  • Set the default value to 0 for the circle.

Using These Attributes in Your Java Code

After defining these attributes, you can access them in your Java code. Here’s how you can modify the init method to use the shape attribute:

  1. Modify the init Method
  • Use TypedArray to obtain the styled attributes from context and attrs.
  • Retrieve the shape attribute using getInt method, with 0 as the default value to fallback to circle.
  • Use a switch or if-else statement to set the currentShape based on the retrieved value.
  1. Example Snippet for the init Method:
  • Fetch the shape attribute from the TypedArray.
  • Set currentShape to Shape.CIRCLE or Shape.RECTANGLE based on the fetched value.
  • Don’t forget to call recycle on your TypedArray to free up memory.
2 Likes

TEMP SOLUTION

24h Later. Still broken but a work around has been figured out!

I was thinking if all xml generation is trying to output it needs a method of outputting without issue… Lets just use Mr. Json

And it will output a nice json file that holds the same xml data

Solution is requesting for JSON instead of XML will work!

here is a working python script (needs more work) to convert android outputed json to xml :slight_smile: njoy

import json
import xml.etree.ElementTree as ET
from xml.dom import minidom
import argparse
import html

# Declare the Android namespace globally
ANDROID_NS = 'http://schemas.android.com/apk/res/android'
ET.register_namespace('android', ANDROID_NS)

def json_to_xml(json_data):
    def build_xml_element(data, tag):
        # Handle special namespace prefix for Android
        element = ET.Element(tag.split('.')[-1])  # Use only the class name as the tag

        # Handle attributes and children separately
        for key, value in data.items():
            if key == 'android:children':
                for child in value:
                    # Recursively handle child elements
                    child_tag = list(child.keys())[0]
                    child_element = build_xml_element(child[child_tag], child_tag)
                    element.append(child_element)
            else:
                # Attributes need to use the correct namespace
                attribute_name = key.replace(':', '}')
                attribute_name = f"{{{ANDROID_NS}}}{attribute_name.split('}')[-1]}"
                element.set(attribute_name, value)

        return element

    # Start with the root element from JSON
    root_key = next(iter(json_data))
    root_element = build_xml_element(json_data[root_key], root_key)

    return root_element

def main():
    parser = argparse.ArgumentParser(description='Convert JSON to XML for Android layout.')
    parser.add_argument('input_json', type=str, help='Input JSON file path')
    parser.add_argument('output_xml', type=str, help='Output XML file path')
    args = parser.parse_args()

    with open(args.input_json, 'r') as file:
        data = json.load(file)

    root_element = json_to_xml(data)

    # Generate pretty printed XML string using minidom
    rough_string = ET.tostring(root_element, 'utf-8')
    reparsed = minidom.parseString(rough_string)
    pretty_xml_as_string = reparsed.toprettyxml(indent="    ")

    # Write the pretty-printed XML to file
    with open(args.output_xml, 'w') as output_file:
        output_file.write(pretty_xml_as_string)
        print(f"Formatted Android XML file created successfully: {args.output_xml}")

if __name__ == "__main__":
    main()

3 Likes

Has anyone else experience issues today with gpt-35. I am experiencing that it fails consequently to create code boxes and ends up in an endless loop.

3 Likes

I have been getting this for two days, it will not generate code, freezes and does that.

4 Likes