Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support custom prompt for custom openai service #679

Merged
merged 23 commits into from
Sep 26, 2024
Merged

Conversation

tisfeng
Copy link
Owner

@tisfeng tisfeng commented Sep 17, 2024

Close #434

image

@tisfeng
Copy link
Owner Author

tisfeng commented Sep 21, 2024

Please review 🥺

@tisfeng
Copy link
Owner Author

tisfeng commented Sep 22, 2024

🫠

@Jerry23011
Copy link
Collaborator

I'll review this today

@Jerry23011
Copy link
Collaborator

Seems that I'm still getting the default system prompts after setting my own in settings?

{
  "stream": true,
  "model": "gpt-3.5-turbo-0125",
  "temperature": 0,
  "messages": [
    {
      "role": "system",
      "content": "You are a translation expert proficient in various languages, focusing solely on translating text without interpretation. You accurately understand the meanings of proper nouns, idioms, metaphors, allusions, and other obscure words in sentences, translating them appropriately based on the context and language environment. The translation should be natural and fluent. Only return the translated text, without including redundant quotes or additional notes."
    },
    {
      "role": "user",
      "content": "Translate the following English text into Simplified-Chinese text: \"\"\"The stock market has now reached a plateau.\"\"\""
    },
截屏2024-09-22 15 33 29

@tisfeng
Copy link
Owner Author

tisfeng commented Sep 23, 2024

It seems that you have not enabled "Enable Custom Prompt", and you are using the default translation prompt.

@Jerry23011
Copy link
Collaborator

OK it works now. Is it possible to expand the System prompt and User prompt sections only when users enabled it?

@tisfeng
Copy link
Owner Author

tisfeng commented Sep 24, 2024

Good idea, I have changed the code, now it shows custom prompt TextEditor only enabled.

@tisfeng
Copy link
Owner Author

tisfeng commented Sep 24, 2024

I tried to add a transition animation, but it looks a bit strange.

I'm not very familiar with SwiftUI animations, so if anyone is good at this, please help improve it.

iShot_2024-09-24_20.30.37.mp4

@phlpsong
Copy link
Collaborator

Do you think change TextEditor with title to vertical style will look better?

Screenshot 2024-09-24 at 22 11 51

@tisfeng
Copy link
Owner Author

tisfeng commented Sep 24, 2024

If we look at the TextEditor component in isolation, the VStack layout is good, but here, to maintain consistency with the overall style of the Form, HStack might be better.

I'm not sure, everyone what do you think?

HStack

30484

VStack

42871

@phlpsong
Copy link
Collaborator

The main reason is that TextEditor and title Text cannot well aligned. Use vertical style will look more clear.

@Jerry23011
Copy link
Collaborator

The main reason is that TextEditor and title Text cannot well aligned. Use vertical style will look more clear.

Vertical +1

@Jerry23011
Copy link
Collaborator

I tried to add a transition animation, but it looks a bit strange.

I'm not very familiar with SwiftUI animations, so if anyone is good at this, please help improve it.

iShot_2024-09-24_20.30.37.mp4

I would say the latest change is pretty neat without the transition.

I thought of DisclosureGroup's animation but don't know how it's implemented.

@tisfeng
Copy link
Owner Author

tisfeng commented Sep 26, 2024

ok, I've changed the title and TextEditor to a vertical layout.

I tried DisclosureGroup but it doesn't feel right here, just keep it that way for now.

Copy link
Collaborator

@phlpsong phlpsong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tisfeng tisfeng merged commit 67dc0fe into dev Sep 26, 2024
5 checks passed
@tisfeng tisfeng deleted the feat-custom-prompt branch September 26, 2024 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants