Updated on 2025-08-13 GMT+08:00

Obtaining the Chat History

Function

This API is used to obtain the chat history based on chat_id and return the historical question and answer.

URI

GET /v1/{project_id}/applications/{application_id}/uni-search/chat-history/{chat_history_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition:

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Constraints:

N/A

Value range:

The value can contain 1 to 64 characters. Only digits, letters, hyphens (-), and underscores (_) are allowed. The value must start with a letter.

Default value:

N/A

application_id

Yes

String

Definition:

Application ID. For details about how to obtain the application ID, see Obtaining an Application ID.

Constraints:

Character string

Value range:

The value can contain 1 to 64 characters. Only digits, letters, hyphens (-), and underscores (_) are allowed. The value must start with a letter.

Default value:

N/A

chat_history_id

Yes

String

Definition:

Chat history ID.

How to obtain: Choose Chat Management > Chat History > Chat ID.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

repo_id

No

String

Definition: Knowledge base ID. This parameter is required for granting user permissions. Constraints: N/A Value range: 1 to 64 characters. Default value: N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition:

Token used for API authentication. For details about how to obtain the token, see Obtaining an IAM User Token.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

chat_id

String

Definition:

Chat ID, which uniquely identifies a chat.

Value range:

N/A

knowledge_repo_id

String

Definition:

ID of the knowledge base referenced by the current chat.

Value range:

N/A

chat_title

String

Definition:

Chat topic.

Value range:

N/A

user_name

String

Definition:

Username.

Value range:

N/A

create_date_time

String

Definition:

Timestamp indicating when a chat occurred.

Value range:

N/A

project_id

String

Definition:

Project ID.

Value range:

N/A

is_del

Integer

Definition:

Whether the current chat is deleted.

Value range:

  • 0: not deleted

  • 1: deleted

slave_repo_id

String

Definition:

ID of the secondary knowledge base.

Value range:

N/A

type

String

Definition:

Type.

Value range:

N/A

question_models

Array of QuestionModel objects

Definition:

Details about the current chat, including the question, answer, and referenced segments.

Value range:

N/A

Table 5 QuestionModel

Parameter

Type

Description

question_id

String

Definition:

Question ID.

Value range:

N/A

chat_id

String

Definition:

Session ID.

Value range:

N/A

question

String

Definition:

Question.

Value range:

N/A

rewrited_question

String

Definition:

Rewritten question.

Value range:

N/A

answer

String

Definition:

Answer.

Value range:

N/A

pangu_answer

String

Definition:

Pangu answer.

Value range:

N/A

user_name

String

Definition:

Username.

Value range:

N/A

create_date_time

String

Definition:

Chat occurrent time.

Value range:

N/A

feedback_status

Integer

Definition:

Whether there is any feedback

Value range:

N/A

feedback_type

String

Definition:

Feedback type.

Value range:

N/A

pangu_question

String

Definition:

Pangu question.

Value range:

N/A

feedback_date_time

String

Definition:

Feedback time.

Value range:

N/A

feedback_detail

String

Definition:

Feedback details.

Value range:

N/A

context_relation

String

Definition:

Associated context.

Value range:

N/A

revised_answer

String

Definition:

Optimization result.

Value range:

N/A

revised_reason

String

Definition:

Optimized question.

Value range:

N/A

standard_answer

String

Definition:

Standard answer.

Value range:

N/A

project_id

String

Definition:

Project ID.

Value range:

N/A

search_plan

String

Definition:

Search planning content.

Value range:

N/A

web_reference

String

Definition:

Web reference.

Value range:

N/A

question_reference_models

Array of QuestionReferenceModel objects

Definition:

Reference file and segment details of the current answer.

Value range:

N/A

Table 6 QuestionReferenceModel

Parameter

Type

Description

id

Integer

Definition:

Reference chunk ID.

Value range:

N/A

file_id

String

Definition:

File ID.

Value range:

N/A

reference_id

String

Definition:

Reference file ID.

Value range:

N/A

question_id

String

Definition:

Question ID.

Value range:

N/A

doc_index

String

Definition:

Reference document index.

Value range:

N/A

doc_title

String

Definition:

Reference document name.

Value range:

N/A

subtitle

String

Definition:

Subheading of the reference segment.

Value range:

N/A

doc_content

String

Definition:

Reference segment content.

Value range:

N/A

score

Float

Definition:

Relevance score between the reference segment and the question.

Value range:

N/A

type

String

Definition:

Type.

Value range:

N/A

page_num

Integer

Definition:

Page number.

Value range:

N/A

component_num

Integer

Definition:

Number of components.

Value range:

N/A

extend

String

Definition:

JSON data used for document highlighting and locating. Example:

{

"element_id": "abc123",

"elements": [

"elem1",

"elem2",

"elem3"

],

"pdf_coordinate": [

[

202,

687

],

[

1031,

687

]

]

}

Constraints:

This parameter is supported only in clusters 25.7.T1 or later.

Value range:

N/A

Example Requests

Obtain the chat history.

/v1/b25446daeb1a41a7953c5deba2b2677a/applications/be9b19bf-4865-4fb8-b9f8-2fd1fea98d76/uni-search/chat-history/382c164f-44f1-405f-a36b-afc508d0ce3f?repo_id=7741920e-7c1c-4a48-8555-c43b66153272

Example Responses

Status code: 200

View the chat history.

{
  "chat_id" : "9eafef43-0fc5-4f62-891a-34810ada9f20",
  "knowledge_repo_id" : "2e1524cc-cf40-4607-9134-1204f320b868",
  "create_date_time" : "1717641946646",
  "is_del" : 0,
  "question_models" : [ {
    "question_id" : "7ae2d834-591a-4a2b-bba5-53802c93998f",
    "chat_id" : "9eafef43-0fc5-4f62-891a-34810ada9f20",
    "question" : "What sub-businesses does the personal insurance business include?",
    "answer" : "According to the provided document, the personal insurance business includes the following sub-businesses:\n\n- Life insurance: This refers to insurance where the insurer pays the insurance money to the insured or the designated beneficiary according to the contract time during the insured's lifetime.\n- Health insurance: This type of insurance is mainly to reduce the economic burden on individuals or families caused by diseases, accidental injuries, or other health problems.\n- Accident insurance: This insurance is to provide economic compensation from the insurer when the insured suffers physical damage or death due to accidental injury.\n\nThe document also mentions that insurance companies operating property insurance business, with the approval of the State Council's insurance regulatory authority, can operate short-term health insurance business and accident insurance business. This means that under specific conditions, health insurance and accident insurance can be combined with property insurance business.",
    "create_date_time" : "1717641952936",
    "feedback_status" : 0,
    "question_reference_models" : [ {
      "id" : 2141249532,
      "reference_id" : "aa1298dfe8a2cfd3f4392019231137d2",
      "doc_title" : "Insurance Law of the People's Republic of China.pdf",
      "subtitle" : "Insurance Law of the People's Republic of China\nChapter 4 Insurance Business Rules (1) of the Insurance Law of the People's Republic of China",
      "doc_content" : "Article 95 Business scope of insurance companies:\n(1) Personal insurance business, including life insurance, health insurance, accident insurance, and other insurance business;\n(2) Property insurance business, including property loss insurance, liability insurance, credit insurance, guarantee insurance, and other insurance business;\n(3) Other insurance-related business approved by the State Council's insurance regulatory authority.\nInsurers shall not concurrently operate personal insurance business and property insurance business. However, insurance companies operating property insurance business, with the approval of the State Council's insurance regulatory authority, can operate short-term health insurance business and accident insurance business.\nInsurance companies shall engage in insurance business activities within the business scope approved by the State Council's insurance regulatory authority according to law.\nArticle 96 With the approval of the State Council's insurance regulatory authority, insurance companies can operate the following reinsurance business specified in Article 95 of this law:\n(1) Ceding insurance;\n(2) Ceding insurance.\nArticle 97 Insurance companies shall extract a guarantee fund of 20/ %of their total registered capital and deposit it in a bank designated by the State Council's insurance regulatory authority. It shall not be used except for debt repayment during company liquidation.\nArticle 98 Insurance companies shall extract various liability reserves according to the principle of protecting the interests of the insured and ensuring solvency.\nThe specific methods for insurance companies to extract and carry forward liability reserves shall be formulated by the State Council's insurance regulatory authority.\nArticle 99 Insurance companies shall extract surplus reserves according to law.\nArticle 100 Insurance companies shall pay the insurance security fund.",
      "score" : 0.478392
    }, {
      "id" : 2141249533,
      "reference_id" : "aa1298dfe8a2cfd3f4392019231137d2",
      "doc_title" : "Insurance Law of the People's Republic of China.pdf",
      "subtitle" : "Insurance Law of the People's Republic of China\nInsurance Law of the People's Republic of China Section 1 General Provisions (3)",
      "doc_content" : "If the insurer knew at the time of contract formation that the policyholder had not truthfully disclosed information, the insurer shall not terminate the contract; in the event of an insurance accident, the insurer shall bear the responsibility for compensation or payment of insurance money.\nAn insurance incident refers to an accident within the scope of insurance liability agreed upon in the insurance contract.\nArticle 17 When concluding an insurance contract using the standard terms provided by the insurer, the insurer shall attach the standard terms to the application form provided to the policyholder and explain the content of the contract to the policyholder.\nFor clauses in the insurance contract that exempt the insurer from liability, the insurer shall make a sufficient prompt on the application form, insurance policy, or other insurance documents to attract the policyholder's attention and provide a clear explanation of the content of the clause in writing or orally; if no prompt or clear explanation is made, the clause shall not take effect.\nArticle 18 An insurance contract shall include the following items:\n(1) The name and address of the insurer;\n(2) The name or title, address of the policyholder and the insured, and the name or title, address of the beneficiary in personal insurance;\n(3) The subject of insurance;\n(4) Insurance liability and liability exemption;\n(5) Insurance period and the start time of insurance liability;\n(6) Insurance amount;\n(7) Insurance premium and payment method;\n(8) Insurance compensation or payment method;\n(9) Liability for breach of contract and dispute resolution;\n(10) The year, month, and day of the contract conclusion.\nThe policyholder and the insurer may agree on other matters related to insurance.\nThe beneficiary refers to the person designated by the insured or the policyholder in a personal insurance contract.",
      "score" : 0.0246569
    }, {
      "id" : 2141249534,
      "reference_id" : "aa1298dfe8a2cfd3f4392019231137d2",
      "doc_title" : "Insurance Law of the People's Republic of China.pdf",
      "subtitle" : "Insurance Law of the People's Republic of China\nInsurance Law of the People's Republic of China Chapter I General Provisions",
      "doc_content" : "Article 1 This law is formulated to regulate insurance activities, protect the legitimate rights and interests of parties involved in insurance activities, strengthen the supervision and management of the insurance industry, maintain social economic order and public interest, and promote the healthy development of the insurance industry.\nArticle 2 The insurance referred to in this law means that the policyholder pays the insurance premium to the insurer according to the contract, and the insurer assumes the responsibility for compensating the insurance money for the property loss caused by the possible accident agreed upon in the contract, or assumes the responsibility for paying the insurance money when the insured dies, is disabled, is ill, or reaches the age, term, or other conditions agreed upon in the contract.\nArticle 3 This law applies to insurance activities conducted within the territory of the People's Republic of China.\nArticle 4 Insurance activities must comply with laws and administrative regulations, respect social ethics, and not harm public interest.\nArticle 5 Parties involved in insurance activities shall exercise their rights and fulfill their obligations in accordance with the principle of good faith.\nArticle 6 Insurance business is operated by insurance companies established in accordance with this law and other insurance organizations prescribed by laws and administrative regulations. Other units and individuals shall not operate insurance business.\nArticle 7 Legal persons and other organizations within the territory of the People's Republic of China that need to handle domestic insurance shall insure with insurance companies within the territory of the People's Republic of China.\nArticle 8 The insurance industry and the banking, securities, and trust industries are operated and managed separately. Insurance companies and banking, securities, and trust business institutions are established separately. Except as otherwise provided by the state.\nArticle 9 The State Council's insurance regulatory authority shall supervise and manage the insurance industry in accordance with the law.\nThe State Council's insurance regulatory authority shall establish dispatched institutions as needed to perform its duties. The dispatched agency performs supervision and management duties in accordance with the authorization of the insurance regulatory agency of the State Council.",
      "score" : 0.014672
    } ]
  } ]
}

Status Codes

Status Code

Description

200

View the chat history.

Error Codes

See Error Codes.