Tabula Rasa
新闻详情

Development of Legal and Psychological Guidance Systems for Adolescents (ChatBot) Based on Large Language Models

发表时间:2025-08-03 17:56

Author: Wenhan Shi

School: Shenzhen Middle School

Supervising Teachers:

Jian Hu from Shenzhen Middle School

Shizhu He from Institute of Automation Chinese Academy of Sciences

October 5, 2024


Abstract

  Adolescents represent a unique demographic.Limited by their physical and cognitive development, they often require notonly protection but also focused attention. Even though many countries aroundthe world have established rules and laws for the protection of adolescents,teenagers still do not know how to deal with various problems in their daily life,leading to the occurrence of psychological issues such as depression, anxiety,behavioral disorders, and emotional disorders, and even legal issues such asinfringement and crime. When they meet these problems, they have no strong willto ask help from adults and DO need a channel for professional psychologicaland legal guidance.

  As a large language model (LLM), GenerativePre-trained Transformer (GPT) has been developed for several years. It has beenproven the capability of translation, intelligent communication (chatting) andQ&A system with excellent performance. The typical tools include ChatGPTfrom OpenAI company, ChatGLM from Zhipuai.co. While trained with massivegeneral data and to be very good chat tools, these GPT-based chat tools stillcan not provide professional guidance on psychological and legal foradolescents.

  In this paper, a GPT-based tool, named ChatBot,is developed based on ChatGLM model with Prompting and Retrieval AugmentedGeneration (RAG) techniques. The ChatBot can provide answers and suggestionsthat are psychologically and legally acceptable for teenagers. The developmentprocesses include data collection and cleaning, RAG processing, promptengineering and verification. Further improvements are planned to be publishedon my website for more testing in reality and get feedbacks for iterativeimprovements.


Keywords:

Legal and psychological system, GPT, RAG,prompt engineering, ChatGLM

Contents



1.    Introduction. 1

2.    Related works. 2

2.1Application of GPTs on legal2

2.2Application of GPTs on psychology. 2

3.    Methods. 3

3.1     Prompt engineering. 3

3.2     Retrieval augmented generation. 5

3.3     Fine tunning. 6

4.    Experiments. 7

4.1     Preliminaries. 7

4.1.1     Access to base LLMs. 7

4.1.2     Text embedding and similarity estimation. 9

4.2     Creating GPTs. 10

4.2.1     Data preparation. 11

4.2.2     GPT configuration. 12

4.3     ChatBot evaluation. 14

5.    Conclusion. 15

Reference. 17

Appendix. 18

Appendix ADomain knowledge file list18

Appendix BGPT answers comparison (in Chinese)20

Acknowledgement26



1.   Introduction

On March 10, 2024, three individuals namedZhang, Li, and Ma, who were all aged between 12 and 14, deliberately killed the13-year-old victim Wang in Handan City. The cold-blooded murder and burial ofthe victim by the three minors have aroused strong public outrage. Although theSupreme People's Procuratorate legally decided on April 8 to approve theprosecution of the three underage suspects, it reflects legal and psychologicalissues among minors that warrant societal reflection. Data from the SupremeProcuratorate shows a clear increase in juvenile delinquency in recent years,with 97,000 minors prosecuted in 2023. At the same time, crimes against minorshave also shown an upward trend. From 2020 to 2023, the procuratorateprosecuted a total of 243,000 crimes against minors, with an average annualincrease of 5.4%.[1] These imply although many rulesand laws for the protection of adolescents, teenagers still do not know how todeal with various problems and emotions in their daily study and life due tothe lack of psychological and legal knowledge. Therefore, professionalconsultants or assistants are quite valuable for them.

  Somenon-profit volunteer organizations are founded to provide professional serviceon psychological and legal issues for the adolescents. For example, QihangPublic Service Center of Futian District was established in 2014 which is thefirst professional social work agency serving juveniles involved in crime andlegal issues in Shenzhen. It is said that the Qihang have help more than 1000young people on legal or psychological problems since 2014. As a volunteer organization,Qihang has difficulties of extension on their service for more teenagers due-tolack of human resources. At another hand, quite a few teenagers are not willingto talk with strange adults about their secrets. Based on above, an intelligentand instantly chat tool for the adolescents to consult is required.

  Thebirth of the GPT (Generative Pre-trained Transformer) model marked asignificant milestone in the field of artificial intelligence. Introduced byOpenAI in 2018, GPT revolutionized natural language processing by leveragingdeep learning techniques. Through pre-training on vast amounts of text data,GPT learned to generate coherent and contextually relevant text. Itssuccessors, further expanded its capabilities, leading to more advanced andversatile AI applications in various domains, from language translation tocontent creation, especially for Intelligent chat/communication domains. Thevarious GPTs are trained with massive general data and they are not specifiedon the filed of psychological and legal for the adolescents without anyre-learning or tuning.  

   Therefore,the goal of this paper is to develop a GPT-based tool, named ChatBot, based oncurrent ChatGPT and ChatGLM model with Prompting and Retrieval AugmentedGeneration (RAG) techniques. The ChatBot can provide answers and suggestionsthat are psychologically and legally acceptable for teenagers.

2.   Related works

  Thekey to the new industrial revolution caused by AI is the application of GPTmodels in professional and vertical fields. Recently, there are several effortsto apply GPT models on the legal or mental health field.

  2.1 Application of GPTs on legal

LaWGPT was released on May 30 2023 by Pengxiao Song from NanjingUniversity as an opensource project. It is a Chinese-Llama tuned with Chineselegal knowledge[2]. There are two main models included, they are Legal-Base-7Bmodel trained with 500k Chinese judgement document as legal base model, and LaWGPT-7Bmodel trained with 300k Chinese law Q&A dataset as legal dialog model.LaWGPT can act as a lawyer to answer users legal questions, also can act as alaw expert to explain the legal concepts. Except the LaWGPT, Yuan-group fromPeking university also developed a opensource legal tool named ChatLaw.[3]

  SparkLaw AI is a commercial AI tool for providing legal consult service. It is buildbased on IFLYTEK Spark big model. It can be accessed from aihub.cn website. Nodetail information is disclosed.

  2.2 Application of GPTs on psychology

Huachuan Qiu and Hongliang He etc.al from Zhejiang University andWestlake University, jointly developed a specialized dialogue system for mentalhealth support in 2024.[4] The main feature of the system is supporting formulti-turn conversation. This work also contributes high-quality Chinesedialogue dataset related to mental health support and the data processguidance. The final system could be access at https://huggingface.co/qiuhuachuan/PsyChat.

  HarbinInstitute of Technology(HIT) had developed a conversation system in 2023 ,named QiaoBan, for emotional support in the context of children, primarilytargeting K12 elementary and middle school students as well as parents. [5]QiaoBan large model features three significant characteristics: 1) Guided bychild psychology theories such as emotion counseling theories. 2) High-quilitychild dialogue data construction. The high-quality dialogue data is collectedwith the participation of volunteers and experts with backgrounds in childpsychology. 3)Warm emotional support experience.

SoulChat was developed by the Guangdong provincial Key Laboratory ofHuman Digital Twin from South China University of Technology in 2023.[6] It wasbuilt based on ChatGLM-6B model with fine-tuning of all parameters. It supportsboth single-turn dialog and multi-turn dialog. Also it provides a conversationdataset named SoulChatCorpus (https://www.modelscope.cn/datasets/ YIRONGCHEN/SoulChatCorpus).

  Theabove related works demonstrate that the application of large models in fieldssuch as legal and psychological counseling is feasible. However, these modelsare all aimed at creating applications for general scenarios and are notsuitable for the specialized needs of legal and psychological counseling andguidance for minors required by this project.

3.   Methods

There are two methods to buildup a GPT large model for a verticalapplication domain. One method is to build GPT model from scratch. That means constructingan entire large model and tuning all parameters with cleaned data. It may cost severaldays even months with many GPUs equipped server clusters. The second method isto adjust the exist GPT model and only fine-tuning parameters in small scalerange if needed. In this paper, the second method is adopted by following theabove GPT cases and more feasibility. Several techniques of tuning exist GPTmodel are discussed as below.

3.1        Prompt engineering

A prompt in GPTmodels is defined as the textual input provided by users to guide the model’soutput. It could range from simple questions to detailed descriptions orspecific tasks.[8] It has become essential for extending the application oflarge language models. Generally, user sends out a question to a trained GPTmodel, and the GPT model sends back a response after implementation. In promptengineering situation, user prepares a set of textual descriptions as prompt,then sends out a question with the prompt together to a trained GPT model. Atthis time, the prompt provides more information for the GPT model to understandthe question. In a result, a more accuracy and reasonable response can beobtained. In essential, the prompt engineering is a way to enrich the questionfor the model. The figure 3-1 demonstrates a GPT model workflow without (left)or with (right) prompt engineering.  









Figure 3-1 GPT application with prompt engineering

A typical prompt is constructed by combining role,instructions, context, examples, input data and output data. Figure 3-2 is anexample from the mentioned MeChat project. A smart prompt line was inserted toask GPT model to support multi-turn dialog.[4]


Figure 3-2 Prompt engineering demonstration on MeChat


Prompt can not be designed perfectly at firsttime. It still needs to be optimized iteratively in generally. Some principleshave been raised up for prompt optimization, such as Chain-of-Thought Prompting(start with “Let’s think step by step”), Knowledge Generation Prompting, andTree of Thoughts Prompting. They will be used in different situations. Thereare also some tools to optimize a prompt such as Coze developed by ByteDancewhich designs a one-button optimization function for prompt.

In this paper,we use the GPTs creator and input prompts in a configure page, and optimize heprompt iteratively by manual.

3.2        Retrieval augmented generation

Retrieval Augmented Generation (RAG) [8] is one of the most populararchitectures in 2023, combining search technology with the promptingengineering of large models. Its working principle is to divide professionaldomain information (knowledge) text into small segments, then use a certainTransformer encoder model to convert these text segments into vector form and storeall the vectors in an index database. when user sent a query statement for thelarge language model, the same encoder model converts the user’s query into avector and then search in the index database with the vector. The system willfind the top k most relevant results, extract the corresponding text segmentsfrom the database, and then input these text segments as context informationinto the GPT model. At last, the GPT model responses to the user afterimplementation. The workflow can be demonstrated in figure 3-3 as below.

Figure 3-3 RAG based GPT workflow

There are three key steps to build up a RAG Vector database which iscalled Embedding progress.

Step 1 Text Segmentation: in general,domain knowledge is stored in a set of files. Limited by the token size of a transformermodel, texts in a file must be segmented. In general, texts could be split by naturalparagraphs or sentences.

Step2 Text Embedding: Each slice of textcould be transformed to a vector. All vectors will be stored in a vectordatabase with an Index. These embedding operations can be implemented by theBERT model. The most popular vector database is ElasticSearch.

Step3 Text Search: RAG will embed theuser input query statement into vector too, and then compare the vector withvectors stored in the vector database to find the similar one which presentsthe similar meanings in text. Figure 3-4 describes how to compare two sentencesin vector domain. Sentence A and Sentence B can be embedded into vector u andvector v. Then, the distance between vectors can be calculated cos-distance,which is described as follow equation.

The larger of cos means the much closer ofthe two vectors.  



Figure 3-4 Sentence comparison with vector domain

Figure 3-5 GPT model fine tuning

3.3        Fine tunning

  Thereis no parameter changed in the prompt engineering and RAG method for the existGPT model. If the domain knowledge is too large to input as prompt and RAG, afine-tuning technology should be used on the GPT model. In this situation, partof parameters of the GPT model will be fine tuned again, and this may cost muchcomputer resource and time. Figure 3-5 shows the model fine tuning. Fine-tunemodel means change original pre-trained parameters.

4.   Experiments

4.1        Preliminaries

4.1.1    Access to base LLMs

In recent years, the large language models have been developed rapidly.Many popular models appear from both international and domestic. The mostpopular LLMs are listed in table 4-1 below.


Table 4-1Most popular base LLMs

Country

Company

Product

Models

USA

OpenAI

ChatGPT

GPT-3.5/4.0

USA

Microsoft

Copilot

GPT-4.0

USA

Google

Gemini

Gemini

USA

Anthropic

Claude

Claude

China

Baidu

Wenxinyiyan

Wenxin4.0

China

Alibaba

Tongyiqianwen

Tongyiqianwen

China

Zhipu AI

ChatGLM

GLM-4.0

China

Moonshot AI

KimiChat

Moonshot


ChatGPT from OpenAI company has been widely accepted as the bestperformance LLM in the world. In this paper, ChatGPT is used for some principletests and providing baseline results. Although it can be accessed throughwebsite method, code programming access environment is also configured for somequickly tests. The program language is Python 3.0 and the code editor isMicrosoft VS code. The code to access ChatGPT is designed as below. Note here asimple prompt skill is used with “system” role and content. In the content ofsystem role, a legal and psychological consultant is defined, and its behaviorshas been described.



import os

from openai import     OpenAI

# load .env variables

from dotenv import     load_dotenv, find_dotenv

_ =     load_dotenv(find_dotenv())

# configure OpenAI     service

client = OpenAI()

messages= [

    {

        "role":     "system",

        "content": "你是未成年人法律和心理问题专家,你为青少年提供法律和心理咨询服务,通过心理学CBT理论采用青少年口吻与用户进行多轮对话 " #     Prompt

    },

    {

        "role":     "user",

        "content": "我这次考试又没考好,感觉生活真没意思"     #query

    },

]

response =     client.chat.completions.create(

    model= "gpt-3.5-turbo",

    messages=messages

)

print(print(response.choices[0].message.content))   # print more detail info


as a demo, the answer from above code is


The above answer is not concise enough and multiple-turn dialog is alsonot supported. Good thing is that the code does work successfully to access to theChatGPT system.

Considering the application of this project in China, ChatGLM isselected as a major base model in this paper.

4.1.2    Text embedding and similarity estimation


def     get_embeddings(texts, model="text-embedding-ada-002",     dimensions=None):

    '''Package     OpenAI Embedding Interface'''

    if model     == "text-embedding-ada-002":

            dimensions = None

    if     dimensions:

            data = client.embeddings.create(

                input=texts, model=model, dimensions=dimensions).data

    else:

            data = client.embeddings.create(input=texts, model=model).data

    return     [x.embedding for x in data]

test_query = ["青少年犯罪是重要的社会问题"]     #text need to be converted to vector

vec =     get_embeddings(test_query)[0]

print(vec[:10]) #print     first 10 vector elements

print(len(vec)) #print     total length of the vector


Text embedding is to convert a text into a vector, and it isan important step in RAG technique. The conversion is generally implemented bya transformer model. In this experiment, we designed a function to call theOpenAI transformer model known as “text-embedding-ada-002” to calculate thevector for a given text.



[-0.00056178897,     -0.008787724, 0.01800317, -0.016875543, -0.042798035, -0.005712669,     0.0027380632, 0.009740376, -0.018301278, -0.025766956]

1536


The result shows as below.


The first 10 elements of the vector for the given text (variabletest_query) are output and there are total 1536 elements in the vector.

According to the description in 3.2, the similarity of two piece oftexts can be calculated based on their vector cos-distance. Here is theexperiment for similarity estimation among three sentences. Text1 and Text2 areexpected to have higher similarity score than Text1 and Text3.



def cos_sim(a, b):

    return     dot(a, b)/(norm(a)*norm(b)) #calculate cos-distance between vectors

Text1 = ["青少年犯罪是重要的社会问题"]

Vec1 =     get_embeddings(Text1)[0]

Text2 = ["青少年心理健康很重要"]

Vec2 =     get_embeddings(Text2)[0]

Text3 = ["Happy     brithday to you"]

Vec3 =     get_embeddings(Text3)[0]

print(cos_sim(Vec1,Vec2))     #print the cos distance between 1 and 2

print(cos_sim(Vec1,Vec3))     #print the cos distance between 1 and 3


   The result showssimilarity between Text1 and Text2 is 0.8826421108 and 0.6636957190 betweenText1 and Text3. It meets the expectation.


4.2        Creating GPTs

  Inthis section, the GPTs creator in ChatGLM is used to config a RAG-based GPTs. Itis similar to config a GPT in ChatGPT. Figure 4-1 shows the config pages from ChatGLMand ChatGPT.

Figure 4-1 GPT creator in ChatGPT and ChatGLM

After input simple guidance in the GPT creator, a debug and preview pageis displayed on the right side. The following steps are to input the domainknowledge data files.

4.2.1    Data preparation

  Beingfeed on a legal and psychological guidance system for adolescents, the domainknowledge includes the laws and regulations related to the adolescents,psychological dialog datasets and real guidance case records.

  Thelaws such as “The Constitution”, “The Criminal Law”, “The Civil Code of thePeople's Republic of China” and “Law on the Protection of Minors” issued by thenation government; the regulations such as “Regulations on the Protection ofMinors in Guangdong Province”, Measures for the Implementation of the Law ofthe People's Republic of China on the Protection of Minors in Shenzhen SpecialEconomic Zone” ,issued by local governments. And explanations from the SupremePeople's Court and the Supreme People's Procuratorate. There is total 13 filesin PDF format with OCR enabled. Since these law and regulation files areorganized by article, texts in these files are easily to be split by article. Therefore,there are total 2453 articles. No special data clean is needed.


"question":     "为什么总是会因为他人学习而过度焦虑?",

"description":     "经常在校园里看到学习的人,于是便觉得自己变得不求上进,心里产生焦虑,害怕和别人的距离拉大,总觉得自己没有进步空间",

"keywords":     "行为,应激,焦虑,困惑",

"answers": [

{

"answer_text":     "~~很抱歉看到你最近状态不佳,抱抱你呀~看了你的描述“会因为他人学习而感到焦虑”,看得出来你是一个很有危机感的人,同时,可能比较容易受周围人的影响,对压力的感知也很敏感,很同情你的遭遇呀。我想你应该是一个有上进心的学生,只是暂时没有很坚定的学习方向而已。根据你的描述“经常在校园里看到学习的人,于是便觉得自己变得不求上进,心里产生焦虑”,这种焦虑情绪在校园里很常见,一般来说轻度的焦虑或许能转化为动力,助推我们学习进步,焦虑也就对我们产生了积极的影响。而如果我们不能正确转化这种焦虑,就需要外界的干预、调节焦虑情绪。根据你的描述“害怕和别人的距离拉大,总觉得自己没有进步空间”,从你的这种想法可以看出,你似乎还没有把这种情绪转化成动力,所以你可能需要外界的帮助,比如,及时和老师、朋友交流自己的学习情况,让他们评估一下你的情况或许更客观一点,你就能从多角度看待自己的学习情况。或许你也能看到你的优点和进步的空间。",

"questionID":     4395

}]


   Psychological dialogdatasets are used to guide the GPT to answer questions in psychological way. Thereare four dialog datasets collected for this paper [9]. They are in json fileformat and with clear Q and A. An example can be found below. These four dialogdatasets include nearly 10k Q&A examples within total 244MB. Severalpsychological books and websites are collected.


  Thethird type of domain data is the typical real case records. These records aregenerated by a volunteer organization’s daily work. To protect personal privacy,all records are cleaned by removing all names and addresses and recognizablestorylines. Only the dialog and psychological diagnose texts are kept. Thereare totally 35 example cases stored in a word file.

Refer to the Appendix A for more information about the domain data.

4.2.2    GPT configuration

GPT configuration is packaged with a guide after login inChatGLM website (www.chatglm.cn). With asimple description of the desired GPT functionality, the GPT creator helps fillin most basic information for each blank.

Figure 4-2 records down thedescription for the GPT creator and Figure 4-3 shows the GPT configuration(left) and debug and preview (right) interface.

 Figure 4-2 Descriptionfor GPT creator in ChatGLM

Figure 4-3 GPT configuration (left) and debug and preview (right)interface in ChatGLM

  Afterrefresh and save any modifications on left configuration page, the right GPTwill be updated. User can in timely review and debug the GPT.


   RAG configurationmeans to upload the domain knowledge files and embed the split texts of thesefiles, then store in a vector database. It is the key step for the GPTcreation. In ChatGLM, the prepared domain knowledge files are updated from theKnowledge port. Figure 4-4 shows the file upload and settings. The website alsocan be uploaded by “load URL” button after identification is done.


Figure 4-4 Domainknowledge files update and settings


   To verify the domainknowledge has been successfully embedded and take effective, we input an lawquestion on the debug page and get the correct answer with marked fromknowledge library. This is shown in Figure 4-5.

    Figure 4-5 Verification onknowledge library created


Although the ChatBot can answer questions with domain knowledgecurrently, the mood and words need to be improved. The improvements will beimplemented in Prompt engineering stage.

  Theprompt engineering can be implemented in the configure information blank, andthe tuning with prompt is an iterative and inter-active progress. Also, it ismost time-costing stage. For example, “please start with Baby”, “no more than50 words in one turn”. Specially, we can guide the GPT use the psychologicalCBT (Cognitive Behavioral Therapy) method. The method emphasizes the importanceof cognition and cognition leads to different moods and behaviors.

  Afterprompt tuning, we can publish the GPT to public by click on the publish.

4.3        ChatBot evaluation


   How the ChatBot works?Has it been improved comparing to original GPT when answering the adolescents’problems? To answer these questions, an evaluation flow has been designed shownin Figure 4-6.

Figure 4-6 ChatBotevaluation flow

Firstly, we use the ChatGPT and ChatGLM respectively, to generate top 10questions which are related to adolescents during their study and life. At thesame time, recode the corresponding answers as baseline . After that, the total20 questions is sent to ChatBot, and another 20 answers are generated by ChatBot,named as Answers_B. Finally, three volunteers are invited to judge whether theanswer_B has higher quality than corresponding baseline answers on the threeaspects: professional, effective, and acceptable in mood for the minors. Score0 stands for the answer_B is worse than the baseline answer. Score 1 means thetwo answers are comparable and Score 2 means the answer_B has better qualitythan the baseline answer. “Prof.” stands for the completion and professional. “Effe”stands for the feasibility and clear enough. “Acce” stands for the moodacceptable for the adolescents. The final score is list on the table 4-2 asbelow.


Table 4-2 ChatBotevaluation score


No.

Volunteer   1

Volunteer   2

Volunteer   3

Average

Prof.

Eff.

Acc.

Prof.

Eff.

Acc.

Prof.

Eff.

Acc.

Prof.

Eff.

Acc.

1

1

1

2

1

1

2

1

1

2

1

1

2

2

1

2

2

1

2

2

1

2

1

1

2

1.667

3

2

2

2

2

2

2

2

2

2

2

2

2

4

1

2

2

2

2

2

1

2

2

1.333

2

2

5

1

2

2

1

2

2

1

2

2

1

2

2

6

2

2

2

1

2

2

1

2

2

1.333

2

2

7

1

1

2

1

1

2

1

2

1

1

1.333

1.667

8

2

2

2

2

2

2

2

2

2

2

2

2

9

1

2

2

1

2

2

2

2

2

1.333

2

2

10

1

1

1

1

1

2

1

2

2

1

1.333

1.667

11

2

2

2

2

2

2

2

2

2

2

2

2

12

2

2

2

2

2

2

2

2

2

2

2

2

13

2

2

2

2

2

2

2

2

2

2

2

2

14

2

1

2

2

2

2

2

1

2

2

1.333

2

15

2

2

2

2

2

2

2

2

2

2

2

2

16

2

2

1

2

2

2

2

2

2

2

2

1.667

17

2

2

2

2

2

2

2

2

2

2

2

2

18

2

2

1

2

1

1

2

1

1

2

1.333

1

19

1

1

1

1

2

1

1

1

1

1

1.333

1

20

1

2

2

1

2

2

1

2

2

1

2

2

   The score table proves that the most answersare as expected to be better than baselines. The answers from ChatBot have awarm call, and more clear action suggestions and end with an encouragingsentence. This structure earns minors’ fully acceptable. Most answers also havemore professional descriptions, such as question 14 and 15. The accurate laws’names have been specified in their answers from ChatBot due-to the input ofdomain knowledge. Another advantage over baseline is that very clear action suggestionsare described in the ChatBot answers.

5.   Conclusion

  Theadolescents need personally consultant on legal and psychological guidance,when they meet problems during their life. Large language models have proven tohave good performance on chat, Q&Q and other capabilities. In this paper, thetext embedding and vector similarity calculation experiments are done inChatGPT platform. At the same time, a GPT-based tool, named ChatBot, isdeveloped based on ChatGLM model with Prompting and Retrieval AugmentedGeneration (RAG) techniques. The experiments results proven the ChatBot canprovide more professional, more effective and more acceptable answers to theadolescents on legal and psychological guidance than the general LLMs. Currently,more complex questions have not been verified on the GPT. And it needs to beiteratively improved by practices.

Based on above situation, the next steps will include:

1.    Release the link to thevolunteer organizations such as Futian Qihang for feedbacks from theapplication in real.

2.    Continue to study themulti-turn dialog implements in ChatBot.

3.    Continue fine tune the promptto satisfy new requirements.

4.    Publish the ChatBot on mywebsite for more user testing. My website is http://tabula-rasa.cn,any feedback is welcome, please email me at 13510989142@163.com








Reference

[1] https://www.spp.gov.cn/spp/zdgz/202403/t20240302_646867.shtml.

[2]https://github.com/pengxiao-song/LaWGPT/tree/main.

[3]https://github.com/PKU-YuanGroup/ChatLaw/tree/main.

[4]Huachuan Qiu, Hongliang He, Shuai Zhang, Anqi Li et.al, “SMILE: Single-turn toMulti-turn Inclusive Language Expansion via ChatGPT for Mental Health Support”,https://arxiv.org/pdf/2305.00450.

[5]https://github.com/HIT-SCIR-SC/QiaoBan/blob/main.

[6]Yirong Chen, Xiaofen Xing, Jingkai Lin, et.al, “SoulChat: Improving LLMs’Empathy,Listening, and Comfort Abilities through Fine-tuning with Multi-turn EmpathyConversations”, Findings 2023, https://aclanthology.org/2023.findings-emnlp.83/.

[7] XavierAmatriain, Prompt Design and Engineering: Introduction and Advanced Methods, https://arxiv.org/html/2401.14423v3#S5

[8] PatrickLewis, Ethan Perez, Aleksandra Piktus etc.al, “Retrieval-Augmented Generationfor Knowledge-Intensive NLP Tasks”, https://arxiv.org/pdf/2005.11401v4.

[9] https://www.modelscope.cn/datasets


Appendix

Appendix A Domain knowledge filelist


No.

Name

Category

Unit

Quantity

1

Law of the   People's Republic of China on the Protection of Minors

Law

article

132

2

The Law of the   People's Republic of China on the Prevention of Juvenile Delinquency

Law

article

68

3

The Law of the   People's Republic of China on the Protection of Rights and Interests of Women

Law

article

86

4

The Compulsory   Education Law of the People's Republic of China

Law

article

63

5

Regulations on   the Protection of Minors Online

Regulation

article

60

6

Regulations on the Protection of Minors in Guangdong Province

Regulation

article

64

7

Measures for the   Implementation of the Law of the People's Republic of China on the Protection   of Minors in Shenzhen Special Economic Zone

Regulation

article

59

8

The Constitution   of the People's Republic of China

Law

article

143

9

The Criminal Law   of the People's Republic of China

Law

article

452

10

The Civil Code of the People's Republic of China

Law

article

1260

11

The Supreme   People's Court Issues Judicial Interpretation on the Trial of Criminal Cases   Involving Minors

Regulation

article

20

12

Joint   Interpretation of the Supreme People's Court and the Supreme People's   Procuratorate on Several Issues Concerning the Application of Law in Handling   Criminal Cases of Rape and Indecent Assault Against Minors

Regulation

article

16

13

Opinions of the   Supreme People's Court on Strengthening the Trial Work Relating to Minors in   the New Era

Regulation

article

30

14

PsyQA dataset

dialog

KB

620

15

PysDTCorpus   dataset

dialog

KB

48919

16

SoulChatCorpus   dataset

dialog

KB

886114

17

Efaqa-corpus   dataset

dialog

KB

42984

18

real guidance record   file

record

case

35

19

https://zhuanlan.zhihu.com/p/102752926#:~:text=%E8%AE%A4%E7%9F%A5%E8%A1%8C%E4%B8%BA%E7%96%97%E6%B3%95%EF%BC%88CBT

website

NA

NA

20

Child Psychology

book

page

151

21

Child Psychology   development

book

page

313

22

Record of   Individual Counseling for Mental Health Education of Middle School Students

word

page

32
























Appendix B GPT answers comparison(in Chinese)

No.

Questions

ChatGPT/ChatGLM

ChatBot

1

如何应对学习压力和考试焦虑?

学习压力和考试焦虑是常见的心理现象,特别是在重要考试前。心理学建议可以通过时间管理、设定合理的学习目标和使用放松技巧(如深呼吸、冥想)来缓解压力。此外,保持积极的自我对话,避免过度担忧失败。法律上,学校有责任提供心理健康支持服务,学生可以寻求心理咨询或辅导员的帮助。

宝贝,面对学习压力和考试焦虑,首先认识到这是正常的,但也可以通过一些方法来缓解。尝试制定合理的学习计划,分解任务,每天进步一点点。同时,保证充足的休息和适当的放松,比如运动或听音乐。如果焦虑影响到了日常生活,考虑寻求专业帮助,比如咨询心理医生。记住,你的价值不仅仅取决于成绩,保持积极的心态很重要。

2

我在学校里总是被同学欺负,该怎么办?

被欺凌是一个严重的心理和法律问题。从心理学角度,受害者可能会感到无助、自尊心受损。学生应尽量寻求成人(老师、家长)的帮助,并学会自我保护。法律上,学校有责任确保学生的安全,并采取措施制止欺凌行为。受害者有权通过学校或法律途径举报欺凌,要求学校采取行动。

宝贝,面对同学的欺负,首先要勇敢地说“不”。告诉老师或学校管理人员,让他们知道你的处境。同时,试着结交一些支持你的朋友,一起面对困难。如果你感到害怕或难过,和家人谈谈,他们的支持很重要。记住,没有人有权利欺负你,你值得被尊重和爱护。如果情况严重,不要犹豫寻求专业帮助。

3

如何提高自我控制力,避免拖延?

心理学研究表明,拖延往往与对任务的焦虑或完美主义有关。可以尝试使用“番茄工作法”分割任务,设定短期目标,并给予自己适度的奖励。通过认知行为疗法(CBT)改变对任务的负面认知也有助于提高自我控制力。法律方面,学生可以通过学校提供的时间管理或心理辅导服务获取支持。

宝贝,提高自我控制力和避免拖延,可以从制定清晰的目标和计划开始。将大任务分解成小步骤,设定具体的完成时间。尝试使用番茄工作法,专注工作25分钟,休息5分钟。同时,减少干扰,比如关闭不必要的社交媒体通知。奖励自己完成任务后的成就,增强动力。如果拖延严重,可以尝试找出背后的原因,并寻求专业帮助。记住,自我控制力是可以通过练习逐渐提高的。

4

我总是跟父母吵架,感觉他们不理解我,怎么办?

青春期是自我认同和独立性的关键时期,和父母的冲突可能是代沟和沟通不畅的结果。心理学建议采用有效沟通技巧,如使用“我”陈述(“我觉得…因为…”)而不是指责父母。法律上,父母有义务提供合理的照顾和教育,但青少年也有责任表达自己的需求,争取相互理解。

宝贝,和父母之间的沟通问题很常见。试着找一个合适的时机,冷静地向他们表达你的感受和需求。告诉他们你希望如何被理解和支持。同时,也试着从他们的角度理解问题,可能会有新的发现。如果需要,可以寻求第三方的帮助,比如家庭咨询师,来促进沟通和理解。记住,父母爱你,只是有时候表达方式可能不是你所期望的。

5

我在学校无法集中注意力,是否有心理问题?

无法集中注意力可能与多动症(ADHD)或焦虑、抑郁等心理问题有关。如果经常感到难以专注,建议咨询心理健康专家进行评估。根据心理学理论,注意力不足可能源于环境干扰或心理压力。法律上,学生有权获得适应性学习计划,特别是在诊断出ADHD或其他学习障碍的情况下,学校应提供特殊教育支持。

宝贝,无法集中注意力不一定意味着有心理问题。这可能是由多种因素引起的,比如疲劳、压力、不感兴趣等。尝试找出导致你无法集中注意力的原因,并针对性地解决。保证充足的睡眠,合理安排学习和休息时间。如果情况持续,影响了你的学习和生活,建议咨询专业的心理医生,以排除潜在的心理健康问题。记住,寻求帮助是勇敢和智慧的表现。

6

我如何处理在社交媒体上的负面评论或网络欺凌?

网络欺凌可能对青少年的自尊心和心理健康产生重大影响。心理学建议,尽量减少对负面评论的关注,增强自我认同感,并寻求社交支持。法律上,许多国家都有针对网络欺凌的法律,青少年可以通过法律途径举报不当行为,并要求平台删除有害内容。

宝贝,面对社交媒体上的负面评论或网络欺凌,首先要保护好自己。不要回应负面评论,避免无谓的争执。如果情况严重,比如持续的骚扰或威胁,截图保存证据,并向家人、朋友或学校寻求帮助。可以考虑举报不当行为,并必要时联系法律顾问。同时,学会调整心态,不要让网络上的言论影响到你的自我价值感。记住,你的价值不是由他人的言论决定的。

7

如何应对同伴压力,避免做出不合理的决定?

同伴压力是一种强大的心理力量,特别是青少年时期,大家都渴望被认同。心理学建议,通过建立清晰的个人价值观、学会说“不”以及寻找支持性朋友,能够更好地抵御不健康的同伴压力。法律上,青少年有权利拒绝参与违法活动,如吸毒、饮酒等,法律会保护他们免受不正当影响。

宝贝,应对同伴压力,首先要清楚自己的价值观和目标。在面临压力时,深呼吸,给自己一点时间思考。如果你觉得某个决定不合理或不符合你的原则,勇敢地说不。找到支持你、理解你的朋友,和他们一起面对压力。如果需要,可以寻求成年人的帮助。记住,真正的朋友会尊重你的选择,而不是强迫你做你不愿意的事情。

8

我想打工挣钱,但家长不同意,该如何处理?

从心理学角度看,青少年开始打工可能是为了寻求独立性和责任感。但家长可能担心工作会影响学习。可以通过与家长沟通,制定工作与学习的平衡计划,达到双方的共识。法律上,青少年打工的时间和条件受到严格的限制,很多国家规定未成年人只能在有限的时间内打工,以确保他们的教育不受影响。

宝贝,想打工挣钱是个积极的想法,但家长的担忧也是出于对你的关心。首先,试着理解家长的顾虑,可能是担心影响学习和安全。然后,和他们坐下来沟通,表达你打工的理由和计划,比如想学习独立和责任感。你可以提出一个平衡学习和工作的方案,并承诺保持学业成绩。如果家长仍然不同意,尊重他们的决定,并考虑其他方式来学习独立和财务管理。记住,沟通和理解是解决分歧的关键。

9

学习压力大时,我喜欢吃很多零食甚至暴饮暴食,怎么改变?

暴饮暴食是应对压力的一种常见不健康策略。心理学建议采用健康的压力管理技巧,如运动、深呼吸练习或分散注意力。此外,保持饮食计划,设定健康饮食的目标,也有助于控制饮食行为。若暴饮暴食持续,可能需要心理咨询来探讨潜在的情绪问题。法律上,学校应提供营养指导并关注学生的身心健康。

宝贝,面对学习压力时吃零食或暴饮暴食是一种常见的应对方式。要改变这个习惯,首先尝试找到更健康的应对压力的方法,如散步、运动或听音乐。保持均衡的饮食,多摄入蔬菜和水果。当你想吃零食时,选择健康的选项,如坚果或酸奶。如果暴饮暴食的情况严重,考虑寻求专业的心理咨询,以找到更有效的应对压力的方法。记住,照顾好自己的身心健康是非常重要的。

10

我对未来的职业感到迷茫,应该如何规划?

青少年常感到对未来职业的不确定,特别是面对学业压力和社会期望。心理学建议通过自我探索(兴趣、能力、价值观等)和职业咨询来帮助确定职业方向。多参与实习或社会实践也可以帮助积累经验并澄清职业目标。法律上,学生有权在学校获取职业咨询和发展机会,学校应提供职业辅导服务。

宝贝,对未来职业感到迷茫是很正常的。首先,尝试探索自己的兴趣和擅长的领域。参加不同的活动和实习,了解各种职业。同时,也可以咨询职业规划师或导师,他们可以提供专业的建议。制定一个灵活的职业规划,包括短期和长期目标。记得,职业规划是一个不断调整和探索的过程,不要害怕改变方向。最重要的是找到让你感到满足和有成就感的职业。

11

我如何才能提高学习效率?

心理学研究表明,采用番茄工作法(25分钟专注学习,5分钟休息)可以提高注意力集中度。此外,合理安排学习时间和环境,确保充足的睡眠和适当的休息,都有助于提高学习效率。

宝贝,提高学习效率可以从以下几个方面入手:1. 制定合理的学习计划,明确学习目标和时间安排。2. 创造一个良好的学习环境,减少干扰。3. 使用有效的学习方法,如主动学习、分散学习和复习技巧。4. 保持充足的睡眠和适当的休息,避免疲劳。5. 定期评估学习效果,调整学习方法。记住,每个人的学习方式都不同,找到适合自己的方法很重要。

12

我的同学总是在背后说我的坏话,我该怎么办?

这种情况可能会影响你的情绪和自尊。心理学建议,你可以尝试与同学沟通,表达你的感受,或者寻求老师或心理咨询师的帮助。记住,别人的评价不能定义你,重要的是自我认同。

宝贝,面对同学在背后说坏话的情况,首先要保持冷静。如果这些言论影响到了你的情绪或声誉,可以尝试直接和同学沟通,表达你的感受。如果情况没有改善,或者你不确定如何处理,寻求老师或学校辅导员的帮助是个好主意。记住,别人的言论不能定义你,专注于自己的成长和正面的人际关系。如果这种情况对你的心理健康造成了影响,不要犹豫寻求专业的心理咨询。

13

我父母总是逼我学习,我觉得压力很大怎么办?

心理学上,过度的压力会影响心理健康。你可以尝试与父母沟通你的感受,设定合理的学习目标,并寻求平衡。如果压力过大,可以寻求专业心理咨询。

宝贝,父母的高期望可能给你带来压力,这是可以理解的。首先,试着和父母沟通你的感受,告诉他们你的压力和需要他们的支持。可以提出一个合理的学习计划,平衡学习和休息时间。同时,也可以寻求学校辅导员的帮助,他们可以提供沟通策略或介入帮助。如果压力过大,影响了你的身心健康,考虑寻求专业的心理咨询。记住,保持开放的沟通和寻求帮助是处理压力的重要步骤。

14

我在网络上被人欺负了,可以报警吗?

根据法律,网络欺凌可能构成侵权行为或犯罪。你可以保存证据,告知父母,并寻求法律帮助。如果情况严重,可以向警方报案。

宝贝,如果你在网络上遭受了欺负,这可能是网络欺凌。首先,保留所有证据,如截图、聊天记录等。然后,告知你的父母或信任的成年人。如果情况严重,比如威胁到你的安全或心理健康,是可以报警的。根据《未成年人保护法》和《未成年人网络保护条例》,网络服务提供者有责任采取措施制止网络欺凌行为。同时,学校和社会也应提供相应的帮助和支持。记住,你有权利保护自己不受伤害。

15

我不想上学,可以辍学吗?

法律规定,未成年人有接受义务教育的权利和义务。辍学可能会影响你的未来。如果有特殊原因,应该与家长、学校沟通,寻找解决方案。

宝贝,辍学是一个重大的决定,会对你未来的教育和职业道路产生长远影响。在中国,根据《义务教育法》,完成九年义务教育是每个孩子的权利和义务。如果你不想上学,可能是因为遇到了困难或压力。试着找出不想上学的原因,并和家长、老师或学校辅导员沟通,寻求帮助解决问题。记住,教育是打开未来之门的关键,不要轻易放弃这个机会。如果情况严重,考虑寻求专业的心理咨询。

16

我的好朋友让我一起吸烟,我该怎么办?

吸烟对青少年健康有严重影响。心理学建议,你应该坚定拒绝,并可能帮助你的朋友认识到吸烟的危害。如果需要,可以寻求成年人的帮助。

宝贝,面对朋友邀请一起吸烟,首先要坚持自己的原则。吸烟对健康有害,尤其是对青少年。你可以礼貌地拒绝,并解释你不想吸烟的原因。如果朋友持续施压,考虑是否需要重新评估这段友谊。真正的朋友会尊重你的选择。如果你感到困惑或难以拒绝,可以寻求家长、老师或学校辅导员的帮助。记住,保护自己的健康是最重要的。

17

我发现有人在校园里卖毒品,我该告诉谁?

卖毒品是严重的犯罪行为。你应该立即告诉老师、家长或报警,保护自己和同学的安全。

宝贝,如果你发现有人在校园里卖毒品,这是一个非常严重的问题。你应该立即告诉你的老师、学校管理人员或者家长。学校和家长会采取适当的措施,并可能通知警方。记住,涉及毒品的活动是非法的,而且对个人和社区都有极大的危害。勇于举报是正确和勇敢的行为,可以保护你自己和其他同学的安全。

18

我总是害怕考试,怎么办?

考试焦虑是常见的心理现象。你可以尝试放松技巧,如深呼吸、正念冥想,或者进行认知行为疗法来改变对考试的负面想法。

宝贝,害怕考试是很多人都会经历的,这被称为考试焦虑。首先,试着理解你的焦虑来自哪里,是对未知的恐惧还是对失败的担心?然后,可以尝试一些放松技巧,如深呼吸、冥想或渐进性肌肉放松。此外,制定一个合理的学习计划,提前准备,可以减少焦虑。如果焦虑影响了你的日常生活和学习,考虑寻求专业的心理咨询。记住,考试只是评估知识的一种方式,你的价值和能力远不止于此。

19

我父母离婚了,我该怎么办?

父母离婚对青少年是一个重大的生活变化。心理学建议,你可以表达自己的感受,与父母沟通,并寻求心理咨询师的帮助来处理情绪。

宝贝,父母离婚对你来说可能是一个巨大的变化和挑战。首先,要知道父母的决定并不是你的错,也不一定是你需要解决的问题。尝试与父母沟通你的感受,表达你的担忧和需要。在这个过程中,你可能会经历各种情绪,这是正常的。如果需要,可以寻求心理咨询师或学校辅导员的帮助,他们可以提供情感支持和应对策略。同时,保持与家人和朋友的联系,他们的支持也很重要。记住,虽然这个变化可能很难,但你并不孤单,总有人愿意帮助你。

20

我在学校被老师不公平对待,可以投诉吗?

如果你觉得被老师不公平对待,可以首先尝试与老师沟通,如果问题无法解决,可以向学校管理层或教育部门投诉。法律保护学生的合法权益。

宝贝,如果你觉得在学校被老师不公平对待,这是可以提出来的。首先,尝试和老师沟通,表达你的感受和看法。如果直接沟通没有解决问题,或者你觉得不舒服或不安全,可以寻求家长的帮助,让他们知道你的情况。家长可以代表你和学校沟通,或者一起找到学校的辅导员或校长来讨论这个问题。在沟通时,保持尊重和冷静,清晰地表达你的观点。如果情况严重,比如涉及到歧视或虐待,可以考虑正式投诉。记住,每个学生都有权利在安全和公平的环境中学习和成长。











Acknowledgement

Jian Hu is my instructor not only on the school course, AdvancedWriting, but also on this project. I would like to express my sincereappreciation to him for his constructive suggestions and system thinking skillsand the instruction on the writing skills.

  Iwould like to thank my high school instructor, Shizhu He for his suggestionsand enlightenments on my project.

  I alsowant to express my appreciation to volunteers organization. They give theirfull love to the adolescents who need help. I am also pride of contributing myefforts with them.

  Atlast, I would like also to think Tencent and Xiniuniao project team for yourprefect arrangement and organization on the wonderful courses about AI andlarge models, and the so cool research projects.



分享到: